DepartmentProject/DepartmentPortal/Security/SecurityBusinessLogic/ViewModels/AccessViewModels.cs

49 lines
1.8 KiB
C#
Raw Normal View History

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