58 lines
2.5 KiB
C#
58 lines
2.5 KiB
C#
using ModuleTools.Attributes;
|
|
using ModuleTools.Enums;
|
|
using ModuleTools.ViewModels;
|
|
using System;
|
|
|
|
namespace SecurityBusinessLogic.ViewModels
|
|
{
|
|
/// <summary>
|
|
/// Список пользователей
|
|
/// </summary>
|
|
public class UserListViewModel : ListViewModel<UserViewModel> { }
|
|
|
|
/// <summary>
|
|
/// Элемент пользователей
|
|
/// </summary>
|
|
[ViewModelControlElementClass(HaveDependenceEntities = true, Width = 800, Height = 500)]
|
|
[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; }
|
|
|
|
[MapConfiguration("PasswordHash", AllowCopyWithoutRigth = false)]
|
|
public string Password { get; set; }
|
|
|
|
[MapConfiguration("Avatar")]
|
|
[ViewModelControlElementProperty("Фото", ControlType.ControlImage, 200, 200)]
|
|
public byte[] Avatar { get; set; }
|
|
|
|
[ViewModelControlListProperty("Посл. визит", 100)]
|
|
[MapConfiguration("DateLastVisit")]
|
|
public DateTime? DateLastVisit { get; set; }
|
|
|
|
[MapConfiguration("IsBanned", AllowCopyWithoutRigth = false)]
|
|
[ViewModelControlElementProperty("Заблокирован", ControlType.ControlBool, MustHaveValue = true)]
|
|
public bool IsBanned { get; set; }
|
|
|
|
[ViewModelControlListProperty("Блокир.", 80)]
|
|
public string Banned => IsBanned ? "Да" : "Нет";
|
|
|
|
[MapConfiguration("DateBanned", AllowCopyWithoutRigth = false)]
|
|
[ViewModelControlElementProperty("Дата блокировки", ControlType.ControlDateTime, ReadOnly = true)]
|
|
public DateTime? DateBanned { get; set; }
|
|
|
|
[ViewModelControlListProperty("Дата Б.", 100)]
|
|
public string DateBannedTitle => DateBanned.HasValue ? DateBanned.Value.ToShortDateString() : string.Empty;
|
|
|
|
[MapConfiguration("CountAttempt", AllowCopyWithoutRigth = false)]
|
|
[ViewModelControlElementProperty("Попытки входа", ControlType.ControlInt , ReadOnly = true)]
|
|
public int CountAttempt { get; set; }
|
|
|
|
public override string ToString() => Login;
|
|
|
|
}
|
|
} |