From 40b82024d22fa006296b9afd338f60513dbc1548 Mon Sep 17 00:00:00 2001 From: Kirill <117719052+KirillFirsof@users.noreply.github.com> Date: Wed, 27 Mar 2024 15:36:23 +0400 Subject: [PATCH] =?UTF-8?q?=D1=81=D0=B4=D0=B0=D0=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Implements/ComponentStorage.cs | 33 ++++++++----------- .../Models/Component.cs | 15 ++++++--- .../ClothShopView/FormComponents.Designer.cs | 4 +-- .../ClothShopView/FormCreateOrder.Designer.cs | 2 +- ClothShop/ClothShopView/FormMain.Designer.cs | 2 +- .../ClothShopView/FormTextile.Designer.cs | 2 +- .../FormTextileComponent.Designer.cs | 2 +- .../ClothShopView/FormTextiles.Designer.cs | 2 +- 8 files changed, 30 insertions(+), 32 deletions(-) diff --git a/ClothShop/ClothShopFileImplement/Implements/ComponentStorage.cs b/ClothShop/ClothShopFileImplement/Implements/ComponentStorage.cs index d9a454d..eb50819 100644 --- a/ClothShop/ClothShopFileImplement/Implements/ComponentStorage.cs +++ b/ClothShop/ClothShopFileImplement/Implements/ComponentStorage.cs @@ -3,6 +3,12 @@ using ClothShopContracts.SearchModels; using ClothShopContracts.StoragesContracts; using ClothShopContracts.ViewModels; using ClothShopFileImplement.Models; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + namespace ClothShopFileImplement.Implements { public class ComponentStorage : IComponentStorage @@ -14,21 +20,15 @@ namespace ClothShopFileImplement.Implements } public List GetFullList() { - return source.Components - .Select(x => x.GetViewModel) - .ToList(); + return source.Components.Select(x => x.GetViewModel).ToList(); } - public List GetFilteredList(ComponentSearchModel - model) + public List GetFilteredList(ComponentSearchModel model) { if (string.IsNullOrEmpty(model.ComponentName)) { return new(); } - return source.Components - .Where(x => x.ComponentName.Contains(model.ComponentName)) - .Select(x => x.GetViewModel) - .ToList(); + return source.Components.Where(x => x.ComponentName.Contains(model.ComponentName)).Select(x => x.GetViewModel).ToList(); } public ComponentViewModel? GetElement(ComponentSearchModel model) { @@ -36,12 +36,8 @@ namespace ClothShopFileImplement.Implements { return null; } - return source.Components - .FirstOrDefault(x => - (!string.IsNullOrEmpty(model.ComponentName) && x.ComponentName == - model.ComponentName) || - (model.Id.HasValue && x.Id == model.Id)) - ?.GetViewModel; + return source.Components.FirstOrDefault(x => (!string.IsNullOrEmpty(model.ComponentName) && x.ComponentName == model.ComponentName) || + (model.Id.HasValue && x.Id == model.Id))?.GetViewModel; } public ComponentViewModel? Insert(ComponentBindingModel model) { @@ -58,8 +54,7 @@ namespace ClothShopFileImplement.Implements } public ComponentViewModel? Update(ComponentBindingModel model) { - var component = source.Components.FirstOrDefault(x => x.Id == - model.Id); + var component = source.Components.FirstOrDefault(x => x.Id == model.Id); if (component == null) { return null; @@ -70,8 +65,7 @@ namespace ClothShopFileImplement.Implements } public ComponentViewModel? Delete(ComponentBindingModel model) { - var element = source.Components.FirstOrDefault(x => x.Id == - model.Id); + var element = source.Components.FirstOrDefault(x => x.Id == model.Id); if (element != null) { source.Components.Remove(element); @@ -82,4 +76,3 @@ namespace ClothShopFileImplement.Implements } } } - diff --git a/ClothShop/ClothShopFileImplement/Models/Component.cs b/ClothShop/ClothShopFileImplement/Models/Component.cs index a5acb25..d6cc994 100644 --- a/ClothShop/ClothShopFileImplement/Models/Component.cs +++ b/ClothShop/ClothShopFileImplement/Models/Component.cs @@ -1,7 +1,13 @@ using ClothShopContracts.BindingModels; using ClothShopContracts.ViewModels; using ClothShopDataModels.Models; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; using System.Xml.Linq; + namespace ClothShopFileImplement.Models { public class Component : IComponentModel @@ -51,9 +57,8 @@ namespace ClothShopFileImplement.Models Cost = Cost }; public XElement GetXElement => new("Component", - new XAttribute("Id", Id), - new XElement("ComponentName", ComponentName), - new XElement("Cost", Cost.ToString())); + new XAttribute("Id", Id), + new XElement("ComponentName", ComponentName), + new XElement("Cost", Cost.ToString())); } -} - +} \ No newline at end of file diff --git a/ClothShop/ClothShopView/FormComponents.Designer.cs b/ClothShop/ClothShopView/FormComponents.Designer.cs index 209efcb..1b80bc7 100644 --- a/ClothShop/ClothShopView/FormComponents.Designer.cs +++ b/ClothShop/ClothShopView/FormComponents.Designer.cs @@ -98,8 +98,8 @@ this.Controls.Add(this.buttonAdd); this.Controls.Add(this.dataGridView); this.Name = "FormComponents"; - this.Text = "FormComponents"; - this.Click += new System.EventHandler(this.FormComponents_Load); + this.Text = "Компоненты"; + this.Load += new System.EventHandler(this.FormComponents_Load); ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit(); this.ResumeLayout(false); diff --git a/ClothShop/ClothShopView/FormCreateOrder.Designer.cs b/ClothShop/ClothShopView/FormCreateOrder.Designer.cs index 4599961..b4f68aa 100644 --- a/ClothShop/ClothShopView/FormCreateOrder.Designer.cs +++ b/ClothShop/ClothShopView/FormCreateOrder.Designer.cs @@ -126,7 +126,7 @@ this.Controls.Add(this.labelTextile); this.Controls.Add(this.comboBoxTextile); this.Name = "FormCreateOrder"; - this.Text = "FormCreateOrder"; + this.Text = "Создать заказ"; this.Load += new System.EventHandler(this.FormCreateOrder_Load); this.ResumeLayout(false); this.PerformLayout(); diff --git a/ClothShop/ClothShopView/FormMain.Designer.cs b/ClothShop/ClothShopView/FormMain.Designer.cs index 870c130..74ba808 100644 --- a/ClothShop/ClothShopView/FormMain.Designer.cs +++ b/ClothShop/ClothShopView/FormMain.Designer.cs @@ -152,7 +152,7 @@ this.Controls.Add(this.buttonTakeOrderInWork); this.Controls.Add(this.buttonCreateOrder); this.Name = "FormMain"; - this.Text = "FormMain"; + this.Text = "Заказы"; this.Load += new System.EventHandler(this.FormMain_Load); ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit(); this.menuStrip.ResumeLayout(false); diff --git a/ClothShop/ClothShopView/FormTextile.Designer.cs b/ClothShop/ClothShopView/FormTextile.Designer.cs index cabf2bb..6d08be5 100644 --- a/ClothShop/ClothShopView/FormTextile.Designer.cs +++ b/ClothShop/ClothShopView/FormTextile.Designer.cs @@ -204,7 +204,7 @@ this.Controls.Add(this.buttonCancel); this.Controls.Add(this.buttonSave); this.Name = "FormTextile"; - this.Text = "FormTextile"; + this.Text = "Изделия"; this.Load += new System.EventHandler(this.FormTextile_Load); this.groupBoxComponents.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.dataGridViewComponents)).EndInit(); diff --git a/ClothShop/ClothShopView/FormTextileComponent.Designer.cs b/ClothShop/ClothShopView/FormTextileComponent.Designer.cs index 7574789..0b1fb2b 100644 --- a/ClothShop/ClothShopView/FormTextileComponent.Designer.cs +++ b/ClothShop/ClothShopView/FormTextileComponent.Designer.cs @@ -102,7 +102,7 @@ this.Controls.Add(this.labelCount); this.Controls.Add(this.labelComponent); this.Name = "FormTextileComponent"; - this.Text = "FormTextileComponent"; + this.Text = "Компонет изделия"; this.ResumeLayout(false); this.PerformLayout(); diff --git a/ClothShop/ClothShopView/FormTextiles.Designer.cs b/ClothShop/ClothShopView/FormTextiles.Designer.cs index b7ad7a2..cc858ff 100644 --- a/ClothShop/ClothShopView/FormTextiles.Designer.cs +++ b/ClothShop/ClothShopView/FormTextiles.Designer.cs @@ -98,7 +98,7 @@ this.Controls.Add(this.buttonAdd); this.Controls.Add(this.dataGridView); this.Name = "FormTextiles"; - this.Text = "FormTextiles"; + this.Text = "Изделия"; this.Load += new System.EventHandler(this.FormTextiles_Load); ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit(); this.ResumeLayout(false);