Для отчета подготовка

This commit is contained in:
olga1003 2022-03-16 12:27:40 +04:00
parent 2240cbd791
commit c6f749afda
11 changed files with 131 additions and 17 deletions

View File

@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AcademicProgressBusinessLogic.BindingModels
{
// <summary>
/// Информация по выгрузке отчета
/// </summary>
public class ReportBindingModel
{
/// <summary>
/// Путь до папки, куда выгружать отчет
/// </summary>
public string FolderName { get; set; }
}
}

View File

@ -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
/// <summary>
/// Логика работы с отчетами
/// </summary>
public class ReportBusinessLogic : CoreBusinessLogic
{
/// <summary>
/// Серивс для работы с отчетами
/// </summary>
private readonly IReportService _service;
private readonly IStudentService _studentService;
/// <summary>
/// Логика работы с отчетом
/// </summary>
/// <param name="service"></param>
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()
});*/
}
}
}

View File

@ -11,7 +11,7 @@ namespace AcademicProgressBusinessLogic.BusinessLogics
/// </summary>
public class StudentAcademicProgressBusinessLogic : GenericBusinessLogic<StudentAcademicProgressGetBindingModel, StudentAcademicProgressSetBindingModel, StudentAcademicProgressListViewModel, StudentAcademicProgressViewModels>
{
public StudentAcademicProgressBusinessLogic(IStudentAcademicProgress service) : base(service, "Записи учебного прогресса", AccessOperation.Записи_Учебногорогресса) { }
public StudentAcademicProgressBusinessLogic(IStudentAcademicProgressService service) : base(service, "Записи учебного прогресса", AccessOperation.Записи_Учебногорогресса) { }
}
}

View File

@ -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
{
/// <summary>
/// Сервис работы по выгрузке отчета
/// </summary>
public interface IReportService
{
OperationResultModel SaveReportToWordFile(ReportBindingModel model);
}
}

View File

@ -7,5 +7,5 @@ namespace AcademicProgressBusinessLogic.Interfaces
/// <summary>
/// Хранение учебного прогресса
/// </summary>
public interface IStudentAcademicProgress : IGenerticEntityService<StudentAcademicProgressGetBindingModel, StudentAcademicProgressSetBindingModel> { }
public interface IStudentAcademicProgressService : IGenerticEntityService<StudentAcademicProgressGetBindingModel, StudentAcademicProgressSetBindingModel> { }
}

View File

@ -10,7 +10,7 @@ namespace AcademicProgressDatabaseImplementation
{
public void RegisterServices()
{
DependencyManager.Instance.RegisterType<IStudentAcademicProgress, StudentAcademicProgressService>();
DependencyManager.Instance.RegisterType<IStudentAcademicProgressService, StudentAcademicProgressService>();
}
}

View File

@ -18,7 +18,7 @@ namespace AcademicProgressDatabaseImplementation.Implementations
/// </summary>
public class StudentAcademicProgressService :
AbstractGenerticEntityService<StudentAcademicProgressGetBindingModel, StudentAcademicProgressSetBindingModel, StudentAcademicProgress, StudentAcademicProgressListViewModel, StudentAcademicProgressViewModels>,
IStudentAcademicProgress
IStudentAcademicProgressService
{
protected override OperationResultModel AdditionalCheckingWhenAdding(DbContext context, StudentAcademicProgressSetBindingModel model) => OperationResultModel.Success(null);

View File

@ -33,7 +33,6 @@ namespace AcademicProgressWindowsDesktop.SpecialControls
/// </summary>
private readonly ReportBusinessLogic _reportLogic;
private IStudentService _studentLogic;
/// <summary>
/// Событие, вызываемое при закрытии контрола

View File

@ -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
//

View File

@ -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
/// </summary>
public partial class ControlStudentGraduate : UserControl, IControl
{
/// <summary>
/// <summary>
/// Класс с бизнес-логикой работы с отчетом
/// </summary>
private readonly ReportBusinessLogic _reportLogic;
/// <summary>
/// Событие, вызываемое при закрытии контрола
/// </summary>
private event Action<Guid> CloseEvent;
public ControlStudentGraduate()
/// <summary>
/// Контрол для работы с отчетом приложения к диплому
/// </summary>
public ControlStudentGraduate()
{
_reportLogic = DependencyManager.Instance.Resolve<ReportBusinessLogic>();
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, "Ошибки при сохранении");
}
}
}
}

View File

@ -61,6 +61,8 @@
Для_выпускников = 703,
Академическая_разница = 704,
Отчет_успеваемость = 705,
#endregion