From 2cf488436297ec9e36bca67700f106fe69f84b30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=92=D0=BE=D0=BB=D0=BE=D0=B4=D1=8F?= Date: Thu, 18 May 2023 21:22:03 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9F=D0=BE=D0=B4=D0=B3=D0=BE=D1=82=D0=BE?= =?UTF-8?q?=D0=B2=D0=BA=D0=B0=20=D0=BA=20=D0=BE=D1=82=D0=BF=D1=80=D0=B0?= =?UTF-8?q?=D0=B2=D0=BA=D0=B5=20=D0=BD=D0=B0=20=D0=BF=D0=BE=D1=87=D1=82?= =?UTF-8?q?=D1=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BusinessLogic/ReportLogic.cs | 4 +++- .../SchoolAgainStudyBusinessLogic.csproj | 1 + .../Controllers/HomeController.cs | 20 +++++++++++++++++++ .../Views/Home/SendingEmail.cshtml | 18 ++++++++--------- .../Views/Shared/_Layout.cshtml | 3 +++ 5 files changed, 35 insertions(+), 11 deletions(-) diff --git a/SchoolAgainStudy/SchoolAgainStudyBusinessLogic/BusinessLogic/ReportLogic.cs b/SchoolAgainStudy/SchoolAgainStudyBusinessLogic/BusinessLogic/ReportLogic.cs index a0242f3..2927eb3 100644 --- a/SchoolAgainStudy/SchoolAgainStudyBusinessLogic/BusinessLogic/ReportLogic.cs +++ b/SchoolAgainStudy/SchoolAgainStudyBusinessLogic/BusinessLogic/ReportLogic.cs @@ -39,6 +39,7 @@ namespace SchoolAgainStudyBusinessLogic.BusinessLogic public ReportLogic(IInterestStorage interestStorage, IMaterialStorage materialStorage, IProductStorage productStorage, IDiyStorage diyStorage, ITaskStorage taskStorage, ILessonStorage lessonStorage, AbstractSaveToExcelTeacher saveToExcelTeacher, AbstractSaveToWordTeacher saveToWordTeacher, AbstractSaveToPdfTeacher saveToPdfTeacher, AbstractSaveToExcelStudent saveToExcelStudent, AbstractSaveToWordStudent saveToWordStudent, AbstractSaveToPdfStudent saveToPdfStudent) { + _interestStorage = interestStorage; _materialStorage = materialStorage; _productStorage = productStorage; @@ -122,6 +123,7 @@ namespace SchoolAgainStudyBusinessLogic.BusinessLogic public List GetInterests(ReportBindingModel model) { + System.Text.Encoding.RegisterProvider(System.Text.CodePagesEncodingProvider.Instance); var interests = _interestStorage.GetFilteredList(new InterestSearchModel { StudentId = model.StudentId @@ -151,7 +153,7 @@ namespace SchoolAgainStudyBusinessLogic.BusinessLogic { list.Add(new ReportInterestViewModel { - InterestTitle = interests.FirstOrDefault(x => x.Id == interestProduct).ToString(), + InterestTitle = interests.FirstOrDefault(x => x.Id == interestProduct).Title, ProductTitle = product.Title, DateCreateProduct = product.DateCreate, DiyTitle = diy.Title, diff --git a/SchoolAgainStudy/SchoolAgainStudyBusinessLogic/SchoolAgainStudyBusinessLogic.csproj b/SchoolAgainStudy/SchoolAgainStudyBusinessLogic/SchoolAgainStudyBusinessLogic.csproj index 5645df8..881cfb1 100644 --- a/SchoolAgainStudy/SchoolAgainStudyBusinessLogic/SchoolAgainStudyBusinessLogic.csproj +++ b/SchoolAgainStudy/SchoolAgainStudyBusinessLogic/SchoolAgainStudyBusinessLogic.csproj @@ -8,6 +8,7 @@ + diff --git a/SchoolAgainStudy/StudentWebClient/Controllers/HomeController.cs b/SchoolAgainStudy/StudentWebClient/Controllers/HomeController.cs index b8ad20e..2bb2bcf 100644 --- a/SchoolAgainStudy/StudentWebClient/Controllers/HomeController.cs +++ b/SchoolAgainStudy/StudentWebClient/Controllers/HomeController.cs @@ -447,6 +447,26 @@ namespace StudentWebClient.Controllers var items = _report.GetInterestLesson(new ReportBindingModel { Interests = list, StudentId = APIClient.Student.Id}); return PartialView("_LessonListPartial", items); } + public IActionResult SendingEmail() + { + + return View(); + } + public IActionResult GetPartialForPDF(string dateFrom, string dateTo) + { + var _dateFrom = DateTime.SpecifyKind(DateTime.Parse(dateFrom), DateTimeKind.Utc); + var _dateTo = DateTime.SpecifyKind(DateTime.Parse(dateTo), DateTimeKind.Utc); + if(_dateFrom > _dateTo) + { + throw new Exception("Не верные даты"); + } + _report.SaveInterestsToPdfFile + (new ReportBindingModel { FileName = $"C:\\Users\\Вова\\Documents\\Учеба\\Reports\\{APIClient.Student.Name} от {_dateFrom.ToString("dd/MM/yyyy")}.pdf" , + DateFrom = _dateFrom, DateTo = _dateTo, StudentId = APIClient.Student.Id}); + + var items = _report.GetInterests(new ReportBindingModel { DateFrom = _dateFrom, DateTo = _dateTo, StudentId = APIClient.Student.Id }); + return PartialView("_LessonListPartial", items); + } } } \ No newline at end of file diff --git a/SchoolAgainStudy/StudentWebClient/Views/Home/SendingEmail.cshtml b/SchoolAgainStudy/StudentWebClient/Views/Home/SendingEmail.cshtml index 21c04c1..e4924bd 100644 --- a/SchoolAgainStudy/StudentWebClient/Views/Home/SendingEmail.cshtml +++ b/SchoolAgainStudy/StudentWebClient/Views/Home/SendingEmail.cshtml @@ -1,16 +1,14 @@ @{ ViewData["Title"] = "Report"; } -
- +
-
Интересы:
-
- @Html.ListBox("interests", (MultiSelectList)ViewBag.Interests) -
+
От:
+
@Html.TextBox("dateFrom" ,"" ,new {type="Date"})
+
+
+
До:
+
@Html.TextBox("dateTo" ,"" ,new {type="Date"})
@@ -19,4 +17,4 @@
@section scripts{ - \ No newline at end of file + } \ No newline at end of file diff --git a/SchoolAgainStudy/StudentWebClient/Views/Shared/_Layout.cshtml b/SchoolAgainStudy/StudentWebClient/Views/Shared/_Layout.cshtml index feebb29..66e64a2 100644 --- a/SchoolAgainStudy/StudentWebClient/Views/Shared/_Layout.cshtml +++ b/SchoolAgainStudy/StudentWebClient/Views/Shared/_Layout.cshtml @@ -44,6 +44,9 @@ +