From ba374506a4530632099ebcef45e89f8d0b91ef42 Mon Sep 17 00:00:00 2001 From: urlilpolly Date: Thu, 18 Apr 2024 18:39:10 +0400 Subject: [PATCH] =?UTF-8?q?=D0=B4=D0=BE=D0=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BusinessLogics/ReportLogic.cs | 50 ++++++++----------- 1 file changed, 22 insertions(+), 28 deletions(-) diff --git a/FishFactory/FishFactoryBusinessLogic/BusinessLogics/ReportLogic.cs b/FishFactory/FishFactoryBusinessLogic/BusinessLogics/ReportLogic.cs index 13110e8..3645960 100644 --- a/FishFactory/FishFactoryBusinessLogic/BusinessLogics/ReportLogic.cs +++ b/FishFactory/FishFactoryBusinessLogic/BusinessLogics/ReportLogic.cs @@ -33,34 +33,28 @@ namespace FishFactoryBusinessLogic.BusinessLogics _saveToWord = saveToWord; _saveToPdf = saveToPdf; } - public List GetCannedComponent() - { - var components = _componentStorage.GetFullList(); - var canneds = _cannedStorage.GetFullList(); - var list = new List(); - foreach (var canned in canneds) - { - var record = new ReportCannedComponentViewModel - { - CannedName = canned.CannedName, - Components = new List>(), - TotalCount = 0 - }; - foreach (var component in components) - { - if (canned.CannedComponents.ContainsKey(component.Id)) - { - record.Components.Add(new Tuple(component.ComponentName, canned.CannedComponents[component.Id].Item2)); - record.TotalCount += - canned.CannedComponents[component.Id].Item2; - } - } - list.Add(record); - } - return list; - } - public List GetOrders(ReportBindingModel model) + public List GetCannedComponent() + { + var canneds = _cannedStorage.GetFullList(); + var list = new List(); + foreach (var canned in canneds) + { + var record = new ReportCannedComponentViewModel + { + CannedName = canned.CannedName, + Components = new List>(), + TotalCount = 0 + }; + foreach (var component in canned.CannedComponents.Values) + { + record.Components.Add(new Tuple(component.Item1.ComponentName, component.Item2)); + record.TotalCount += component.Item2; + } + list.Add(record); + } + return list; + } + public List GetOrders(ReportBindingModel model) { return _orderStorage.GetFilteredList(new OrderSearchModel { DateFrom = model.DateFrom, DateTo = model.DateTo }) .Select(x => new ReportOrdersViewModel