2021-04-06 22:07:11 +04:00
|
|
|
|
using DepartmentBusinessLogic.BindingModels;
|
|
|
|
|
using DepartmentBusinessLogic.BusinessLogics;
|
|
|
|
|
using DepartmentBusinessLogic.ViewModels;
|
2022-03-18 22:48:14 +04:00
|
|
|
|
using ToolsDesktop.Controls;
|
|
|
|
|
using ToolsDesktop.Enums;
|
|
|
|
|
using ToolsDesktop.Helpers;
|
|
|
|
|
using ToolsDesktop.Interfaces;
|
|
|
|
|
using ToolsDesktop.Models;
|
2022-03-18 22:38:52 +04:00
|
|
|
|
using ToolsModule.Enums;
|
2021-04-06 22:07:11 +04:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
2021-04-11 20:49:26 +04:00
|
|
|
|
using System.Windows.Forms;
|
2021-04-06 22:07:11 +04:00
|
|
|
|
|
|
|
|
|
namespace DepartmentWindowsDesktop.EntityControls
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Реализация контрола для списка учебных планов
|
|
|
|
|
/// </summary>
|
|
|
|
|
public partial class ControlAcademicPlanList :
|
|
|
|
|
GenericControlEntityList<AcademicPlanGetBindingModel, AcademicPlanSetBindingModel, AcademicPlanListViewModel, AcademicPlanViewModel, AcademicPlanBusinessLogic>,
|
|
|
|
|
IGenericControlEntityList
|
|
|
|
|
{
|
|
|
|
|
public ControlAcademicPlanList()
|
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
2021-04-11 20:49:26 +04:00
|
|
|
|
Title = "Учебные планы";
|
2021-04-06 22:07:11 +04:00
|
|
|
|
ControlId = new Guid("144d098c-ff55-4786-ae63-3105a92990cd");
|
|
|
|
|
AccessOperation = AccessOperation.УчебныеПланы;
|
|
|
|
|
ControlViewEntityElement = new ControlAcademicPlanElement();
|
|
|
|
|
_genericControlViewEntityList = this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public IControl GetInstanceGenericControl() => new ControlAcademicPlanList() { ControlId = Guid.NewGuid() };
|
|
|
|
|
|
|
|
|
|
public ControlViewEntityListConfiguration GetConfigControl() => new()
|
|
|
|
|
{
|
|
|
|
|
PaginationOn = false,
|
|
|
|
|
HideToolStripButton = new List<ToolStripButtonListNames>
|
|
|
|
|
{
|
|
|
|
|
ToolStripButtonListNames.toolStripButtonSearch
|
2021-04-11 20:49:26 +04:00
|
|
|
|
},
|
|
|
|
|
ControlOnMoveElem = new Dictionary<string, (string Title, EventHandler Event)>
|
|
|
|
|
{
|
|
|
|
|
{ "ToolStripMenuItemLoadPlx", ("Загрузить план", (object sender, EventArgs e) => { LoadPlx(); }) }
|
2021-04-06 22:07:11 +04:00
|
|
|
|
}
|
|
|
|
|
};
|
2021-04-11 20:49:26 +04:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Загрузка учебного плана
|
|
|
|
|
/// </summary>
|
|
|
|
|
private void LoadPlx()
|
|
|
|
|
{
|
|
|
|
|
var ids = GetSelectedIds();
|
|
|
|
|
if (ids.Count != 1)
|
|
|
|
|
{
|
|
|
|
|
DialogHelper.MessageException("Должна быть выбрана одна запись", $"Ошибка");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
var dialog = new OpenFileDialog
|
|
|
|
|
{
|
|
|
|
|
Filter = "plx|*.plx"
|
|
|
|
|
};
|
|
|
|
|
if (dialog.ShowDialog() == DialogResult.OK)
|
|
|
|
|
{
|
|
|
|
|
var result = _businessLogic.LoadPlx(new AcademicPlanLoadPlxModel
|
|
|
|
|
{
|
|
|
|
|
AcademicPlanId = ids[0],
|
|
|
|
|
FileName = dialog.FileName
|
|
|
|
|
});
|
|
|
|
|
if (result)
|
|
|
|
|
{
|
|
|
|
|
DialogHelper.MessageInformation("Загрузка прошла успешно", "Результат");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
DialogHelper.MessageException(_businessLogic.Errors, $"Ошибки при загрузке плана");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-04-06 22:07:11 +04:00
|
|
|
|
}
|
|
|
|
|
}
|