From c6f749afda9bc8bab142a3eaa46d7ae9d512a196 Mon Sep 17 00:00:00 2001 From: olga1003 <55150916+olga1003@users.noreply.github.com> Date: Wed, 16 Mar 2022 12:27:40 +0400 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BB=D1=8F=20=D0=BE=D1=82=D1=87=D0=B5?= =?UTF-8?q?=D1=82=D0=B0=20=D0=BF=D0=BE=D0=B4=D0=B3=D0=BE=D1=82=D0=BE=D0=B2?= =?UTF-8?q?=D0=BA=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BindingModels/ReportBindingModel.cs | 19 +++++++ .../BusinessLogic/ReportBusinessLogic.cs | 42 +++++++++++++- .../StudentAcademicProgressBusinessLogic.cs | 2 +- .../Interfaces/IReportService.cs | 18 ++++++ ....cs => IStudentAcademicProgressService.cs} | 2 +- ...cademicProgressImplementationExtensions.cs | 2 +- .../StudentAcademicProgressService.cs | 2 +- .../ControlReportAcademicProgress.cs | 1 - .../ControlStudentGraduate.Designer.cs | 2 + .../SpecialControls/ControlStudentGraduate.cs | 56 +++++++++++++++---- .../ModuleTools/Enums/AccessOperation.cs | 2 + 11 files changed, 131 insertions(+), 17 deletions(-) create mode 100644 DepartmentPortal/AcademicProgressBusinessLogic/BindingModels/ReportBindingModel.cs create mode 100644 DepartmentPortal/AcademicProgressBusinessLogic/Interfaces/IReportService.cs rename DepartmentPortal/AcademicProgressBusinessLogic/Interfaces/{IStudentAcademicProgress.cs => IStudentAcademicProgressService.cs} (59%) diff --git a/DepartmentPortal/AcademicProgressBusinessLogic/BindingModels/ReportBindingModel.cs b/DepartmentPortal/AcademicProgressBusinessLogic/BindingModels/ReportBindingModel.cs new file mode 100644 index 0000000..6292e7d --- /dev/null +++ b/DepartmentPortal/AcademicProgressBusinessLogic/BindingModels/ReportBindingModel.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace AcademicProgressBusinessLogic.BindingModels +{ + // + /// Информация по выгрузке отчета + /// + public class ReportBindingModel + { + /// + /// Путь до папки, куда выгружать отчет + /// + public string FolderName { get; set; } + } +} diff --git a/DepartmentPortal/AcademicProgressBusinessLogic/BusinessLogic/ReportBusinessLogic.cs b/DepartmentPortal/AcademicProgressBusinessLogic/BusinessLogic/ReportBusinessLogic.cs index fc4c7fc..27d9f83 100644 --- a/DepartmentPortal/AcademicProgressBusinessLogic/BusinessLogic/ReportBusinessLogic.cs +++ b/DepartmentPortal/AcademicProgressBusinessLogic/BusinessLogic/ReportBusinessLogic.cs @@ -1,4 +1,9 @@ -using System; +using AcademicProgressBusinessLogic.BindingModels; +using AcademicProgressBusinessLogic.Interfaces; +using DepartmentBusinessLogic.Interfaces; +using ModuleTools.BusinessLogics; +using ModuleTools.Enums; +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -6,7 +11,40 @@ using System.Threading.Tasks; namespace AcademicProgressBusinessLogic.BusinessLogics { - public class ReportBusinessLogic + /// + /// Логика работы с отчетами + /// + public class ReportBusinessLogic : CoreBusinessLogic { + /// + /// Серивс для работы с отчетами + /// + private readonly IReportService _service; + + private readonly IStudentService _studentService; + + + /// + /// Логика работы с отчетом + /// + /// + public ReportBusinessLogic(IReportService service, IStudentService _studentService) + { + this._studentService = _studentService; + _service = service; + _serviceOperation = AccessOperation.Отчет_успеваемость; + _entity = "Отчеты для успеваемости"; + } + + public void SaveReportToWordFile(ReportBindingModel model) + { + /* SaveToWord.CreateDoc(new WordInfo + { + FileName = model.FolderName, + Title = "Список заявок", + RequestFlowers = GetRequestPlaces() + });*/ + } + } } diff --git a/DepartmentPortal/AcademicProgressBusinessLogic/BusinessLogic/StudentAcademicProgressBusinessLogic.cs b/DepartmentPortal/AcademicProgressBusinessLogic/BusinessLogic/StudentAcademicProgressBusinessLogic.cs index a1a20a1..0518afe 100644 --- a/DepartmentPortal/AcademicProgressBusinessLogic/BusinessLogic/StudentAcademicProgressBusinessLogic.cs +++ b/DepartmentPortal/AcademicProgressBusinessLogic/BusinessLogic/StudentAcademicProgressBusinessLogic.cs @@ -11,7 +11,7 @@ namespace AcademicProgressBusinessLogic.BusinessLogics /// public class StudentAcademicProgressBusinessLogic : GenericBusinessLogic { - public StudentAcademicProgressBusinessLogic(IStudentAcademicProgress service) : base(service, "Записи учебного прогресса", AccessOperation.Записи_Учебного_Прогресса) { } + public StudentAcademicProgressBusinessLogic(IStudentAcademicProgressService service) : base(service, "Записи учебного прогресса", AccessOperation.Записи_Учебного_Прогресса) { } } } diff --git a/DepartmentPortal/AcademicProgressBusinessLogic/Interfaces/IReportService.cs b/DepartmentPortal/AcademicProgressBusinessLogic/Interfaces/IReportService.cs new file mode 100644 index 0000000..dce157a --- /dev/null +++ b/DepartmentPortal/AcademicProgressBusinessLogic/Interfaces/IReportService.cs @@ -0,0 +1,18 @@ +using AcademicProgressBusinessLogic.BindingModels; +using ModuleTools.Models; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace AcademicProgressBusinessLogic.Interfaces +{ + /// + /// Сервис работы по выгрузке отчета + /// + public interface IReportService + { + OperationResultModel SaveReportToWordFile(ReportBindingModel model); + } +} diff --git a/DepartmentPortal/AcademicProgressBusinessLogic/Interfaces/IStudentAcademicProgress.cs b/DepartmentPortal/AcademicProgressBusinessLogic/Interfaces/IStudentAcademicProgressService.cs similarity index 59% rename from DepartmentPortal/AcademicProgressBusinessLogic/Interfaces/IStudentAcademicProgress.cs rename to DepartmentPortal/AcademicProgressBusinessLogic/Interfaces/IStudentAcademicProgressService.cs index 1475e8d..c5b70f9 100644 --- a/DepartmentPortal/AcademicProgressBusinessLogic/Interfaces/IStudentAcademicProgress.cs +++ b/DepartmentPortal/AcademicProgressBusinessLogic/Interfaces/IStudentAcademicProgressService.cs @@ -7,5 +7,5 @@ namespace AcademicProgressBusinessLogic.Interfaces /// /// Хранение учебного прогресса /// - public interface IStudentAcademicProgress : IGenerticEntityService { } + public interface IStudentAcademicProgressService : IGenerticEntityService { } } \ No newline at end of file diff --git a/DepartmentPortal/AcademicProgressDatabaseImplementation/AcademicProgressImplementationExtensions.cs b/DepartmentPortal/AcademicProgressDatabaseImplementation/AcademicProgressImplementationExtensions.cs index fc92a09..eb30b2e 100644 --- a/DepartmentPortal/AcademicProgressDatabaseImplementation/AcademicProgressImplementationExtensions.cs +++ b/DepartmentPortal/AcademicProgressDatabaseImplementation/AcademicProgressImplementationExtensions.cs @@ -10,7 +10,7 @@ namespace AcademicProgressDatabaseImplementation { public void RegisterServices() { - DependencyManager.Instance.RegisterType(); + DependencyManager.Instance.RegisterType(); } } diff --git a/DepartmentPortal/AcademicProgressDatabaseImplementation/Implementations/StudentAcademicProgressService.cs b/DepartmentPortal/AcademicProgressDatabaseImplementation/Implementations/StudentAcademicProgressService.cs index 2f8e607..c8da872 100644 --- a/DepartmentPortal/AcademicProgressDatabaseImplementation/Implementations/StudentAcademicProgressService.cs +++ b/DepartmentPortal/AcademicProgressDatabaseImplementation/Implementations/StudentAcademicProgressService.cs @@ -18,7 +18,7 @@ namespace AcademicProgressDatabaseImplementation.Implementations /// public class StudentAcademicProgressService : AbstractGenerticEntityService, - IStudentAcademicProgress + IStudentAcademicProgressService { protected override OperationResultModel AdditionalCheckingWhenAdding(DbContext context, StudentAcademicProgressSetBindingModel model) => OperationResultModel.Success(null); diff --git a/DepartmentPortal/AcademicProgressWindowsDesktop/SpecialControls/ControlReportAcademicProgress.cs b/DepartmentPortal/AcademicProgressWindowsDesktop/SpecialControls/ControlReportAcademicProgress.cs index 083bc20..ceda2f5 100644 --- a/DepartmentPortal/AcademicProgressWindowsDesktop/SpecialControls/ControlReportAcademicProgress.cs +++ b/DepartmentPortal/AcademicProgressWindowsDesktop/SpecialControls/ControlReportAcademicProgress.cs @@ -33,7 +33,6 @@ namespace AcademicProgressWindowsDesktop.SpecialControls /// private readonly ReportBusinessLogic _reportLogic; - private IStudentService _studentLogic; /// /// Событие, вызываемое при закрытии контрола diff --git a/DepartmentPortal/AcademicProgressWindowsDesktop/SpecialControls/ControlStudentGraduate.Designer.cs b/DepartmentPortal/AcademicProgressWindowsDesktop/SpecialControls/ControlStudentGraduate.Designer.cs index 962628c..2af4b69 100644 --- a/DepartmentPortal/AcademicProgressWindowsDesktop/SpecialControls/ControlStudentGraduate.Designer.cs +++ b/DepartmentPortal/AcademicProgressWindowsDesktop/SpecialControls/ControlStudentGraduate.Designer.cs @@ -90,6 +90,7 @@ namespace AcademicProgressWindowsDesktop.SpecialControls this.buttonSaveSelectFolder.TabIndex = 21; this.buttonSaveSelectFolder.Text = "Выбрать папку"; this.buttonSaveSelectFolder.UseVisualStyleBackColor = true; + this.buttonSaveSelectFolder.Click += new System.EventHandler(this.buttonSaveSelectFolder_Click); // // buttonSave // @@ -99,6 +100,7 @@ namespace AcademicProgressWindowsDesktop.SpecialControls this.buttonSave.TabIndex = 22; this.buttonSave.Text = "Сохранить"; this.buttonSave.UseVisualStyleBackColor = true; + this.buttonSave.Click += new System.EventHandler(this.buttonSave_Click); // // textBoxSaveFolderName // diff --git a/DepartmentPortal/AcademicProgressWindowsDesktop/SpecialControls/ControlStudentGraduate.cs b/DepartmentPortal/AcademicProgressWindowsDesktop/SpecialControls/ControlStudentGraduate.cs index 16c33d3..841a840 100644 --- a/DepartmentPortal/AcademicProgressWindowsDesktop/SpecialControls/ControlStudentGraduate.cs +++ b/DepartmentPortal/AcademicProgressWindowsDesktop/SpecialControls/ControlStudentGraduate.cs @@ -1,7 +1,11 @@ -using DepartmentWindowsDesktop.EntityControls; +using AcademicProgressBusinessLogic.BindingModels; +using AcademicProgressBusinessLogic.BusinessLogics; +using DepartmentWindowsDesktop.EntityControls; using DesktopTools.BaseControls; +using DesktopTools.Helpers; using DesktopTools.Interfaces; using DesktopTools.Models; +using ModuleTools.BusinessLogics; using ModuleTools.Enums; using System; using System.Windows.Forms; @@ -14,12 +18,24 @@ namespace AcademicProgressWindowsDesktop.SpecialControls /// public partial class ControlStudentGraduate : UserControl, IControl { - /// + + /// + /// Класс с бизнес-логикой работы с отчетом + /// + private readonly ReportBusinessLogic _reportLogic; + + /// /// Событие, вызываемое при закрытии контрола /// private event Action CloseEvent; - public ControlStudentGraduate() + + + /// + /// Контрол для работы с отчетом приложения к диплому + /// + public ControlStudentGraduate() { + _reportLogic = DependencyManager.Instance.Resolve(); InitializeComponent(); Title = "Приложение к диплому"; //что за цифры тут откуда брать... @@ -66,12 +82,7 @@ namespace AcademicProgressWindowsDesktop.SpecialControls } #endregion - - - private void buttonSave_Click_1(object sender, EventArgs e) - { - - } + private void LoadGroupBoxReportInfo() { @@ -100,5 +111,30 @@ namespace AcademicProgressWindowsDesktop.SpecialControls groupBoxReportInfo.Controls.Add(controlStudentGroup); } - } + 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) + { + try + { + _reportLogic.SaveReportToWordFile(new ReportBindingModel + { + FolderName = textBoxSaveFolderName.Text + }); + DialogHelper.MessageInformation("Сохранение прошло успешно", "Результат"); + + } + catch (Exception ex) + { + DialogHelper.MessageException(_reportLogic.Errors, "Ошибки при сохранении"); + } + } + } } diff --git a/DepartmentPortal/Common/ModuleTools/Enums/AccessOperation.cs b/DepartmentPortal/Common/ModuleTools/Enums/AccessOperation.cs index 392e1be..459568a 100644 --- a/DepartmentPortal/Common/ModuleTools/Enums/AccessOperation.cs +++ b/DepartmentPortal/Common/ModuleTools/Enums/AccessOperation.cs @@ -61,6 +61,8 @@ Для_выпускников = 703, Академическая_разница = 704, + + Отчет_успеваемость = 705, #endregion