using ModuleTools.Attributes; using ModuleTools.Enums; using ModuleTools.ViewModels; using System; namespace SecurityBusinessLogic.ViewModels { /// /// Список достпуов /// public class AccessListViewModel : ListViewModel { } /// /// Элемент доступа /// public class AccessViewModel : ElementViewModel { [MapConfiguration("RoleId", AllowCopyWithoutRigth = false)] [ViewModelOnElementProperty("Роль", ControlType.ControlGuid, MustHaveValue = true, ControlTypeObject = "SecurityWindowsDesktop.Controls.RolesControl, SecurityWindowsDesktop")] public Guid RoleId { get; set; } [ViewModelOnListProperty("Роль", 100)] [MapConfiguration("Role.RoleName", IsDifficle = true, AllowCopyWithoutRigth = false)] public string RoleName { get; set; } [MapConfiguration("AccessOperation", AllowCopyWithoutRigth = false)] [ViewModelOnElementProperty("Операция", ControlType.ControlEnum, MustHaveValue = true)] public AccessOperation AccessOperation { get; set; } [ViewModelOnListProperty("Операция")] public string AccessOperationTitle => AccessOperation.ToString("G"); [MapConfiguration("AccessType", AllowCopyWithoutRigth = false)] [ViewModelOnElementProperty("Тип", ControlType.ControlEnum, MustHaveValue = true)] public AccessType AccessType { get; set; } [ViewModelOnListProperty("Тип", 150)] public string AccessTypeTitle => AccessType switch { AccessType.Delete => "Полные права", AccessType.Change => "Просмотр, Редактирование", AccessType.View => "Просмотр", _ => "Неопределено", }; public override string ToString() => $"{RoleName}-{AccessOperationTitle}({AccessTypeTitle})"; } }