DepartmentProject/DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/Discipline/ControlDisciplineList.cs

66 lines
2.9 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using DepartmentContract.BindingModels;
using DepartmentContract.Logics.IGenericEntityLogic;
using DepartmentContract.ViewModels;
using System;
using System.Linq;
using ToolsDesktop.BaseControls;
using ToolsDesktop.Controls;
using ToolsDesktop.Interfaces;
using ToolsDesktop.Models;
using ToolsModule.DependencyManagment;
using ToolsModule.Enums;
namespace DepartmentWindowsDesktop.EntityControls
{
/// <summary>
/// Реализация контрола для списка дисциплин
/// </summary>
public partial class ControlDisciplineList :
GenericControlEntityList<DisciplineGetBindingModel, DisciplineSetBindingModel, DisciplineListViewModel, DisciplineViewModel, IDisciplineLogic>,
IGenericControlEntityList
{
private readonly IDisciplineBlockLogic _disciplineBlockBusinessLogic;
public ControlDisciplineList()
{
InitializeComponent();
_disciplineBlockBusinessLogic = DependencyManager.Instance.Resolve<IDisciplineBlockLogic>();
Title = "Дисциплины";
ControlId = new Guid("1731f50b-b20b-44c4-aa56-b335764fae7a");
AccessOperation = AccessOperation.Дисциплины;
ControlViewEntityElement = new ControlDisciplineElement();
_genericControlViewEntityList = this;
FillSearchPanel();
}
public IControl GetInstanceGenericControl() => new ControlDisciplineList() { ControlId = Guid.NewGuid() };
public ControlViewEntityListConfiguration GetConfigControl()
{
return new ControlViewEntityListConfiguration()
{
PaginationOn = true,
PageNamesForPagination = _disciplineBlockBusinessLogic.GetList(new DisciplineBlockGetBindingModel())?.List?.Select(x =>
new PageNamesForPaginationModel
{
Key = x.Id,
Value = x.Title
})?.ToList(),
ParentPropertyName = "DisciplineBlockId"
};
}
private void FillSearchPanel()
{
var control = new BaseControlString("DisciplineNameForSearch", false, false, 0)
{
Location = new System.Drawing.Point(10, 10),
Size = new System.Drawing.Size(400, 23),
Name = "SearchDisciplineName",
TabIndex = 0
};
control.SetTitleWidth(control.SetTitle("Название:"));
panelSearchControls.Controls.Add(control);
}
}
}