DepartmentProject/DepartmentPortal/Security/SecurityWindowsDesktop/Controls/ControlAccessList.cs

63 lines
2.4 KiB
C#
Raw Normal View History

using DesktopTools.Controls;
using DesktopTools.Enums;
using DesktopTools.Interfaces;
using DesktopTools.Models;
using ModuleTools.BusinessLogics;
using ModuleTools.Enums;
using SecurityBusinessLogic.BindingModels;
using SecurityBusinessLogic.BusinessLogics;
using SecurityBusinessLogic.ViewModels;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
namespace SecurityWindowsDesktop.Controls
{
/// <summary>
/// Реализация контрола для списка доступов
/// </summary>
public partial class ControlAccessList :
GenericControlEntityList<AccessGetBindingModel, AccessSetBindingModel, AccessListViewModel, AccessViewModel, AccessBusinessLogic>,
IGenericControlEntityList<AccessListViewModel, AccessViewModel>
{
private readonly RoleBusinessLogic _roleBusinessLogic;
public ControlAccessList()
{
InitializeComponent();
_roleBusinessLogic = DependencyManager.Instance.Resolve<RoleBusinessLogic>();
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 = _roleBusinessLogic.GetList(new RoleGetBindingModel())?.List?.Select(x =>
new PageNamesForPaginationModel
{
Key = x.Id.ToString(),
Value = x.RoleName
})?.ToList(),
ParentPropertyName = "RoleId",
HideToolStripButton = new List<ToolStripButtonListNames>
{
ToolStripButtonListNames.toolStripButtonSearch
}
};
public AccessListViewModel GetDataForControl() => throw new NotImplementedException();
public AccessListViewModel GetDataFromParentForControl(Guid id) => _businessLogic.GetList(new AccessGetBindingModel { RoleId = id });
public AccessListViewModel GetDataWithPageNameForControl(string key) => _businessLogic.GetList(new AccessGetBindingModel { RoleId = new Guid(key) });
public AccessListViewModel GetDataWithPageNumberForControl(int page, int count) => throw new NotImplementedException();
}
}