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