using ModuleTools.Attributes;
using ModuleTools.ViewModels;
using System;
namespace SecurityBusinessLogic.ViewModels
{
///
/// Список пользователей
///
public class UserListViewModel : ListViewModel { }
///
/// Элемент пользователей
///
public class UserViewModel : ElementViewModel
{
[ViewModelOnListProperty("Пользователь")]
[ViewModelOnElementProperty("Логин")]
[MapConfiguration("UserName")]
public string Login { get; set; }
[MapConfiguration("PasswordHash", AllowCopyWithoutRigth = false)]
public string Password { get; set; }
[MapConfiguration("StudentId")]
public Guid? StudentId { get; set; }
[MapConfiguration("LecturerId")]
public Guid? LecturerId { get; set; }
[MapConfiguration("EmployeeId")]
public Guid? EmployeeId { get; set; }
[MapConfiguration("Avatar")]
public byte[] Avatar { get; set; }
[ViewModelOnListProperty("Посл. визит", 100)]
[MapConfiguration("DateLastVisit")]
public DateTime? DateLastVisit { get; set; }
[MapConfiguration("IsBanned", AllowCopyWithoutRigth = false)]
public bool IsBanned { get; set; }
[ViewModelOnListProperty("Блокир.", 80)]
public string Banned => IsBanned ? "Да" : "Нет";
[MapConfiguration("DateBanned", AllowCopyWithoutRigth = false)]
public DateTime? DateBanned { get; set; }
[ViewModelOnListProperty("Дата Б.", 100)]
public string DateBannedTitle => DateBanned.HasValue ? DateBanned.Value.ToShortDateString() : string.Empty;
[MapConfiguration("CountAttempt", AllowCopyWithoutRigth = false)]
public int CountAttempt { get; set; }
public override string ToString() => Login;
}
}