From 9fc929886e43c70974fdf48265ead04c923a2cac Mon Sep 17 00:00:00 2001 From: Artyom_Yashin Date: Wed, 27 Mar 2024 11:37:57 +0400 Subject: [PATCH] =?UTF-8?q?=D0=A1=D0=B4=D0=B5=D0=BB=D0=B0=D0=BB=D1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ComputersShop/ComputersShop/FormMain.Designer.cs | 2 +- .../FormReportComputerComponents.Designer.cs | 4 ++-- .../BusinessLogics/ReportLogic.cs | 4 ++-- .../OfficePackage/AbstractSaveToWord.cs | 8 +++++--- .../OfficePackage/HelperModels/WordInfo.cs | 2 +- .../ComputersShopFileImplement/Implements/OrderStorage.cs | 4 ---- .../ComputersShopListImplement/Implements/OrderStorage.cs | 8 +++----- 7 files changed, 14 insertions(+), 18 deletions(-) diff --git a/ComputersShop/ComputersShop/FormMain.Designer.cs b/ComputersShop/ComputersShop/FormMain.Designer.cs index 4c9d187..0c73552 100644 --- a/ComputersShop/ComputersShop/FormMain.Designer.cs +++ b/ComputersShop/ComputersShop/FormMain.Designer.cs @@ -88,7 +88,7 @@ // списокКомпонентовToolStripMenuItem.Name = "списокКомпонентовToolStripMenuItem"; списокКомпонентовToolStripMenuItem.Size = new Size(306, 26); - списокКомпонентовToolStripMenuItem.Text = "Список компонентов"; + списокКомпонентовToolStripMenuItem.Text = "Список компьютеров"; списокКомпонентовToolStripMenuItem.Click += списокКомпонентовToolStripMenuItem_Click; // // компонентыПоКомпьютерамToolStripMenuItem diff --git a/ComputersShop/ComputersShop/FormReportComputerComponents.Designer.cs b/ComputersShop/ComputersShop/FormReportComputerComponents.Designer.cs index 46134a4..c8d9ef4 100644 --- a/ComputersShop/ComputersShop/FormReportComputerComponents.Designer.cs +++ b/ComputersShop/ComputersShop/FormReportComputerComponents.Designer.cs @@ -62,13 +62,13 @@ // ComponentColumn // ComponentColumn.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; - ComponentColumn.HeaderText = "Компонент"; + ComponentColumn.HeaderText = "Компьютер"; ComponentColumn.MinimumWidth = 6; ComponentColumn.Name = "ComponentColumn"; // // ComputerColumn // - ComputerColumn.HeaderText = "Компьютер"; + ComputerColumn.HeaderText = "Компонент"; ComputerColumn.MinimumWidth = 6; ComputerColumn.Name = "ComputerColumn"; ComputerColumn.Width = 200; diff --git a/ComputersShop/ComputersShopBusinessLogic/BusinessLogics/ReportLogic.cs b/ComputersShop/ComputersShopBusinessLogic/BusinessLogics/ReportLogic.cs index 18182d4..16207be 100644 --- a/ComputersShop/ComputersShopBusinessLogic/BusinessLogics/ReportLogic.cs +++ b/ComputersShop/ComputersShopBusinessLogic/BusinessLogics/ReportLogic.cs @@ -94,8 +94,8 @@ namespace ComputersShopBusinessLogic.BusinessLogics { FileName = model.FileName, Title = "Список компонент", - Components = _componentStorage.GetFullList() - }); + Computers = _ComputerStorage.GetFullList() + }) ; } /// /// Сохранение компонент с указаеним продуктов в файл-Excel diff --git a/ComputersShop/ComputersShopBusinessLogic/OfficePackage/AbstractSaveToWord.cs b/ComputersShop/ComputersShopBusinessLogic/OfficePackage/AbstractSaveToWord.cs index 489b9a9..9d4ea2c 100644 --- a/ComputersShop/ComputersShopBusinessLogic/OfficePackage/AbstractSaveToWord.cs +++ b/ComputersShop/ComputersShopBusinessLogic/OfficePackage/AbstractSaveToWord.cs @@ -22,15 +22,17 @@ namespace ComputersShopBusinessLogic.OfficePackage JustificationType = WordJustificationType.Center } }); - foreach (var component in info.Components) + foreach (var computer in info.Computers) { CreateParagraph(new WordParagraph { - Texts = new List<(string, WordTextProperties)> { (component.ComponentName, new WordTextProperties { Size = "24", }) }, + Texts = new List<(string, WordTextProperties)> { (computer.ComputerName, new WordTextProperties { Size = "24", Bold = true}), + (" - цена " + computer.Price.ToString(), new WordTextProperties { Size = "24"}) + }, TextProperties = new WordTextProperties { Size = "24", - JustificationType = WordJustificationType.Both + JustificationType = WordJustificationType.Both, } }); } diff --git a/ComputersShop/ComputersShopBusinessLogic/OfficePackage/HelperModels/WordInfo.cs b/ComputersShop/ComputersShopBusinessLogic/OfficePackage/HelperModels/WordInfo.cs index 3ca8eec..b284a96 100644 --- a/ComputersShop/ComputersShopBusinessLogic/OfficePackage/HelperModels/WordInfo.cs +++ b/ComputersShop/ComputersShopBusinessLogic/OfficePackage/HelperModels/WordInfo.cs @@ -11,6 +11,6 @@ namespace ComputersShopBusinessLogic.OfficePackage.HelperModels { public string FileName { get; set; } = string.Empty; public string Title { get; set; } = string.Empty; - public List Components { get; set; } = new(); + public List Computers { get; set; } = new(); } } diff --git a/ComputersShop/ComputersShopFileImplement/Implements/OrderStorage.cs b/ComputersShop/ComputersShopFileImplement/Implements/OrderStorage.cs index f5f2d8b..a8c2b87 100644 --- a/ComputersShop/ComputersShopFileImplement/Implements/OrderStorage.cs +++ b/ComputersShop/ComputersShopFileImplement/Implements/OrderStorage.cs @@ -28,10 +28,6 @@ namespace ComputersShopFileImplement.Implements public List GetFilteredList(OrderSearchModel model) { - if (!model.Id.HasValue) - { - return new(); - } return source.Orders .Where(x => ( (!model.Id.HasValue || x.Id == model.Id) && diff --git a/ComputersShop/ComputersShopListImplement/Implements/OrderStorage.cs b/ComputersShop/ComputersShopListImplement/Implements/OrderStorage.cs index 212c8d5..6da8bc6 100644 --- a/ComputersShop/ComputersShopListImplement/Implements/OrderStorage.cs +++ b/ComputersShop/ComputersShopListImplement/Implements/OrderStorage.cs @@ -25,13 +25,11 @@ namespace ComputersShopListImplement.Implements public List GetFilteredList(OrderSearchModel model) { var result = new List(); - if (!model.Id.HasValue) - { - return result; - } foreach (var order in _source.Orders) { - if (order.Id == model.Id && model.DateFrom <= order.DateCreate && model.DateTo >= order.DateCreate) + if ((!model.Id.HasValue || order.Id == model.Id) && + (!model.DateFrom.HasValue || order.DateCreate >= model.DateFrom) && + (!model.DateTo.HasValue || order.DateCreate <= model.DateTo)) { result.Add(AccessComputerStorage(order.GetViewModel)); }