From f1359d265795651b5a8b96b3878454ae72bbf63b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=94=D0=B0=D0=BD=D0=B8=D1=8F=D1=80=20=D0=90=D0=B3=D0=BB?= =?UTF-8?q?=D0=B8=D1=83=D0=BB=D0=BB=D0=BE=D0=B2?= Date: Wed, 1 Mar 2023 20:38:56 +0400 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=20=D0=BE=D1=82=D1=87=D0=B5=D1=82=20=D1=81=D0=BF=D0=B8?= =?UTF-8?q?=D1=81=D0=BA=D0=B0=20=D0=B8=D0=B7=D0=B4=D0=B5=D0=BB=D0=B8=D0=B9?= =?UTF-8?q?=20=D0=B2=20doc-=D1=84=D0=B0=D0=B9=D0=BB=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../OfficePackage/AbstractSaveToWord.cs | 8 ++++++-- .../OfficePackage/HelperModels/WordInfo.cs | 2 +- ConfectionaryBusinessLogic/ReportLogic.cs | 12 ++++++------ Confectionery/FormMain.Designer.cs | 16 ++++++++-------- Confectionery/FormMain.cs | 4 ++-- .../BusinessLogicsContracts/IReportLogic.cs | 2 +- 6 files changed, 24 insertions(+), 20 deletions(-) diff --git a/ConfectionaryBusinessLogic/OfficePackage/AbstractSaveToWord.cs b/ConfectionaryBusinessLogic/OfficePackage/AbstractSaveToWord.cs index de2081a..642a23a 100644 --- a/ConfectionaryBusinessLogic/OfficePackage/AbstractSaveToWord.cs +++ b/ConfectionaryBusinessLogic/OfficePackage/AbstractSaveToWord.cs @@ -24,11 +24,15 @@ namespace ConfectioneryBusinessLogic.OfficePackage } }); - foreach (var component in info.Components) + foreach (var pastry in info.Pastries) { CreateParagraph(new WordParagraph { - Texts = new List<(string, WordTextProperties)> { (component.ComponentName, new WordTextProperties { Size = "24", }) }, + Texts = new List<(string, WordTextProperties)> + { + (pastry.PastryName , new WordTextProperties { Size = "24", Bold = true}), + (" - цена: " + pastry.Price.ToString(), new WordTextProperties { Size = "24" }) + }, TextProperties = new WordTextProperties { Size = "24", diff --git a/ConfectionaryBusinessLogic/OfficePackage/HelperModels/WordInfo.cs b/ConfectionaryBusinessLogic/OfficePackage/HelperModels/WordInfo.cs index b3bfc0b..18165c5 100644 --- a/ConfectionaryBusinessLogic/OfficePackage/HelperModels/WordInfo.cs +++ b/ConfectionaryBusinessLogic/OfficePackage/HelperModels/WordInfo.cs @@ -11,6 +11,6 @@ namespace ConfectioneryBusinessLogic.OfficePackage.HelperModels { public string FileName { get; set; } = string.Empty; public string Title { get; set; } = string.Empty; - public List Components { get; set; } = new(); + public List Pastries { get; set; } = new(); } } diff --git a/ConfectionaryBusinessLogic/ReportLogic.cs b/ConfectionaryBusinessLogic/ReportLogic.cs index bc9bd27..eb7d8b4 100644 --- a/ConfectionaryBusinessLogic/ReportLogic.cs +++ b/ConfectionaryBusinessLogic/ReportLogic.cs @@ -17,7 +17,7 @@ namespace ConfectioneryBusinessLogic { private readonly IComponentStorage _componentStorage; - private readonly IPastryStorage _PastryStorage; + private readonly IPastryStorage _pastryStorage; private readonly IOrderStorage _orderStorage; @@ -30,7 +30,7 @@ namespace ConfectioneryBusinessLogic public ReportLogic(IPastryStorage PastryStorage, IComponentStorage componentStorage, IOrderStorage orderStorage, AbstractSaveToExcel saveToExcel, AbstractSaveToWord saveToWord, AbstractSaveToPdf saveToPdf) { - _PastryStorage = PastryStorage; + _pastryStorage = PastryStorage; _componentStorage = componentStorage; _orderStorage = orderStorage; @@ -47,7 +47,7 @@ namespace ConfectioneryBusinessLogic { var components = _componentStorage.GetFullList(); - var Pastrys = _PastryStorage.GetFullList(); + var Pastrys = _pastryStorage.GetFullList(); var list = new List(); @@ -96,13 +96,13 @@ namespace ConfectioneryBusinessLogic /// Сохранение компонент в файл-Word /// /// - public void SaveComponentsToWordFile(ReportBindingModel model) + public void SavePastriesToWordFile(ReportBindingModel model) { _saveToWord.CreateDoc(new WordInfo { FileName = model.FileName, - Title = "Список компонент", - Components = _componentStorage.GetFullList() + Title = "Список изделий", + Pastries = _pastryStorage.GetFullList() }); } diff --git a/Confectionery/FormMain.Designer.cs b/Confectionery/FormMain.Designer.cs index 5edcf4d..4ba23b3 100644 --- a/Confectionery/FormMain.Designer.cs +++ b/Confectionery/FormMain.Designer.cs @@ -33,7 +33,7 @@ pastryToolStripMenuItem = new ToolStripMenuItem(); componentToolStripMenuItem = new ToolStripMenuItem(); reportsToolStripMenuItem = new ToolStripMenuItem(); - componentsToolStripMenuItem = new ToolStripMenuItem(); + pastriesToolStripMenuItem = new ToolStripMenuItem(); pastryComponentsToolStripMenuItem = new ToolStripMenuItem(); ordersToolStripMenuItem = new ToolStripMenuItem(); dataGridView = new DataGridView(); @@ -78,17 +78,17 @@ // // reportsToolStripMenuItem // - reportsToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { componentsToolStripMenuItem, pastryComponentsToolStripMenuItem, ordersToolStripMenuItem }); + reportsToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { pastriesToolStripMenuItem, pastryComponentsToolStripMenuItem, ordersToolStripMenuItem }); reportsToolStripMenuItem.Name = "reportsToolStripMenuItem"; reportsToolStripMenuItem.Size = new Size(60, 20); reportsToolStripMenuItem.Text = "Отчеты"; // - // componentsToolStripMenuItem + // pastriesToolStripMenuItem // - componentsToolStripMenuItem.Name = "componentsToolStripMenuItem"; - componentsToolStripMenuItem.Size = new Size(218, 22); - componentsToolStripMenuItem.Text = "Список компонентов"; - componentsToolStripMenuItem.Click += ComponentsToolStripMenuItem_Click_1; + pastriesToolStripMenuItem.Name = "pastriesToolStripMenuItem"; + pastriesToolStripMenuItem.Size = new Size(218, 22); + pastriesToolStripMenuItem.Text = "Список изделий"; + pastriesToolStripMenuItem.Click += PastriesToolStripMenuItem_Click_1; // // pastryComponentsToolStripMenuItem // @@ -205,7 +205,7 @@ private ToolStripMenuItem pastryToolStripMenuItem; private ToolStripMenuItem componentToolStripMenuItem; private ToolStripMenuItem reportsToolStripMenuItem; - private ToolStripMenuItem componentsToolStripMenuItem; + private ToolStripMenuItem pastriesToolStripMenuItem; private ToolStripMenuItem pastryComponentsToolStripMenuItem; private ToolStripMenuItem ordersToolStripMenuItem; } diff --git a/Confectionery/FormMain.cs b/Confectionery/FormMain.cs index 684e08d..68e45e1 100644 --- a/Confectionery/FormMain.cs +++ b/Confectionery/FormMain.cs @@ -157,12 +157,12 @@ namespace ConfectioneryView LoadData(); } - private void ComponentsToolStripMenuItem_Click_1(object sender, EventArgs e) + private void PastriesToolStripMenuItem_Click_1(object sender, EventArgs e) { using var dialog = new SaveFileDialog { Filter = "docx|*.docx" }; if (dialog.ShowDialog() == DialogResult.OK) { - _reportLogic.SaveComponentsToWordFile(new ReportBindingModel { FileName = dialog.FileName }); + _reportLogic.SavePastriesToWordFile(new ReportBindingModel { FileName = dialog.FileName }); MessageBox.Show("", "", MessageBoxButtons.OK, MessageBoxIcon.Information); } } diff --git a/ConfectioneryContracts/BusinessLogicsContracts/IReportLogic.cs b/ConfectioneryContracts/BusinessLogicsContracts/IReportLogic.cs index a2f0728..793b11c 100644 --- a/ConfectioneryContracts/BusinessLogicsContracts/IReportLogic.cs +++ b/ConfectioneryContracts/BusinessLogicsContracts/IReportLogic.cs @@ -25,7 +25,7 @@ namespace ConfectioneryContracts.BusinessLogicsContracts /// Сохранение компонент в файл-Word /// /// - void SaveComponentsToWordFile(ReportBindingModel model); + void SavePastriesToWordFile(ReportBindingModel model); /// /// Сохранение компонент с указаеним продуктов в файл-Excel ///