From ed83f62c0116f4291c70c89b9d7617c952ad76dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=92=D0=BE=D0=BB=D0=BE=D0=B4=D1=8F?= Date: Fri, 7 Apr 2023 19:23:14 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9D=D0=B5=D0=B1=D0=BE=D0=BB=D1=8C=D1=88?= =?UTF-8?q?=D0=B8=D0=B5=20=D0=BF=D1=80=D0=B0=D0=B2=D0=BA=D0=B8=20=D0=B4?= =?UTF-8?q?=D0=BB=D1=8F=20=D0=BB=D0=BE=D0=B3=D0=B8=D0=BA=D0=B8=20=D0=BE?= =?UTF-8?q?=D1=82=D1=87=D0=B5=D1=82=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BusinessLogic/ReportLogic.cs | 82 ++++++++----------- .../OfficePackage/AbstractSaveToPdfStudent.cs | 4 +- .../OfficePackage/AbstractSaveToPdfTeacher.cs | 4 +- .../ViewModel/ReportInterestViewModel.cs | 11 ++- .../ViewModel/ReportLessonTaskViewModel.cs | 2 +- 5 files changed, 42 insertions(+), 61 deletions(-) diff --git a/SchoolAgainStudy/SchoolAgainStudyBusinessLogic/BusinessLogic/ReportLogic.cs b/SchoolAgainStudy/SchoolAgainStudyBusinessLogic/BusinessLogic/ReportLogic.cs index 3604adb..a0242f3 100644 --- a/SchoolAgainStudy/SchoolAgainStudyBusinessLogic/BusinessLogic/ReportLogic.cs +++ b/SchoolAgainStudy/SchoolAgainStudyBusinessLogic/BusinessLogic/ReportLogic.cs @@ -1,10 +1,12 @@ -using SchoolAgainStudyBusinessLogic.OfficePackage; +using DocumentFormat.OpenXml.Office2021.DocumentTasks; +using SchoolAgainStudyBusinessLogic.OfficePackage; using SchoolAgainStudyBusinessLogic.OfficePackage.HelperModels; using SchoolAgainStudyContracts.BindingModel; using SchoolAgainStudyContracts.BusinessLogicContracts; using SchoolAgainStudyContracts.SearchModel; using SchoolAgainStudyContracts.StorageContracts; using SchoolAgainStudyContracts.ViewModel; +using SchoolAgainStudyDataBaseImplements.Models; using SchoolAgainStudyDataModels.Models; using System; using System.Collections.Generic; @@ -137,51 +139,38 @@ namespace SchoolAgainStudyBusinessLogic.BusinessLogic DateTo = model.DateTo }); var list = new List(); - foreach(InterestViewModel interest in interests) - { - foreach(ProductViewModel product in products) - { - if (product.ProductInterests.ContainsKey(interest.Id)) - { - list.Add(new ReportInterestViewModel - { - InterestTitle=interest.Title, - InterestDesc = interest.Description, - WorkType = "Изделие", - WorkTitle = product.Title, - WorkDesc = product.Description, - DateCreate = product.DateCreate - }); - } - } - } - foreach (InterestViewModel interest in interests) + foreach (ProductViewModel product in products) { + foreach (DiyViewModel diy in diys) { - if (diy.DiyInterests.ContainsKey(interest.Id)) + + foreach (int interestProduct in product.ProductInterests.Keys) { - list.Add(new ReportInterestViewModel + if (diy.DiyInterests.ContainsKey(interestProduct)) { - InterestTitle = interest.Title, - InterestDesc = interest.Description, - WorkType = "Поделка", - WorkTitle = diy.Title, - WorkDesc = diy.Description, - DateCreate=diy.DateCreate - }); + list.Add(new ReportInterestViewModel + { + InterestTitle = interests.FirstOrDefault(x => x.Id == interestProduct).ToString(), + ProductTitle = product.Title, + DateCreateProduct = product.DateCreate, + DiyTitle = diy.Title, + DateCreateDiy = diy.DateCreate + }); + } + } } + + } + return list; } public List GetLessonTask(ReportBindingModel model) { - var materials = _materialStorage.GetFilteredList(new MaterialSearchModel - { - TeacherId = model.TeacherId - }); + var tasks = _taskStorage.GetFilteredList(new TaskSearchModel { TeacherId = model.TeacherId, @@ -201,28 +190,21 @@ namespace SchoolAgainStudyBusinessLogic.BusinessLogic foreach(LessonViewModel lesson in lessons) { - bool check = false; + foreach (int materialTask in task.TaskMaterials.Keys) { - if (check) + if (lesson.LessonMaterials.ContainsKey(materialTask)) { + list.Add(new ReportLessonTaskViewModel + { + TitleLesson = lesson.Title, + TitleTask = task.Title, + DateEventLesson = lesson.DateEvent, + DateIssueTask = task.DateIssue + }); break; } - foreach (int materialLesson in lesson.LessonMaterials.Keys) - { - if (materialLesson == materialTask) - { - list.Add(new ReportLessonTaskViewModel - { - TitleLesson = lesson.Title, - TitleTask = task.Title, - DateEventLesson = lesson.DateEvent, - DateIssueTask = task.DateIssue - }); - check=true; - break; - } - } + } } diff --git a/SchoolAgainStudy/SchoolAgainStudyBusinessLogic/OfficePackage/AbstractSaveToPdfStudent.cs b/SchoolAgainStudy/SchoolAgainStudyBusinessLogic/OfficePackage/AbstractSaveToPdfStudent.cs index d2050e1..d9c29ee 100644 --- a/SchoolAgainStudy/SchoolAgainStudyBusinessLogic/OfficePackage/AbstractSaveToPdfStudent.cs +++ b/SchoolAgainStudy/SchoolAgainStudyBusinessLogic/OfficePackage/AbstractSaveToPdfStudent.cs @@ -20,7 +20,7 @@ namespace SchoolAgainStudyBusinessLogic.OfficePackage CreateRow(new PdfRowParameters { - Texts = new List { "Номер","Интерес", "Описание интереса", "Тип","Название", "Описание", "Дата" }, + Texts = new List {"Интерес", "Изделие", "Дата","Поделка", "Дата" }, Style = "NormalTitle", ParagraphAlignment = PdfParagraphAlignmentType.Center }); @@ -29,7 +29,7 @@ namespace SchoolAgainStudyBusinessLogic.OfficePackage { CreateRow(new PdfRowParameters { - Texts = new List { interest.Id.ToString(),interest.InterestTitle,interest.InterestDesc,interest.WorkType,interest.WorkTitle,interest.WorkDesc, interest.DateCreate.ToShortDateString() }, + Texts = new List { interest.InterestTitle,interest.ProductTitle,interest.DateCreateProduct.ToShortDateString(), interest.DiyTitle, interest.DateCreateDiy.ToShortDateString() }, Style = "Normal", ParagraphAlignment = PdfParagraphAlignmentType.Left }); diff --git a/SchoolAgainStudy/SchoolAgainStudyBusinessLogic/OfficePackage/AbstractSaveToPdfTeacher.cs b/SchoolAgainStudy/SchoolAgainStudyBusinessLogic/OfficePackage/AbstractSaveToPdfTeacher.cs index bfefc47..f166ecc 100644 --- a/SchoolAgainStudy/SchoolAgainStudyBusinessLogic/OfficePackage/AbstractSaveToPdfTeacher.cs +++ b/SchoolAgainStudy/SchoolAgainStudyBusinessLogic/OfficePackage/AbstractSaveToPdfTeacher.cs @@ -20,7 +20,7 @@ namespace SchoolAgainStudyBusinessLogic.OfficePackage CreateRow(new PdfRowParameters { - Texts = new List { "Номер","Занятие", "Дата занятия", "Задание", "Дата выдачи задания" }, + Texts = new List { "Занятие", "Дата занятия", "Задание", "Дата выдачи задания" }, Style = "NormalTitle", ParagraphAlignment = PdfParagraphAlignmentType.Center }); @@ -29,7 +29,7 @@ namespace SchoolAgainStudyBusinessLogic.OfficePackage { CreateRow(new PdfRowParameters { - Texts = new List { taskLesson.Id.ToString(), taskLesson.TitleLesson, taskLesson.DateEventLesson.ToShortDateString(), taskLesson.TitleTask, taskLesson.DateIssueTask.ToShortDateString()}, + Texts = new List { taskLesson.TitleLesson, taskLesson.DateEventLesson.ToShortDateString(), taskLesson.TitleTask, taskLesson.DateIssueTask.ToShortDateString()}, Style = "Normal", ParagraphAlignment = PdfParagraphAlignmentType.Left }); diff --git a/SchoolAgainStudy/SchoolAgainStudyContracts/ViewModel/ReportInterestViewModel.cs b/SchoolAgainStudy/SchoolAgainStudyContracts/ViewModel/ReportInterestViewModel.cs index f8dce0f..1ada1bd 100644 --- a/SchoolAgainStudy/SchoolAgainStudyContracts/ViewModel/ReportInterestViewModel.cs +++ b/SchoolAgainStudy/SchoolAgainStudyContracts/ViewModel/ReportInterestViewModel.cs @@ -8,12 +8,11 @@ namespace SchoolAgainStudyContracts.ViewModel { public class ReportInterestViewModel { - public int Id { get; set; } + public string InterestTitle { get; set; } = string.Empty; - public string InterestDesc { get; set; } = string.Empty; - public string WorkType { get; set; } = string.Empty; - public string WorkTitle { get; set; } = string.Empty; - public string WorkDesc { get; set; } = string.Empty; - public DateTime DateCreate { get; set; } + public string ProductTitle { get; set; } = string.Empty; + public DateTime DateCreateProduct { get; set; } + public string DiyTitle { get; set; } = string.Empty; + public DateTime DateCreateDiy{ get; set; } } } diff --git a/SchoolAgainStudy/SchoolAgainStudyContracts/ViewModel/ReportLessonTaskViewModel.cs b/SchoolAgainStudy/SchoolAgainStudyContracts/ViewModel/ReportLessonTaskViewModel.cs index 0746219..dfe621a 100644 --- a/SchoolAgainStudy/SchoolAgainStudyContracts/ViewModel/ReportLessonTaskViewModel.cs +++ b/SchoolAgainStudy/SchoolAgainStudyContracts/ViewModel/ReportLessonTaskViewModel.cs @@ -8,7 +8,7 @@ namespace SchoolAgainStudyContracts.ViewModel { public class ReportLessonTaskViewModel { - public int Id { get; set; } + public string TitleLesson { get; set; } = string.Empty; public DateTime DateEventLesson { get; set; } public string TitleTask { get; set; } = string.Empty;