diff --git a/University/UniversityBusinessLogic/OfficePackage/AbstractSaveToPdfWorker.cs b/University/UniversityBusinessLogic/OfficePackage/AbstractSaveToPdfWorker.cs index e16ad15..6d34c7d 100644 --- a/University/UniversityBusinessLogic/OfficePackage/AbstractSaveToPdfWorker.cs +++ b/University/UniversityBusinessLogic/OfficePackage/AbstractSaveToPdfWorker.cs @@ -10,7 +10,7 @@ namespace UniversityBusinessLogic.OfficePackage CreatePdf(info); CreateParagraph(new PdfParagraph { Text = info.Title, Style = "NormalTitle", ParagraphAlignment = PdfParagraphAlignmentType.Center }); - CreateTable(new List { "2cm", "3cm", "6cm", "3cm", "4 cm" }); + CreateTable(new List { "4cm", "5cm", "6cm", "5cm", "5 cm" }); CreateRow(new PdfRowParameters { diff --git a/University/UniversityClientApp/Controllers/HomeController.cs b/University/UniversityClientApp/Controllers/HomeController.cs index 54f2fcf..5aac7b6 100644 --- a/University/UniversityClientApp/Controllers/HomeController.cs +++ b/University/UniversityClientApp/Controllers/HomeController.cs @@ -225,13 +225,15 @@ namespace UniversityClientApp.Controllers Redirect("~/Home/Enter"); throw new Exception(" "); } + if (dateFrom == DateOnly.MinValue || dateTo == DateOnly.MaxValue) + { + throw new Exception(); + } if (type == "pdf") { - APIStorekeeper.PostRequest("api/discipline/createreporttopdffile", new ReportDateRangeBindingModel + APIStorekeeper.PostRequest($"api/discipline/createreporttopdffile?dateFrom={dateFrom:yyyy-MM-dd}&dateTo={dateTo:yyyy-MM-dd}", new ReportDateRangeBindingModel { - FileName = "C:\\\\ .pdf", - DateFrom = dateFrom, - DateTo = dateTo + FileName = "C:\\\\ .pdf" }); APIStorekeeper.PostRequest("api/discipline/sendpdftomail", new MailSendInfoBindingModel { diff --git a/University/UniversityClientApp/Views/Home/ReportDisciplines.cshtml b/University/UniversityClientApp/Views/Home/ReportDisciplines.cshtml index 406cf1e..58e0a9f 100644 --- a/University/UniversityClientApp/Views/Home/ReportDisciplines.cshtml +++ b/University/UniversityClientApp/Views/Home/ReportDisciplines.cshtml @@ -21,6 +21,14 @@
+
+ + +
+
+ + +
diff --git a/University/UniversityContracts/BindingModels/ReportDateRangeBindingModel.cs b/University/UniversityContracts/BindingModels/ReportDateRangeBindingModel.cs index a0d7808..602fa7c 100644 --- a/University/UniversityContracts/BindingModels/ReportDateRangeBindingModel.cs +++ b/University/UniversityContracts/BindingModels/ReportDateRangeBindingModel.cs @@ -10,7 +10,6 @@ namespace UniversityContracts.BindingModels { public string? FileName { get; set; } public Stream? Stream { get; set; } - public DateOnly DateFrom { get; set; } public DateOnly DateTo { get; set; } } diff --git a/University/UniversityDatabaseImplement/UniversityDatabase.cs b/University/UniversityDatabaseImplement/UniversityDatabase.cs index 2b73bad..3eebb86 100644 --- a/University/UniversityDatabaseImplement/UniversityDatabase.cs +++ b/University/UniversityDatabaseImplement/UniversityDatabase.cs @@ -11,7 +11,7 @@ namespace UniversityDatabaseImplement if (optionsBuilder.IsConfigured == false) { //Возможно понадобится писать вместо (localdb) название пк, вот пк Егора: DESKTOP-N8BRIPR; other-name: LAPTOP-DYCTATOR; other-name: DyCTaTOR - optionsBuilder.UseSqlServer(@"Data Source=DyCTaTOR\SQLEXPRESS;Initial Catalog=UniversityDatabaseFull;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True"); + optionsBuilder.UseSqlServer(@"Data Source=LAPTOP-DYCTATOR\SQLEXPRESS;Initial Catalog=UniversityDatabaseFull;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True"); } base.OnConfiguring(optionsBuilder); } diff --git a/University/UniversityRestApi/Controllers/DisciplineController .cs b/University/UniversityRestApi/Controllers/DisciplineController .cs index da19bd7..9c3ba42 100644 --- a/University/UniversityRestApi/Controllers/DisciplineController .cs +++ b/University/UniversityRestApi/Controllers/DisciplineController .cs @@ -105,11 +105,13 @@ namespace UniversityRestApi.Controllers [HttpPost] - public void CreateReportToPDFFile(ReportDateRangeBindingModel model) + public void CreateReportToPDFFile(ReportDateRangeBindingModel model, DateOnly dateFrom, DateOnly dateTo) { try { System.Text.Encoding.RegisterProvider(System.Text.CodePagesEncodingProvider.Instance); + model.DateTo = dateTo; + model.DateFrom = dateFrom; _reportLogic.SendDisciplinesToEmail(model); } catch (Exception ex)