From bb4806b4d1866bb6f1c817273decac2a7096a77f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=BA=20=D0=98=D0=B3=D0=BE=D1=80=D1=8C?= Date: Mon, 24 Apr 2023 00:06:03 +0400 Subject: [PATCH 1/2] =?UTF-8?q?=D0=BD=D0=B5=D0=B1=D0=BE=D0=BB=D1=8C=D1=88?= =?UTF-8?q?=D0=B8=D0=B5=20=D0=B8=D0=B7=D0=BC=D0=B5=D0=BD=D0=B5=D0=BD=D0=B8?= =?UTF-8?q?=D1=8F=20=D0=B2=20=D0=BB=D0=BE=D0=B3=D0=B8=D0=BA=D0=B5=20=D0=BE?= =?UTF-8?q?=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 --- .../BusinessLogics/ReportLogic.cs | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/BlacksmithWorkshop/BlacksmithWorkshopBusinessLogic/BusinessLogics/ReportLogic.cs b/BlacksmithWorkshop/BlacksmithWorkshopBusinessLogic/BusinessLogics/ReportLogic.cs index 2001944..3f4fe62 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshopBusinessLogic/BusinessLogics/ReportLogic.cs +++ b/BlacksmithWorkshop/BlacksmithWorkshopBusinessLogic/BusinessLogics/ReportLogic.cs @@ -35,7 +35,7 @@ namespace BlacksmithWorkShopBusinessLogic.BusinessLogics /// public List GetManufactureComponent() { - var components = _componentStorage.GetFullList(); + //var components = _componentStorage.GetFullList(); var manufactures = _manufactureStorage.GetFullList(); var list = new List(); foreach (var manufacture in manufactures) @@ -47,14 +47,15 @@ namespace BlacksmithWorkShopBusinessLogic.BusinessLogics TotalCount = 0, TotalSum = 0 }; - foreach (var component in components) + foreach (var component in manufacture.ManufactureComponents) { - if (manufacture.ManufactureComponents.ContainsKey(component.Id)) - { - record.Components.Add((component.ComponentName, manufacture.ManufactureComponents[component.Id].Item2, component.Cost * manufacture.ManufactureComponents[component.Id].Item2)); - record.TotalCount += manufacture.ManufactureComponents[component.Id].Item2; - record.TotalSum += component.Cost * manufacture.ManufactureComponents[component.Id].Item2; - } + //record.Components.Add((component.ComponentName, manufacture.ManufactureComponents[component.Id].Item2, component.Cost * manufacture.ManufactureComponents[component.Id].Item2)); + //record.TotalCount += manufacture.ManufactureComponents[component.Id].Item2; + //record.TotalSum += component.Cost * manufacture.ManufactureComponents[component.Id].Item2; + double componentCost = _componentStorage.GetElement(new() { Id = component.Key })?.Cost ?? 0; + record.Components.Add(new(component.Value.Item1.ComponentName, component.Value.Item2, componentCost)); + record.TotalCount += component.Value.Item2; + record.TotalSum += component.Value.Item2 * componentCost; } list.Add(record); } -- 2.25.1 From 124865cd5455fce06a63257834b58aa6961b96f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=BA=20=D0=98=D0=B3=D0=BE=D1=80=D1=8C?= Date: Mon, 24 Apr 2023 00:06:22 +0400 Subject: [PATCH 2/2] =?UTF-8?q?=D0=BE=D1=82=D1=87=D0=B5=D1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BusinessLogics/ReportLogic.cs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/BlacksmithWorkshop/BlacksmithWorkshopBusinessLogic/BusinessLogics/ReportLogic.cs b/BlacksmithWorkshop/BlacksmithWorkshopBusinessLogic/BusinessLogics/ReportLogic.cs index 3f4fe62..65ad99d 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshopBusinessLogic/BusinessLogics/ReportLogic.cs +++ b/BlacksmithWorkshop/BlacksmithWorkshopBusinessLogic/BusinessLogics/ReportLogic.cs @@ -35,7 +35,6 @@ namespace BlacksmithWorkShopBusinessLogic.BusinessLogics /// public List GetManufactureComponent() { - //var components = _componentStorage.GetFullList(); var manufactures = _manufactureStorage.GetFullList(); var list = new List(); foreach (var manufacture in manufactures) @@ -49,9 +48,6 @@ namespace BlacksmithWorkShopBusinessLogic.BusinessLogics }; foreach (var component in manufacture.ManufactureComponents) { - //record.Components.Add((component.ComponentName, manufacture.ManufactureComponents[component.Id].Item2, component.Cost * manufacture.ManufactureComponents[component.Id].Item2)); - //record.TotalCount += manufacture.ManufactureComponents[component.Id].Item2; - //record.TotalSum += component.Cost * manufacture.ManufactureComponents[component.Id].Item2; double componentCost = _componentStorage.GetElement(new() { Id = component.Key })?.Cost ?? 0; record.Components.Add(new(component.Value.Item1.ComponentName, component.Value.Item2, componentCost)); record.TotalCount += component.Value.Item2; -- 2.25.1