2022-03-19 22:48:13 +04:00
|
|
|
|
using DepartmentContract.BindingModels;
|
|
|
|
|
using DepartmentContract.Logics.IGenericEntityLogic;
|
|
|
|
|
using DepartmentContract.ViewModels;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Linq;
|
2022-03-18 22:48:14 +04:00
|
|
|
|
using ToolsDesktop.BaseControls;
|
|
|
|
|
using ToolsDesktop.Controls;
|
|
|
|
|
using ToolsDesktop.Interfaces;
|
|
|
|
|
using ToolsDesktop.Models;
|
2022-03-18 22:38:52 +04:00
|
|
|
|
using ToolsModule.BusinessLogics;
|
|
|
|
|
using ToolsModule.Enums;
|
2021-04-03 19:03:56 +04:00
|
|
|
|
|
|
|
|
|
namespace DepartmentWindowsDesktop.EntityControls
|
|
|
|
|
{
|
2022-03-15 22:02:13 +04:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Реализация контрола для списка дисциплин
|
|
|
|
|
/// </summary>
|
|
|
|
|
public partial class ControlDisciplineList :
|
2022-03-19 22:48:13 +04:00
|
|
|
|
GenericControlEntityList<DisciplineGetBindingModel, DisciplineSetBindingModel, DisciplineListViewModel, DisciplineViewModel, IDisciplineLogic>,
|
2022-03-15 22:02:13 +04:00
|
|
|
|
IGenericControlEntityList
|
|
|
|
|
{
|
2022-03-19 22:48:13 +04:00
|
|
|
|
private readonly IDisciplineBlockLogic _disciplineBlockBusinessLogic;
|
2021-04-03 19:03:56 +04:00
|
|
|
|
|
2022-03-15 22:02:13 +04:00
|
|
|
|
public ControlDisciplineList()
|
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
2022-03-19 22:48:13 +04:00
|
|
|
|
_disciplineBlockBusinessLogic = DependencyManager.Instance.Resolve<IDisciplineBlockLogic>();
|
2022-03-15 22:02:13 +04:00
|
|
|
|
Title = "Дисциплины";
|
|
|
|
|
ControlId = new Guid("1731f50b-b20b-44c4-aa56-b335764fae7a");
|
|
|
|
|
AccessOperation = AccessOperation.Дисциплины;
|
|
|
|
|
ControlViewEntityElement = new ControlDisciplineElement();
|
|
|
|
|
_genericControlViewEntityList = this;
|
|
|
|
|
FillSearchPanel();
|
|
|
|
|
}
|
2021-04-03 19:03:56 +04:00
|
|
|
|
|
2022-03-15 22:02:13 +04:00
|
|
|
|
public IControl GetInstanceGenericControl() => new ControlDisciplineList() { ControlId = Guid.NewGuid() };
|
2021-04-03 19:03:56 +04:00
|
|
|
|
|
2022-03-15 22:02:13 +04:00
|
|
|
|
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"
|
|
|
|
|
};
|
|
|
|
|
}
|
2021-04-03 19:03:56 +04:00
|
|
|
|
|
2022-03-15 22:02:13 +04:00
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-04-03 19:03:56 +04:00
|
|
|
|
}
|