2023-02-20 12:18:45 +05:00
|
|
|
|
using System.ComponentModel.DataAnnotations;
|
|
|
|
|
|
2023-06-21 12:33:18 +05:00
|
|
|
|
namespace AsbCloudApp.Data.User
|
2021-04-02 17:28:07 +05:00
|
|
|
|
{
|
2022-06-02 12:35:51 +05:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// DTO пользователя платформы
|
|
|
|
|
/// </summary>
|
2022-04-11 18:00:34 +05:00
|
|
|
|
public class UserDto : IId
|
2021-04-02 17:28:07 +05:00
|
|
|
|
{
|
2022-06-02 12:35:51 +05:00
|
|
|
|
/// <inheritdoc/>
|
2021-04-02 17:28:07 +05:00
|
|
|
|
public int Id { get; set; }
|
2022-06-02 12:35:51 +05:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// логин
|
|
|
|
|
/// </summary>
|
2023-03-10 05:42:54 +05:00
|
|
|
|
[Required(ErrorMessage = "Логин не должен быть пустым")]
|
2023-09-28 17:09:44 +05:00
|
|
|
|
[StringLength(50, MinimumLength = 3, ErrorMessage = "Допустимая длина логина от 3 до 50 символов")]
|
2023-02-20 12:18:45 +05:00
|
|
|
|
public string Login { get; set; } = null!;
|
2022-06-02 12:35:51 +05:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Имя
|
|
|
|
|
/// </summary>
|
2023-03-10 05:42:54 +05:00
|
|
|
|
[StringLength(50, MinimumLength = 0, ErrorMessage = "Допустимая длина имени от 1 до 50 символов")]
|
2023-02-20 12:18:45 +05:00
|
|
|
|
public string? Name { get; set; }
|
2022-06-02 12:35:51 +05:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Фамилия
|
|
|
|
|
/// </summary>
|
2023-03-10 05:42:54 +05:00
|
|
|
|
[StringLength(50, MinimumLength = 0, ErrorMessage = "Допустимая длина фамилии от 1 до 50 символов")]
|
2023-02-20 12:18:45 +05:00
|
|
|
|
public string? Surname { get; set; }
|
2022-06-02 12:35:51 +05:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Отчество
|
|
|
|
|
/// </summary>
|
2023-03-10 05:42:54 +05:00
|
|
|
|
[StringLength(50, MinimumLength = 0, ErrorMessage = "Допустимая длина отчества от 1 до 50 символов")]
|
2023-02-20 12:18:45 +05:00
|
|
|
|
public string? Patronymic { get; set; }
|
2022-06-02 12:35:51 +05:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Email
|
|
|
|
|
/// </summary>
|
2023-02-20 12:18:45 +05:00
|
|
|
|
[Required]
|
2023-09-28 17:09:44 +05:00
|
|
|
|
[StringLength(260, MinimumLength = 3, ErrorMessage = "Допустимая длина email от 3 до 260 символов")]
|
2023-02-20 12:18:45 +05:00
|
|
|
|
public string Email { get; set; } = null!;
|
2022-06-02 12:35:51 +05:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Phone
|
|
|
|
|
/// </summary>
|
2023-03-10 05:42:54 +05:00
|
|
|
|
[StringLength(50, MinimumLength = 1, ErrorMessage = "Допустимая длина телефона от 1 до 50 символов")]
|
2023-02-20 12:18:45 +05:00
|
|
|
|
public string? Phone { get; set; }
|
2022-06-02 12:35:51 +05:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Должность
|
|
|
|
|
/// </summary>
|
2023-03-10 05:42:54 +05:00
|
|
|
|
[StringLength(100, MinimumLength = 1, ErrorMessage = "Допустимая длина должности от 1 до 100 символов")]
|
2023-02-20 12:18:45 +05:00
|
|
|
|
public string? Position { get; set; }
|
2022-06-02 12:35:51 +05:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Id компании
|
|
|
|
|
/// </summary>
|
2023-02-20 12:18:45 +05:00
|
|
|
|
[Required]
|
|
|
|
|
public int IdCompany { get; set; }
|
2022-06-02 12:35:51 +05:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Id состояния пользователя
|
2023-07-13 12:45:41 +05:00
|
|
|
|
/// 0 - не активен,
|
|
|
|
|
/// 1 - активен,
|
|
|
|
|
/// 2 - заблокирован
|
2022-06-02 12:35:51 +05:00
|
|
|
|
/// </summary>
|
2023-07-12 12:07:56 +05:00
|
|
|
|
public short IdState { get; set; }
|
2022-06-02 12:35:51 +05:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// DTO компании
|
|
|
|
|
/// </summary>
|
2023-02-20 12:18:45 +05:00
|
|
|
|
public CompanyDto? Company { get; set; }
|
2022-10-27 15:49:22 +05:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Получение отображаемого имени
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public string MakeDisplayName()
|
|
|
|
|
{
|
|
|
|
|
if (string.IsNullOrEmpty(Surname))
|
|
|
|
|
return Login;
|
|
|
|
|
|
|
|
|
|
var s = Surname;
|
|
|
|
|
if (!string.IsNullOrEmpty(Name))
|
|
|
|
|
{
|
|
|
|
|
s += $"{Name[0]}.";
|
|
|
|
|
if (!string.IsNullOrEmpty(Patronymic))
|
|
|
|
|
s += $" {Patronymic[0]}.";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return s;
|
|
|
|
|
}
|
2021-04-02 17:28:07 +05:00
|
|
|
|
}
|
|
|
|
|
}
|