From 1aa25cc87c0489cb944635911ff0bd6394dce3e3 Mon Sep 17 00:00:00 2001 From: ekallin Date: Sun, 24 Mar 2024 20:42:18 +0400 Subject: [PATCH] =?UTF-8?q?=D0=BF=D0=BE=D1=87=D1=82=D0=B8=20=D0=B3=D0=BE?= =?UTF-8?q?=D1=82=D0=BE=D0=B2=D0=BE=20=D0=91=D0=95=D0=97=20=D0=A3=D0=A7?= =?UTF-8?q?=D0=95=D0=A2=D0=90=20=D0=A2=D0=A0=D0=95=D0=91=D0=9E=D0=92=D0=90?= =?UTF-8?q?=D0=9D=D0=98=D0=99=20=D0=B5=D1=81=D1=82=D1=8C=20=D0=B1=D0=B0?= =?UTF-8?q?=D0=B3=20=D1=81=20=D0=B7=D0=B0=D0=B3=D1=80=D1=83=D0=B7=D0=BA?= =?UTF-8?q?=D0=BE=D0=B9=20=D0=BE=D1=82=D1=87=D0=B5=D1=82=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SushiBar/FormMain.cs | 1 - .../FormReportOrders.Designer.cs | 68 ++++++++++--------- SushiBar/{Reports => }/FormReportOrders.cs | 10 +-- SushiBar/{Reports => }/FormReportOrders.resx | 0 .../FormReportSushiComponent.Designer.cs | 2 + .../{Reports => }/FormReportSushiComponent.cs | 0 .../FormReportSushiComponent.resx | 0 SushiBar/Program.cs | 6 ++ SushiBar/{Reports => }/ReportOrders.rdlc | 0 SushiBarBusinessLogic/Reportlogic.cs | 5 -- .../Implements/OrderStorage.cs | 2 +- 11 files changed, 50 insertions(+), 44 deletions(-) rename SushiBar/{Reports => }/FormReportOrders.Designer.cs (97%) rename SushiBar/{Reports => }/FormReportOrders.cs (89%) rename SushiBar/{Reports => }/FormReportOrders.resx (100%) rename SushiBar/{Reports => }/FormReportSushiComponent.Designer.cs (97%) rename SushiBar/{Reports => }/FormReportSushiComponent.cs (100%) rename SushiBar/{Reports => }/FormReportSushiComponent.resx (100%) rename SushiBar/{Reports => }/ReportOrders.rdlc (100%) diff --git a/SushiBar/FormMain.cs b/SushiBar/FormMain.cs index ea2f1c7..7b621e4 100644 --- a/SushiBar/FormMain.cs +++ b/SushiBar/FormMain.cs @@ -172,7 +172,6 @@ namespace SushiBarView { form.ShowDialog(); } - } } } diff --git a/SushiBar/Reports/FormReportOrders.Designer.cs b/SushiBar/FormReportOrders.Designer.cs similarity index 97% rename from SushiBar/Reports/FormReportOrders.Designer.cs rename to SushiBar/FormReportOrders.Designer.cs index 3e17dca..38166b0 100644 --- a/SushiBar/Reports/FormReportOrders.Designer.cs +++ b/SushiBar/FormReportOrders.Designer.cs @@ -29,12 +29,12 @@ private void InitializeComponent() { panel = new Panel(); - dateTimePickerDateTo = new DateTimePicker(); - dateTimePickerDateFrom = new DateTimePicker(); - buttonMake = new Button(); - buttonToPdf = new Button(); - labelTo = new Label(); labelFrom = new Label(); + buttonToPdf = new Button(); + dateTimePickerDateFrom = new DateTimePicker(); + labelTo = new Label(); + dateTimePickerDateTo = new DateTimePicker(); + buttonMake = new Button(); panel.SuspendLayout(); SuspendLayout(); // @@ -52,28 +52,14 @@ panel.Size = new Size(1321, 71); panel.TabIndex = 3; // - // dateTimePickerDateTo + // labelFrom // - dateTimePickerDateTo.Location = new Point(365, 27); - dateTimePickerDateTo.Name = "dateTimePickerDateTo"; - dateTimePickerDateTo.Size = new Size(250, 27); - dateTimePickerDateTo.TabIndex = 1; - // - // dateTimePickerDateFrom - // - dateTimePickerDateFrom.Location = new Point(51, 27); - dateTimePickerDateFrom.Name = "dateTimePickerDateFrom"; - dateTimePickerDateFrom.Size = new Size(250, 27); - dateTimePickerDateFrom.TabIndex = 0; - // - // buttonMake - // - buttonMake.Location = new Point(677, 27); - buttonMake.Name = "buttonMake"; - buttonMake.Size = new Size(132, 29); - buttonMake.TabIndex = 3; - buttonMake.Text = "Сформировать"; - buttonMake.UseVisualStyleBackColor = true; + labelFrom.AutoSize = true; + labelFrom.Location = new Point(16, 31); + labelFrom.Name = "labelFrom"; + labelFrom.Size = new Size(18, 20); + labelFrom.TabIndex = 3; + labelFrom.Text = "С"; // // buttonToPdf // @@ -83,6 +69,14 @@ buttonToPdf.TabIndex = 4; buttonToPdf.Text = "В PDF"; buttonToPdf.UseVisualStyleBackColor = true; + buttonToPdf.Click += ButtonToPdf_Click; + // + // dateTimePickerDateFrom + // + dateTimePickerDateFrom.Location = new Point(51, 27); + dateTimePickerDateFrom.Name = "dateTimePickerDateFrom"; + dateTimePickerDateFrom.Size = new Size(250, 27); + dateTimePickerDateFrom.TabIndex = 0; // // labelTo // @@ -93,14 +87,22 @@ labelTo.TabIndex = 4; labelTo.Text = "По"; // - // labelFrom + // dateTimePickerDateTo // - labelFrom.AutoSize = true; - labelFrom.Location = new Point(16, 31); - labelFrom.Name = "labelFrom"; - labelFrom.Size = new Size(18, 20); - labelFrom.TabIndex = 3; - labelFrom.Text = "С"; + dateTimePickerDateTo.Location = new Point(365, 27); + dateTimePickerDateTo.Name = "dateTimePickerDateTo"; + dateTimePickerDateTo.Size = new Size(250, 27); + dateTimePickerDateTo.TabIndex = 1; + // + // buttonMake + // + buttonMake.Location = new Point(677, 27); + buttonMake.Name = "buttonMake"; + buttonMake.Size = new Size(132, 29); + buttonMake.TabIndex = 3; + buttonMake.Text = "Сформировать"; + buttonMake.UseVisualStyleBackColor = true; + buttonMake.Click += ButtonMake_Click; // // FormReportOrders // diff --git a/SushiBar/Reports/FormReportOrders.cs b/SushiBar/FormReportOrders.cs similarity index 89% rename from SushiBar/Reports/FormReportOrders.cs rename to SushiBar/FormReportOrders.cs index b6822e8..f13388b 100644 --- a/SushiBar/Reports/FormReportOrders.cs +++ b/SushiBar/FormReportOrders.cs @@ -28,7 +28,9 @@ namespace SushiBarView.Reports { Dock = DockStyle.Fill }; - reportViewer.LocalReport.LoadReportDefinition(new FileStream("ReportOrders.rdlc", FileMode.Open)); + var path = Directory.GetParent(Directory.GetCurrentDirectory())?.Parent?.Parent?.ToString() + "\\ReportOrders.rdlc"; + reportViewer.LocalReport.LoadReportDefinition(new FileStream(path, FileMode.Open)); + //reportViewer.LocalReport.LoadReportDefinition(new FileStream("ReportOrders.rdlc", FileMode.Open)); Controls.Clear(); Controls.Add(reportViewer); Controls.Add(panel); @@ -52,11 +54,11 @@ namespace SushiBarView.Reports reportViewer.LocalReport.DataSources.Clear(); reportViewer.LocalReport.DataSources.Add(source); var parameters = new[] { new ReportParameter("ReportParameterPeriod", - $"c{dateTimePickerDateFrom.Value.ToShortDateString()} по {dateTimePickerDateTo.Value.ToShortDateString()}") + $"c {dateTimePickerDateFrom.Value.ToShortDateString()} по {dateTimePickerDateTo.Value.ToShortDateString()}") }; reportViewer.LocalReport.SetParameters(parameters); reportViewer.RefreshReport(); - _logger.LogInformation("Загрузка списка заказов на период {From} - {To} ", + _logger.LogInformation("Загрузка списка заказов на период {From}-{To}", dateTimePickerDateFrom.Value.ToShortDateString(), dateTimePickerDateTo.Value.ToShortDateString()); } catch (Exception ex) @@ -86,7 +88,7 @@ namespace SushiBarView.Reports DateFrom = dateTimePickerDateFrom.Value, DateTo = dateTimePickerDateTo.Value }); - _logger.LogInformation("Сохранение списка заказов на период { From} - { To} ", + _logger.LogInformation("Сохранение списка заказов на период {From}-{To} ", dateTimePickerDateFrom.Value.ToShortDateString(), dateTimePickerDateTo.Value.ToShortDateString()); MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK, MessageBoxIcon.Information); } diff --git a/SushiBar/Reports/FormReportOrders.resx b/SushiBar/FormReportOrders.resx similarity index 100% rename from SushiBar/Reports/FormReportOrders.resx rename to SushiBar/FormReportOrders.resx diff --git a/SushiBar/Reports/FormReportSushiComponent.Designer.cs b/SushiBar/FormReportSushiComponent.Designer.cs similarity index 97% rename from SushiBar/Reports/FormReportSushiComponent.Designer.cs rename to SushiBar/FormReportSushiComponent.Designer.cs index f851f4e..6cee7a8 100644 --- a/SushiBar/Reports/FormReportSushiComponent.Designer.cs +++ b/SushiBar/FormReportSushiComponent.Designer.cs @@ -77,6 +77,7 @@ buttonSaveToExcel.TabIndex = 1; buttonSaveToExcel.Text = "Сохранить в Excel"; buttonSaveToExcel.UseVisualStyleBackColor = false; + buttonSaveToExcel.Click += ButtonSaveToExcel_Click; // // FormReportSushiComponent // @@ -87,6 +88,7 @@ Controls.Add(dataGridView1); Name = "FormReportSushiComponent"; Text = "Компоненты по изделиям"; + Load += FormReportProductComponents_Load; ((System.ComponentModel.ISupportInitialize)dataGridView1).EndInit(); ResumeLayout(false); } diff --git a/SushiBar/Reports/FormReportSushiComponent.cs b/SushiBar/FormReportSushiComponent.cs similarity index 100% rename from SushiBar/Reports/FormReportSushiComponent.cs rename to SushiBar/FormReportSushiComponent.cs diff --git a/SushiBar/Reports/FormReportSushiComponent.resx b/SushiBar/FormReportSushiComponent.resx similarity index 100% rename from SushiBar/Reports/FormReportSushiComponent.resx rename to SushiBar/FormReportSushiComponent.resx diff --git a/SushiBar/Program.cs b/SushiBar/Program.cs index a560c62..08d44e4 100644 --- a/SushiBar/Program.cs +++ b/SushiBar/Program.cs @@ -3,6 +3,8 @@ using Microsoft.Extensions.Logging; using NLog.Extensions.Logging; using SushiBarBusinessLogic; using SushiBarBusinessLogic.BusinessLogic; +using SushiBarBusinessLogic.OfficePackage; +using SushiBarBusinessLogic.OfficePackage.Implements; using SushiBarContracts.BusinessLogicsContracts; using SushiBarContracts.StoragesContracts; using SushiBarDatabaseImplement.Implements; @@ -48,6 +50,10 @@ namespace SushiBar services.AddTransient(); services.AddTransient(); + services.AddTransient(); + services.AddTransient(); + services.AddTransient(); + services.AddTransient(); services.AddTransient(); services.AddTransient(); diff --git a/SushiBar/Reports/ReportOrders.rdlc b/SushiBar/ReportOrders.rdlc similarity index 100% rename from SushiBar/Reports/ReportOrders.rdlc rename to SushiBar/ReportOrders.rdlc diff --git a/SushiBarBusinessLogic/Reportlogic.cs b/SushiBarBusinessLogic/Reportlogic.cs index 502c940..55f9eca 100644 --- a/SushiBarBusinessLogic/Reportlogic.cs +++ b/SushiBarBusinessLogic/Reportlogic.cs @@ -5,11 +5,6 @@ using SushiBarContracts.BusinessLogicsContracts; using SushiBarContracts.SearchModel; using SushiBarContracts.StoragesContracts; using SushiBarContracts.ViewModels; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace SushiBarBusinessLogic { diff --git a/SushiBarDatabaseImplement/Implements/OrderStorage.cs b/SushiBarDatabaseImplement/Implements/OrderStorage.cs index dacf934..e9e648f 100644 --- a/SushiBarDatabaseImplement/Implements/OrderStorage.cs +++ b/SushiBarDatabaseImplement/Implements/OrderStorage.cs @@ -25,7 +25,7 @@ namespace SushiBarDatabaseImplement.Implements if (model.Id.HasValue) return context.Orders.Where(x => x.Id == model.Id).Select(x => AccessViewModel(x.GetViewModel)).ToList(); else - return context.Orders.Where(x => x.DateCreate >= model.DateFrom && x.DateCreate <= model.DateTo).Select(x => AccessViewModel(x.GetViewModel)).ToList(); + return context.Orders.Where(x => x.DateCreate >= model.DateFrom).Where(x => x.DateCreate <= model.DateTo).Select(x => AccessViewModel(x.GetViewModel)).ToList(); } public OrderViewModel? GetElement(OrderSearchModel model) {