From 3a28b055171e06867cf3b3c4f28670542a154d87 Mon Sep 17 00:00:00 2001 From: Katerina881 Date: Fri, 21 Apr 2023 11:02:16 +0400 Subject: [PATCH] lab4 passed --- .../Implements/OrderStorage.cs | 8 +++----- .../SoftwareInstallation/FormPackage.Designer.cs | 1 - .../FormReportOrders.Designer.cs | 15 ++++++++------- .../SoftwareInstallation/FormReportOrders.cs | 5 +++-- .../SoftwareInstallation/ReportOrders.rdlc | 2 +- 5 files changed, 15 insertions(+), 16 deletions(-) diff --git a/SoftwareInstallation/AbstractSoftwareInstallationDatabaseImplement/Implements/OrderStorage.cs b/SoftwareInstallation/AbstractSoftwareInstallationDatabaseImplement/Implements/OrderStorage.cs index 97c0da9..620ffce 100644 --- a/SoftwareInstallation/AbstractSoftwareInstallationDatabaseImplement/Implements/OrderStorage.cs +++ b/SoftwareInstallation/AbstractSoftwareInstallationDatabaseImplement/Implements/OrderStorage.cs @@ -39,16 +39,14 @@ namespace AbstractSoftwareInstallationDatabaseImplement.Implements public List GetFilteredList(OrderSearchModel model) { - if (!model.Id.HasValue) - { - return new(); - } using var context = new AbstractSoftwareInstallationDatabase(); + return context.Orders - .Where(x => x.Id == model.Id) + .Where(x => x.DateCreate >= model.DateFrom && x.DateCreate <= model.DateTo) .Include(x => x.Package) .Select(x => x.GetViewModel) .ToList(); + } public List GetFullList() diff --git a/SoftwareInstallation/SoftwareInstallation/FormPackage.Designer.cs b/SoftwareInstallation/SoftwareInstallation/FormPackage.Designer.cs index 5009268..db57d10 100644 --- a/SoftwareInstallation/SoftwareInstallation/FormPackage.Designer.cs +++ b/SoftwareInstallation/SoftwareInstallation/FormPackage.Designer.cs @@ -202,7 +202,6 @@ this.ResumeLayout(false); this.PerformLayout(); this.Load += new System.EventHandler(this.FormPackage_Load); - } #endregion diff --git a/SoftwareInstallation/SoftwareInstallation/FormReportOrders.Designer.cs b/SoftwareInstallation/SoftwareInstallation/FormReportOrders.Designer.cs index 418e2a0..86a73f6 100644 --- a/SoftwareInstallation/SoftwareInstallation/FormReportOrders.Designer.cs +++ b/SoftwareInstallation/SoftwareInstallation/FormReportOrders.Designer.cs @@ -46,15 +46,16 @@ this.panel.Controls.Add(this.buttonCreateReport); this.panel.Controls.Add(this.dateTimePicker2); this.panel.Controls.Add(this.dateTimePicker1); + this.panel.Dock = System.Windows.Forms.DockStyle.Top; this.panel.Location = new System.Drawing.Point(0, 0); this.panel.Name = "panel"; - this.panel.Size = new System.Drawing.Size(801, 46); + this.panel.Size = new System.Drawing.Size(800, 46); this.panel.TabIndex = 0; // // label2 // this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(178, 16); + this.label2.Location = new System.Drawing.Point(206, 16); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(23, 15); this.label2.TabIndex = 5; @@ -71,7 +72,7 @@ // // buttonCreateToPdf // - this.buttonCreateToPdf.Location = new System.Drawing.Point(667, 12); + this.buttonCreateToPdf.Location = new System.Drawing.Point(668, 14); this.buttonCreateToPdf.Name = "buttonCreateToPdf"; this.buttonCreateToPdf.Size = new System.Drawing.Size(110, 23); this.buttonCreateToPdf.TabIndex = 3; @@ -81,7 +82,7 @@ // // buttonCreateReport // - this.buttonCreateReport.Location = new System.Drawing.Point(441, 12); + this.buttonCreateReport.Location = new System.Drawing.Point(531, 14); this.buttonCreateReport.Name = "buttonCreateReport"; this.buttonCreateReport.Size = new System.Drawing.Size(100, 23); this.buttonCreateReport.TabIndex = 2; @@ -93,14 +94,14 @@ // this.dateTimePicker2.Location = new System.Drawing.Point(256, 12); this.dateTimePicker2.Name = "dateTimePicker2"; - this.dateTimePicker2.Size = new System.Drawing.Size(92, 23); + this.dateTimePicker2.Size = new System.Drawing.Size(141, 23); this.dateTimePicker2.TabIndex = 1; // // dateTimePicker1 // - this.dateTimePicker1.Location = new System.Drawing.Point(77, 12); + this.dateTimePicker1.Location = new System.Drawing.Point(48, 12); this.dateTimePicker1.Name = "dateTimePicker1"; - this.dateTimePicker1.Size = new System.Drawing.Size(43, 23); + this.dateTimePicker1.Size = new System.Drawing.Size(143, 23); this.dateTimePicker1.TabIndex = 0; // // FormReportOrders diff --git a/SoftwareInstallation/SoftwareInstallation/FormReportOrders.cs b/SoftwareInstallation/SoftwareInstallation/FormReportOrders.cs index 324f2d9..4320427 100644 --- a/SoftwareInstallation/SoftwareInstallation/FormReportOrders.cs +++ b/SoftwareInstallation/SoftwareInstallation/FormReportOrders.cs @@ -28,7 +28,7 @@ namespace SoftwareInstallationView { Dock = DockStyle.Fill }; - reportViewer.LocalReport.LoadReportDefinition(new FileStream("C:/Users/Дьявол Смерти/source/repos/PIbd-23_Dolgov_D.A._SoftwareInstallation/SoftwareInstallation/SoftwareInstallation/ReportOrders.rdlc", FileMode.Open)); + reportViewer.LocalReport.LoadReportDefinition(new FileStream("C:/Users/user/source/repos/PIbd-23_Dolgov_D.A._SoftwareInstallation/SoftwareInstallation/SoftwareInstallation/ReportOrders.rdlc", FileMode.Open)); Controls.Clear(); Controls.Add(reportViewer); Controls.Add(panel); @@ -52,8 +52,9 @@ namespace SoftwareInstallationView var source = new ReportDataSource("DataSetOrders", dataSource); reportViewer.LocalReport.DataSources.Clear(); reportViewer.LocalReport.DataSources.Add(source); - var parameters = new[] { new ReportParameter("ReportParameterPeriod", $"c{ dateTimePicker1.Value.ToShortDateString()} по {dateTimePicker2.Value.ToShortDateString()}") }; + var parameters = new[] { new ReportParameter("ReportParameterPeriod", $"c { dateTimePicker1.Value.ToShortDateString()} по {dateTimePicker2.Value.ToShortDateString()}") }; reportViewer.LocalReport.SetParameters(parameters); + reportViewer.RefreshReport(); _logger.LogInformation("Загрузка списка заказов на период {From}-{ To}", dateTimePicker1.Value.ToShortDateString(), dateTimePicker2.Value.ToShortDateString()); } diff --git a/SoftwareInstallation/SoftwareInstallation/ReportOrders.rdlc b/SoftwareInstallation/SoftwareInstallation/ReportOrders.rdlc index 0dccc81..77add63 100644 --- a/SoftwareInstallation/SoftwareInstallation/ReportOrders.rdlc +++ b/SoftwareInstallation/SoftwareInstallation/ReportOrders.rdlc @@ -212,7 +212,7 @@ - Документ + Пакет