From 7060c3da24717412fbbc1800fc40f47f6b6148c0 Mon Sep 17 00:00:00 2001 From: Programmist73 Date: Tue, 11 Apr 2023 00:33:59 +0400 Subject: [PATCH] =?UTF-8?q?=D0=9D=D0=B0=D1=81=D1=82=D1=80=D0=BE=D0=B9?= =?UTF-8?q?=D0=BA=D0=B0=20=D0=B7=D0=B0=D0=B2=D0=B8=D1=81=D0=B8=D0=BC=D0=BE?= =?UTF-8?q?=D1=81=D1=82=D0=B5=D0=B9=20=D0=B8=20=D0=BF=D1=83=D1=82=D0=B5?= =?UTF-8?q?=D0=B9.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BlacksmithWorkshop.csproj | 4 ++-- .../FormReportGroupedOrders.cs | 2 +- .../BlacksmithWorkshop/FormReportOrders.cs | 2 +- .../Implements/OrderStorage.cs | 19 ++++++++++++++----- 4 files changed, 18 insertions(+), 9 deletions(-) diff --git a/BlacksmithWorkshop/BlacksmithWorkshop/BlacksmithWorkshop.csproj b/BlacksmithWorkshop/BlacksmithWorkshop/BlacksmithWorkshop.csproj index 59dd525..edd6fe3 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshop/BlacksmithWorkshop.csproj +++ b/BlacksmithWorkshop/BlacksmithWorkshop/BlacksmithWorkshop.csproj @@ -14,9 +14,9 @@ runtime; build; native; contentfiles; analyzers; buildtransitive - - + + diff --git a/BlacksmithWorkshop/BlacksmithWorkshop/FormReportGroupedOrders.cs b/BlacksmithWorkshop/BlacksmithWorkshop/FormReportGroupedOrders.cs index 49979ec..ed9f46b 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshop/FormReportGroupedOrders.cs +++ b/BlacksmithWorkshop/BlacksmithWorkshop/FormReportGroupedOrders.cs @@ -34,7 +34,7 @@ namespace BlacksmithWorkshop Dock = DockStyle.Fill }; - reportViewer.LocalReport.LoadReportDefinition(new FileStream("..\\..\\..\\ReportGroupedOrders.rdlc", FileMode.Open)); + reportViewer.LocalReport.LoadReportDefinition(new FileStream("C:\\Users\\Programmist73\\Desktop\\Практика\\2-й курс\\4-й семестр\\PIbd-21_Eliseev_E.E._BlacksmithWorkshop\\BlacksmithWorkshop\\BlacksmithWorkshop\\ReportGroupedOrders.rdlc", FileMode.Open)); Controls.Clear(); Controls.Add(reportViewer); Controls.Add(panel); diff --git a/BlacksmithWorkshop/BlacksmithWorkshop/FormReportOrders.cs b/BlacksmithWorkshop/BlacksmithWorkshop/FormReportOrders.cs index 29a74b8..3760334 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshop/FormReportOrders.cs +++ b/BlacksmithWorkshop/BlacksmithWorkshop/FormReportOrders.cs @@ -34,7 +34,7 @@ namespace BlacksmithWorkshop Dock = DockStyle.Fill }; - reportViewer.LocalReport.LoadReportDefinition(new FileStream("..\\..\\..\\ReportOrders.rdlc", FileMode.Open)); + reportViewer.LocalReport.LoadReportDefinition(new FileStream("C:\\Users\\Programmist73\\Desktop\\Практика\\2-й курс\\4-й семестр\\PIbd-21_Eliseev_E.E._BlacksmithWorkshop\\BlacksmithWorkshop\\BlacksmithWorkshop\\ReportOrders.rdlc", FileMode.Open)); Controls.Clear(); Controls.Add(reportViewer); diff --git a/BlacksmithWorkshop/BlacksmithWorkshopDatabaseImplement/Implements/OrderStorage.cs b/BlacksmithWorkshop/BlacksmithWorkshopDatabaseImplement/Implements/OrderStorage.cs index 290843b..a748729 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshopDatabaseImplement/Implements/OrderStorage.cs +++ b/BlacksmithWorkshop/BlacksmithWorkshopDatabaseImplement/Implements/OrderStorage.cs @@ -49,14 +49,23 @@ namespace BlacksmithWorkshopDatabaseImplement.Implements public List GetFilteredList(OrderSearchModel model) { - if (!model.Id.HasValue) + if (!model.Id.HasValue && !model.DateFrom.HasValue && !model.DateTo.HasValue) { - return new(); - } + return new(); + } - using var context = new BlacksmithWorkshopDatabase(); + using var context = new BlacksmithWorkshopDatabase(); - return context.Orders + if (!model.Id.HasValue && model.DateFrom.HasValue && model.DateTo.HasValue) + { + return context.Orders + .Include(x => x.Manufacture) + .Where(x => x.DateCreate >= model.DateFrom && x.DateCreate <= model.DateTo) + .Select(x => x.GetViewModel) + .ToList(); + } + + return context.Orders .Include(x => x.Manufacture) .Where(x => x.Id == model.Id) .Select(x => x.GetViewModel)