From 2b5739b429fe097f2860f2413a18409c3f251b11 Mon Sep 17 00:00:00 2001 From: the Date: Tue, 4 Apr 2023 13:59:40 +0400 Subject: [PATCH] Word Done --- ComputerShopBusinessLogic/BusinessLogics/ReportLogic.cs | 4 ++-- .../OfficePackage/AbstractSaveToWord.cs | 8 ++++++-- .../OfficePackage/HelperModels/WordInfo.cs | 2 +- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/ComputerShopBusinessLogic/BusinessLogics/ReportLogic.cs b/ComputerShopBusinessLogic/BusinessLogics/ReportLogic.cs index 42afe9e..13d6341 100644 --- a/ComputerShopBusinessLogic/BusinessLogics/ReportLogic.cs +++ b/ComputerShopBusinessLogic/BusinessLogics/ReportLogic.cs @@ -96,8 +96,8 @@ namespace ComputerShopBusinessLogic.BusinessLogics _saveToWord.CreateDoc(new WordInfo { FileName = model.FileName, - Title = "Список компонент", - Components = _componentStorage.GetFullList() + Title = "Список компьютеров", + Computers = _productStorage.GetFullList() }); } /// diff --git a/ComputerShopBusinessLogic/OfficePackage/AbstractSaveToWord.cs b/ComputerShopBusinessLogic/OfficePackage/AbstractSaveToWord.cs index ad42a2a..5f0a7bc 100644 --- a/ComputerShopBusinessLogic/OfficePackage/AbstractSaveToWord.cs +++ b/ComputerShopBusinessLogic/OfficePackage/AbstractSaveToWord.cs @@ -22,17 +22,21 @@ namespace ComputerShopBusinessLogic.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 } }); + } SaveWord(info); } diff --git a/ComputerShopBusinessLogic/OfficePackage/HelperModels/WordInfo.cs b/ComputerShopBusinessLogic/OfficePackage/HelperModels/WordInfo.cs index 86cb4db..2abf77c 100644 --- a/ComputerShopBusinessLogic/OfficePackage/HelperModels/WordInfo.cs +++ b/ComputerShopBusinessLogic/OfficePackage/HelperModels/WordInfo.cs @@ -11,6 +11,6 @@ namespace ComputerShopBusinessLogic.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(); } }