2021-03-28 19:15:55 +04:00
|
|
|
|
using ModuleTools.Attributes;
|
2021-03-30 22:34:31 +04:00
|
|
|
|
using ModuleTools.Enums;
|
2021-03-28 19:15:55 +04:00
|
|
|
|
using ModuleTools.ViewModels;
|
2021-03-26 20:09:52 +04:00
|
|
|
|
using System;
|
|
|
|
|
|
|
|
|
|
namespace SecurityBusinessLogic.ViewModels
|
|
|
|
|
{
|
2021-04-03 13:50:58 +04:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Список пользователей
|
|
|
|
|
/// </summary>
|
2021-03-26 20:09:52 +04:00
|
|
|
|
public class UserListViewModel : ListViewModel<UserViewModel> { }
|
|
|
|
|
|
2021-04-03 13:50:58 +04:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Элемент пользователей
|
|
|
|
|
/// </summary>
|
2021-04-08 10:46:57 +04:00
|
|
|
|
[ViewModelControlElementClass(HaveDependenceEntities = true, Width = 800, Height = 400)]
|
2021-04-03 13:50:58 +04:00
|
|
|
|
[ViewModelControlElementDependenceEntity(Title = "Роли", Order = 1, ParentPropertyName = "UserId",
|
|
|
|
|
ControlTypeObject = "SecurityWindowsDesktop.EntityControls.ControlUserRoleList, SecurityWindowsDesktop")]
|
|
|
|
|
public class UserViewModel : ElementViewModel
|
|
|
|
|
{
|
|
|
|
|
[ViewModelControlListProperty("Пользователь")]
|
|
|
|
|
[ViewModelControlElementProperty("Логин", ControlType.ControlString, MustHaveValue = true)]
|
|
|
|
|
[MapConfiguration("UserName")]
|
|
|
|
|
public string Login { get; set; }
|
2021-03-26 20:09:52 +04:00
|
|
|
|
|
2021-04-03 13:50:58 +04:00
|
|
|
|
[MapConfiguration("PasswordHash", AllowCopyWithoutRigth = false)]
|
|
|
|
|
public string Password { get; set; }
|
2021-03-29 23:16:11 +04:00
|
|
|
|
|
2021-04-03 13:50:58 +04:00
|
|
|
|
[ViewModelControlElementProperty("Фото", ControlType.ControlImage, Width = 200, Height = 200)]
|
2021-04-03 16:21:16 +04:00
|
|
|
|
[MapConfiguration("Avatar")]
|
2021-04-03 13:50:58 +04:00
|
|
|
|
public byte[] Avatar { get; set; }
|
2021-03-26 20:09:52 +04:00
|
|
|
|
|
2021-04-03 13:50:58 +04:00
|
|
|
|
[ViewModelControlListProperty("Посл. визит", ColumnWidth = 100, DefaultCellStyleFormat = "dd.MM.yyyy")]
|
|
|
|
|
[MapConfiguration("DateLastVisit")]
|
|
|
|
|
public DateTime? DateLastVisit { get; set; }
|
2021-03-26 20:09:52 +04:00
|
|
|
|
|
2021-04-03 13:50:58 +04:00
|
|
|
|
[ViewModelControlElementProperty("Заблокирован", ControlType.ControlBool, MustHaveValue = true)]
|
2021-04-03 16:21:16 +04:00
|
|
|
|
[MapConfiguration("IsBanned", AllowCopyWithoutRigth = false)]
|
2021-04-03 13:50:58 +04:00
|
|
|
|
public bool IsBanned { get; set; }
|
2021-03-26 20:09:52 +04:00
|
|
|
|
|
2021-04-03 13:50:58 +04:00
|
|
|
|
[ViewModelControlListProperty("Блокир.", ColumnWidth = 80)]
|
|
|
|
|
public string Banned => IsBanned ? "Да" : "Нет";
|
2021-03-26 20:09:52 +04:00
|
|
|
|
|
2021-04-03 13:50:58 +04:00
|
|
|
|
[ViewModelControlElementProperty("Дата блокировки", ControlType.ControlDateTime, ReadOnly = true)]
|
2021-04-03 16:21:16 +04:00
|
|
|
|
[MapConfiguration("DateBanned", AllowCopyWithoutRigth = false)]
|
2021-04-03 13:50:58 +04:00
|
|
|
|
public DateTime? DateBanned { get; set; }
|
2021-03-26 20:09:52 +04:00
|
|
|
|
|
2021-04-03 13:50:58 +04:00
|
|
|
|
[ViewModelControlListProperty("Дата Б.", ColumnWidth = 100)]
|
|
|
|
|
public string DateBannedTitle => DateBanned.HasValue ? DateBanned.Value.ToShortDateString() : string.Empty;
|
2021-03-26 20:09:52 +04:00
|
|
|
|
|
2021-04-03 13:50:58 +04:00
|
|
|
|
[ViewModelControlElementProperty("Попытки входа", ControlType.ControlInt, ReadOnly = true)]
|
2021-04-03 16:21:16 +04:00
|
|
|
|
[MapConfiguration("CountAttempt", AllowCopyWithoutRigth = false)]
|
2021-04-03 13:50:58 +04:00
|
|
|
|
public int CountAttempt { get; set; }
|
2021-03-26 20:09:52 +04:00
|
|
|
|
|
2021-04-03 13:50:58 +04:00
|
|
|
|
public override string ToString() => Login;
|
2021-03-26 20:09:52 +04:00
|
|
|
|
|
2021-04-03 13:50:58 +04:00
|
|
|
|
}
|
2021-03-26 20:09:52 +04:00
|
|
|
|
}
|