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