From 193a465a815e87c07cb7728e934ec19ecb6ca836 Mon Sep 17 00:00:00 2001 From: GokaPek Date: Wed, 1 May 2024 15:22:03 +0400 Subject: [PATCH] =?UTF-8?q?=D0=BD=D0=B0=D1=87=D0=B0=D0=BB=D0=BE=20=D1=80?= =?UTF-8?q?=D0=B5=D0=BF=D0=BE=D1=80=D1=82=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BindingModels/ReportBindingModel.cs | 15 ++++++++++++ .../ReportDateRangeBindingModel.cs | 17 ++++++++++++++ .../BusinessLogicsContracts/IReportLogic.cs | 23 +++++++++++++++++++ .../ViewModels/TeacherViewModel.cs | 20 +++++++++++++++- 4 files changed, 74 insertions(+), 1 deletion(-) create mode 100644 University/UniversityContracts/BindingModels/ReportBindingModel.cs create mode 100644 University/UniversityContracts/BindingModels/ReportDateRangeBindingModel.cs create mode 100644 University/UniversityContracts/BusinessLogicsContracts/IReportLogic.cs diff --git a/University/UniversityContracts/BindingModels/ReportBindingModel.cs b/University/UniversityContracts/BindingModels/ReportBindingModel.cs new file mode 100644 index 0000000..1635afb --- /dev/null +++ b/University/UniversityContracts/BindingModels/ReportBindingModel.cs @@ -0,0 +1,15 @@ +namespace UniversityContracts.BindingModels; + +/// +/// Опции для сохранения отчета, при сохранении указать одно из двух +/// +public class ReportBindingModel +{ + public string? FileName { get; set; } + public Stream? Stream { get; set; } + + /// + /// Массив айдишников по которым происходит выборка + /// + public int[]? Ids { get; set; } +} \ No newline at end of file diff --git a/University/UniversityContracts/BindingModels/ReportDateRangeBindingModel.cs b/University/UniversityContracts/BindingModels/ReportDateRangeBindingModel.cs new file mode 100644 index 0000000..a0d7808 --- /dev/null +++ b/University/UniversityContracts/BindingModels/ReportDateRangeBindingModel.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace UniversityContracts.BindingModels +{ + public class ReportDateRangeBindingModel + { + public string? FileName { get; set; } + public Stream? Stream { get; set; } + + public DateOnly DateFrom { get; set; } + public DateOnly DateTo { get; set; } + } +} diff --git a/University/UniversityContracts/BusinessLogicsContracts/IReportLogic.cs b/University/UniversityContracts/BusinessLogicsContracts/IReportLogic.cs new file mode 100644 index 0000000..799ca5a --- /dev/null +++ b/University/UniversityContracts/BusinessLogicsContracts/IReportLogic.cs @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UniversityContracts.BindingModels; + +namespace UniversityContracts.BusinessLogicContracts +{ + public interface IReportLogic + { + void SaveDisciplinesToWord(ReportBindingModel option); + + void SaveDisciplinesToExcel(ReportBindingModel option); + + void SendAccountsToEmail(ReportDateRangeBindingModel option, string email); + void SaveClientsToWord(ReportBindingModel option); + + void SaveClientsToExcel(ReportBindingModel option); + + void SendDisciplinesToEmail(ReportDateRangeBindingModel option, string email); + } +} diff --git a/University/UniversityContracts/ViewModels/TeacherViewModel.cs b/University/UniversityContracts/ViewModels/TeacherViewModel.cs index 5a494cc..a6649f8 100644 --- a/University/UniversityContracts/ViewModels/TeacherViewModel.cs +++ b/University/UniversityContracts/ViewModels/TeacherViewModel.cs @@ -12,12 +12,30 @@ namespace UniversityContracts.ViewModels { public int Id { get; set; } public int UserId { get; set; } - public int StorekeeperId { get; set; } [DisplayName("ФИО")] public string Name { get; set; } = string.Empty; [DisplayName("Учёная степень")] public string AcademicDegree { get; set; } = string.Empty; [DisplayName("Должность")] public string Position { get; set; } = string.Empty; + + public List StudentViewModels { get; set; } = new(); + + /// + /// Для отчета по моделям + /// + /// + public override string ToString() + { + var result = new StringBuilder( + $"Преподаватель {Name} включает в себя группу студентов:"); + for (int i = 0; i < StudentViewModels.Count; i++) + { + var student = StudentViewModels[i]; + result.Append($"\n\t{i + 1}. {student.Name}" + + $"{student.PhoneNumber}"); + } + return result.ToString(); + } } }