55 lines
1.8 KiB
C#
55 lines
1.8 KiB
C#
using SecurityContract.BindingModels;
|
||
using SecurityContract.Logics.IGenericEntityLogic;
|
||
using SecurityContract.ViewModels;
|
||
using System;
|
||
using System.Collections.Generic;
|
||
using System.Data;
|
||
using System.Linq;
|
||
using ToolsDesktop.Controls;
|
||
using ToolsDesktop.Enums;
|
||
using ToolsDesktop.Interfaces;
|
||
using ToolsDesktop.Models;
|
||
using ToolsModule.ManagmentDependency;
|
||
using ToolsModule.ManagmentSecurity;
|
||
|
||
namespace SecurityWindowsDesktop.EntityControls
|
||
{
|
||
/// <summary>
|
||
/// Реализация контрола для списка доступов
|
||
/// </summary>
|
||
public partial class ControlAccessList :
|
||
GenericControlEntityList<AccessGetBindingModel, AccessSetBindingModel, AccessListViewModel, AccessViewModel, IAccessLogic>,
|
||
IGenericControlEntityList
|
||
{
|
||
private readonly IRoleLogic _roleLogic;
|
||
|
||
public ControlAccessList()
|
||
{
|
||
InitializeComponent();
|
||
_roleLogic = DependencyManager.Instance.Resolve<IRoleLogic>();
|
||
Title = "Доступы";
|
||
ControlId = new Guid("6eebc4c4-cb86-4368-93e0-33dbdbb7409a");
|
||
AccessOperation = AccessOperation.Доступы;
|
||
ControlViewEntityElement = new ControlAccessElement();
|
||
_genericControlViewEntityList = this;
|
||
}
|
||
|
||
public IControl GetInstanceGenericControl() => new ControlAccessList() { ControlId = Guid.NewGuid() };
|
||
|
||
public ControlViewEntityListConfiguration GetConfigControl() => new()
|
||
{
|
||
PaginationOn = true,
|
||
PageNamesForPagination = _roleLogic.GetList(new RoleGetBindingModel())?.List?.Select(x =>
|
||
new PageNamesForPaginationModel
|
||
{
|
||
Key = x.Id,
|
||
Value = x.RoleName
|
||
})?.ToList(),
|
||
ParentPropertyName = "RoleId",
|
||
HideToolStripButton = new List<ToolStripButtonListNames>
|
||
{
|
||
ToolStripButtonListNames.toolStripButtonSearch
|
||
}
|
||
};
|
||
}
|
||
} |