149 lines
5.0 KiB
C#
149 lines
5.0 KiB
C#
using AcademicProgressBusinessLogic.BusinessLogics;
|
||
using DepartmentBusinessLogic.BindingModels;
|
||
using DepartmentBusinessLogic.BusinessLogics;
|
||
using DepartmentBusinessLogic.Interfaces;
|
||
using DepartmentWindowsDesktop.EntityControls;
|
||
using DesktopTools.BaseControls;
|
||
using DesktopTools.Interfaces;
|
||
using DesktopTools.Models;
|
||
using ModuleTools.BusinessLogics;
|
||
using ModuleTools.Enums;
|
||
using SecurityBusinessLogic.BindingModels;
|
||
using SecurityBusinessLogic.BusinessLogics;
|
||
using System;
|
||
using System.Collections.Generic;
|
||
using System.ComponentModel;
|
||
using System.Data;
|
||
using System.Drawing;
|
||
using System.Linq;
|
||
using System.Text;
|
||
using System.Threading.Tasks;
|
||
using System.Windows.Forms;
|
||
using System.Xml.Linq;
|
||
|
||
namespace AcademicProgressWindowsDesktop.SpecialControls
|
||
{
|
||
/// <summary>
|
||
/// Контрол для работы с отчетом об успеваемости
|
||
/// </summary>
|
||
public partial class ControlReportAcademicProgress : UserControl, IControl
|
||
{
|
||
/// <summary>
|
||
/// Класс с бизнес-логикой работы с отчетом
|
||
/// </summary>
|
||
private readonly ReportBusinessLogic _reportLogic;
|
||
|
||
|
||
/// <summary>
|
||
/// Событие, вызываемое при закрытии контрола
|
||
/// </summary>
|
||
///
|
||
private event Action<Guid> CloseEvent;
|
||
|
||
/// <summary>
|
||
/// Контрол для работы с отчетом об успеваемости
|
||
/// </summary>
|
||
public ControlReportAcademicProgress()
|
||
{
|
||
InitializeComponent();
|
||
_reportLogic = DependencyManager.Instance.Resolve<ReportBusinessLogic>();
|
||
Title = "Отчет об успеваемости студентов";
|
||
ControlId = new Guid("cc2244e6-5d92-4c89-b817-4c17ec382bc1");
|
||
AccessOperation = AccessOperation.Учет_успеваемости;
|
||
toolStripButtonClose.Click += (object sender, EventArgs e) =>
|
||
{
|
||
CloseEvent?.Invoke(ControlId);
|
||
Dispose();
|
||
};
|
||
LoadGroupBoxReportInfo();
|
||
|
||
}
|
||
|
||
#region IControl
|
||
public Guid ControlId { get; private set; }
|
||
|
||
public string Title { get; private set; }
|
||
|
||
public AccessOperation AccessOperation { get; private set; }
|
||
|
||
public IControl GetInstance() => new ControlReportAcademicProgress() { ControlId = Guid.NewGuid() };
|
||
|
||
public void Open(ControlOpenModel model)
|
||
{
|
||
if (model.CloseList != null)
|
||
{
|
||
CloseEvent += model.CloseList;
|
||
}
|
||
Dock = DockStyle.Fill;
|
||
}
|
||
|
||
public string SaveToXml() => new XElement("Control",
|
||
new XAttribute("Type", GetType().FullName),
|
||
new XAttribute("ControlId", ControlId),
|
||
new XAttribute("Title", Title),
|
||
new XAttribute("AccessOperation", AccessOperation)).ToString();
|
||
|
||
public void LoadFromXml(string xml)
|
||
{
|
||
var control = XElement.Parse(xml);
|
||
ControlId = new Guid(control.Attribute("ControlId").Value.ToString());
|
||
Title = control.Attribute("Title").Value.ToString();
|
||
AccessOperation = (AccessOperation)Enum.Parse(typeof(AccessOperation), control.Attribute("AccessOperation").Value.ToString());
|
||
}
|
||
#endregion
|
||
|
||
|
||
/// <summary>
|
||
/// Выбор пути для папки сохранения отчета
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
private void buttonSaveSelectFolder_Click(object sender, EventArgs e)
|
||
{
|
||
var fbd = new FolderBrowserDialog();
|
||
if (fbd.ShowDialog() == DialogResult.OK)
|
||
{
|
||
textBoxSaveFolderName.Text = fbd.SelectedPath;
|
||
}
|
||
}
|
||
|
||
private void buttonSave_Click(object sender, EventArgs e)
|
||
{
|
||
|
||
}
|
||
|
||
private void buttonSave_Click_1(object sender, EventArgs e)
|
||
{
|
||
|
||
}
|
||
|
||
private void LoadGroupBoxReportInfo()
|
||
{
|
||
|
||
int positionY = 40;
|
||
int interval = 15;
|
||
|
||
var controlStudent = new BaseControlGuid("StudentId", true, false, new ControlStudentList(), null)
|
||
{
|
||
Location = new System.Drawing.Point(50, positionY),
|
||
Size = new System.Drawing.Size(410, 23)
|
||
|
||
};
|
||
controlStudent.SetTitleWidth(controlStudent.SetTitle("Cтудент:"));
|
||
groupBoxReportInfo.Controls.Add(controlStudent);
|
||
|
||
positionY += controlStudent.Height + interval;
|
||
|
||
var controlStudentGroup = new BaseControlGuid(" StudentGroupId", true, false, new ControlStudentGroupList(), null)
|
||
{
|
||
Location = new System.Drawing.Point(53, positionY),
|
||
Size = new System.Drawing.Size(407, 23)
|
||
|
||
};
|
||
controlStudentGroup.SetTitleWidth(controlStudentGroup.SetTitle("Группа:"));
|
||
groupBoxReportInfo.Controls.Add(controlStudentGroup);
|
||
}
|
||
|
||
}
|
||
}
|