From 839353894d1733b0eeada51244fd68040ed4e3a3 Mon Sep 17 00:00:00 2001 From: urlilpolly Date: Thu, 4 Apr 2024 19:51:39 +0400 Subject: [PATCH 1/2] laba4 update --- .../AbstractSaveToWord.cs | 46 ------------------- 1 file changed, 46 deletions(-) delete mode 100644 FishFactory/FishFactoryContracts/AbstractSaveToWord.cs diff --git a/FishFactory/FishFactoryContracts/AbstractSaveToWord.cs b/FishFactory/FishFactoryContracts/AbstractSaveToWord.cs deleted file mode 100644 index 9578379..0000000 --- a/FishFactory/FishFactoryContracts/AbstractSaveToWord.cs +++ /dev/null @@ -1,46 +0,0 @@ -using DocumentFormat.OpenXml.Drawing.Charts; -using FishFactoryBusinessLogic.OfficePackage.HelperEnums; -using FishFactoryBusinessLogic.OfficePackage.HelperModels; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace FishFactoryBusinessLogic.OfficePackage -{ - public abstract class AbstractSaveToWord - { - public void CreateDoc(WordInfo info) - { - CreateWord(info); - CreateParagraph(new WordParagraph - { - Texts = new List<(string, WordTextProperties)> { (info.Title, new WordTextProperties { Bold = true, Size = "24", }) }, TextProperties = new WordTextProperties - { - Size = "24", - JustificationType = WordJustificationType.Center - } - }); - foreach (var canned in info.Canneds) - { - CreateParagraph(new WordParagraph - { - Texts = new List<(string, WordTextProperties)> { - ($"{canned.CannedName} - ", new WordTextProperties { Size = "24", Bold = true}) , - (canned.Price.ToString(), new WordTextProperties { Size = "24", }) - }, - TextProperties = new WordTextProperties - { - Size = "24", - JustificationType = WordJustificationType.Both - } - }); - } - SaveWord(info); - } - protected abstract void CreateWord(WordInfo info); - protected abstract void CreateParagraph(WordParagraph paragraph); - protected abstract void SaveWord(WordInfo info); - } -} From ba374506a4530632099ebcef45e89f8d0b91ef42 Mon Sep 17 00:00:00 2001 From: urlilpolly Date: Thu, 18 Apr 2024 18:39:10 +0400 Subject: [PATCH 2/2] =?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