DD.WellWorkover.Cloud/AsbCloudApp/Data/SAUB/TelemetryUserDto.cs

52 lines
1.2 KiB
C#
Raw Normal View History

2024-08-19 10:01:07 +05:00
namespace AsbCloudApp.Data.SAUB;
/// <summary>
/// Пользователь панели оператора
/// </summary>
public class TelemetryUserDto : IId
2021-04-23 10:21:25 +05:00
{
2024-08-19 10:01:07 +05:00
/// <inheritdoc/>
public int Id { get; set; }
2022-06-02 12:35:51 +05:00
/// <summary>
2024-08-19 10:01:07 +05:00
/// Имя
2022-06-02 12:35:51 +05:00
/// </summary>
2024-08-19 10:01:07 +05:00
public string? Name { get; set; }
2021-04-23 10:21:25 +05:00
2024-08-19 10:01:07 +05:00
/// <summary>
/// Фамилия
/// </summary>
public string Surname { get; set; } = null!;
2021-04-23 10:21:25 +05:00
2024-08-19 10:01:07 +05:00
/// <summary>
/// Отчество
/// </summary>
public string? Patronymic { get; set; }
2021-04-23 10:21:25 +05:00
2024-08-19 10:01:07 +05:00
/// <summary>
/// Уровень доступа
/// </summary>
public int? Level { get; set; }
2024-08-19 10:01:07 +05:00
/// <summary>
/// Собрать отображаемое имя пользователя
/// </summary>
/// <returns></returns>
public string MakeDisplayName()
{
if (!string.IsNullOrEmpty(Surname))
{
2024-08-19 10:01:07 +05:00
var s = Surname;
if (!string.IsNullOrEmpty(Name))
{
2024-08-19 10:01:07 +05:00
s += $"{Name[0]}.";
if (!string.IsNullOrEmpty(Patronymic))
s += $" {Patronymic[0]}.";
}
2024-08-19 10:01:07 +05:00
return s;
}
2024-08-19 10:01:07 +05:00
else
return $"User #{Id}";
2021-04-23 10:21:25 +05:00
}
}