From fc68f68e9b54371752b9217ee48b3c28db8ed544 Mon Sep 17 00:00:00 2001 From: "ityurner02@mail.ru" Date: Mon, 20 Mar 2023 17:37:50 +0400 Subject: [PATCH] =?UTF-8?q?=D1=80=D0=B0=D0=B1=D0=BE=D1=82=D0=B0=D0=B5?= =?UTF-8?q?=D1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- PlumbingRepair/PlumbingRepair/FormReportOrders.cs | 9 +++++---- PlumbingRepair/PlumbingRepair/PlumbingRepair.csproj | 1 + .../BusinessLogic/ReportLogic.cs | 4 ++-- .../OfficePackage/AbstractSaveToPdf.cs | 2 +- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/PlumbingRepair/PlumbingRepair/FormReportOrders.cs b/PlumbingRepair/PlumbingRepair/FormReportOrders.cs index ed05ab7..ce8fc3e 100644 --- a/PlumbingRepair/PlumbingRepair/FormReportOrders.cs +++ b/PlumbingRepair/PlumbingRepair/FormReportOrders.cs @@ -39,8 +39,8 @@ namespace PlumbingRepair { var dataSource = _logic.GetOrders(new ReportBindingModel { - DateFrom = dateTimePickerFrom.Value, - DateTo = dateTimePickerTo.Value + DateFrom = DateTime.SpecifyKind(dateTimePickerFrom.Value, DateTimeKind.Utc), + DateTo = DateTime.SpecifyKind(dateTimePickerTo.Value, DateTimeKind.Utc) }); var source = new ReportDataSource("DataSetOrders", dataSource); reportViewer.LocalReport.DataSources.Clear(); @@ -61,6 +61,7 @@ namespace PlumbingRepair private void ButtonToPdf_Click(object sender, EventArgs e) { + System.Text.Encoding.RegisterProvider(System.Text.CodePagesEncodingProvider.Instance); if (dateTimePickerFrom.Value.Date >= dateTimePickerTo.Value.Date) { MessageBox.Show("Дата начала должна быть меньше даты окончания", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); @@ -74,8 +75,8 @@ namespace PlumbingRepair _logic.SaveOrdersToPdfFile(new ReportBindingModel { FileName = dialog.FileName, - DateFrom = dateTimePickerFrom.Value, - DateTo = dateTimePickerTo.Value + DateFrom = DateTime.SpecifyKind(dateTimePickerFrom.Value, DateTimeKind.Utc), + DateTo = DateTime.SpecifyKind(dateTimePickerTo.Value, DateTimeKind.Utc) }); _logger.LogInformation("Сохранение списка заказов на период {From}-{To}", dateTimePickerFrom.Value.ToShortDateString(), dateTimePickerTo.Value.ToShortDateString()); MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK, MessageBoxIcon.Information); diff --git a/PlumbingRepair/PlumbingRepair/PlumbingRepair.csproj b/PlumbingRepair/PlumbingRepair/PlumbingRepair.csproj index b5a0dde..4b959e7 100644 --- a/PlumbingRepair/PlumbingRepair/PlumbingRepair.csproj +++ b/PlumbingRepair/PlumbingRepair/PlumbingRepair.csproj @@ -15,6 +15,7 @@ + diff --git a/PlumbingRepair/PlumbingRepairBusinessLogic/BusinessLogic/ReportLogic.cs b/PlumbingRepair/PlumbingRepairBusinessLogic/BusinessLogic/ReportLogic.cs index de8056a..d8412fd 100644 --- a/PlumbingRepair/PlumbingRepairBusinessLogic/BusinessLogic/ReportLogic.cs +++ b/PlumbingRepair/PlumbingRepairBusinessLogic/BusinessLogic/ReportLogic.cs @@ -95,8 +95,8 @@ namespace PlumbingRepairBusinessLogic.BusinessLogic { FileName = model.FileName, Title = "Список заказов", - DateFrom = model.DateFrom!.Value, - DateTo = model.DateTo!.Value, + DateFrom = DateTime.SpecifyKind(model.DateFrom!.Value, DateTimeKind.Utc), + DateTo = DateTime.SpecifyKind(model.DateTo!.Value, DateTimeKind.Utc), Orders = GetOrders(model) }); } diff --git a/PlumbingRepair/PlumbingRepairBusinessLogic/OfficePackage/AbstractSaveToPdf.cs b/PlumbingRepair/PlumbingRepairBusinessLogic/OfficePackage/AbstractSaveToPdf.cs index 64d47c3..162be00 100644 --- a/PlumbingRepair/PlumbingRepairBusinessLogic/OfficePackage/AbstractSaveToPdf.cs +++ b/PlumbingRepair/PlumbingRepairBusinessLogic/OfficePackage/AbstractSaveToPdf.cs @@ -44,7 +44,7 @@ namespace PlumbingRepairBusinessLogic.OfficePackage } CreateParagraph(new PdfParagraph { - Text = $"Total: {info.Orders.Sum(x => x.Sum)}\t", + Text = $"Итого: {info.Orders.Sum(x => x.Sum)}\t", Style = "Normal", ParagraphAlignment = PdfParagraphAlignmentType.Rigth });