using CoreModels.ModelsSecurity; using System; using ToolsModule.ManagmentEntity; namespace SecurityContract.ViewModels { /// /// Список пользователей /// public class UserListViewModel : ListViewModel { } /// /// Элемент пользователей /// [ViewModelControlElementClass(HaveDependenceEntities = true, Width = 800, Height = 400)] [ViewModelControlElementDependenceEntity(Title = "Роли", Order = 1, ParentPropertyName = "UserId", ControlTypeObject = "SecurityWindowsDesktop.EntityControls.ControlUserRoleList, SecurityWindowsDesktop")] public class UserViewModel : ElementViewModel, IUserModel { [ViewModelControlListProperty("Пользователь")] [ViewModelControlElementProperty("Логин", ControlType.ControlString, MustHaveValue = true)] public string UserName { get; set; } public string PasswordHash { get; set; } [ViewModelControlElementProperty("Фото", ControlType.ControlImage, Width = 200, Height = 200)] public byte[] Avatar { get; set; } [ViewModelControlListProperty("Посл. визит", ColumnWidth = 100, DefaultCellStyleFormat = "dd.MM.yyyy")] public DateTime? DateLastVisit { get; set; } [ViewModelControlElementProperty("Заблокирован", ControlType.ControlBool, MustHaveValue = true)] public bool IsBanned { get; set; } [ViewModelControlListProperty("Блокир.", ColumnWidth = 80)] public string Banned => IsBanned ? "Да" : "Нет"; [ViewModelControlElementProperty("Дата блокировки", ControlType.ControlDateTime, ReadOnly = true)] public DateTime? DateBanned { get; set; } [ViewModelControlListProperty("Дата Б.", ColumnWidth = 100)] public string DateBannedTitle => DateBanned.HasValue ? DateBanned.Value.ToShortDateString() : string.Empty; [ViewModelControlElementProperty("Попытки входа", ControlType.ControlInt, ReadOnly = true)] public int CountAttempt { get; set; } } }