From 5baaf295a0dd5812f6f77f0858426b24d8ffc242 Mon Sep 17 00:00:00 2001 From: bekodeg Date: Mon, 6 May 2024 21:52:11 +0400 Subject: [PATCH] =?UTF-8?q?=D0=BF=D0=BE=D1=87=D0=B8=D0=BD=D0=B8=D0=BB=20?= =?UTF-8?q?=D0=BE=D1=82=D1=87=D1=91=D1=82=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SushiBar/SushiBar/Forms/FormMain.Designer.cs | 74 +++++++++++++++++--- SushiBar/SushiBar/Forms/FormMain.cs | 36 +++++++++- 2 files changed, 100 insertions(+), 10 deletions(-) diff --git a/SushiBar/SushiBar/Forms/FormMain.Designer.cs b/SushiBar/SushiBar/Forms/FormMain.Designer.cs index f700068..e5bdff8 100644 --- a/SushiBar/SushiBar/Forms/FormMain.Designer.cs +++ b/SushiBar/SushiBar/Forms/FormMain.Designer.cs @@ -33,6 +33,10 @@ toolStripMenuItem = new ToolStripMenuItem(); sushiToolStripMenuItem = new ToolStripMenuItem(); componentsToolStripMenuItem = new ToolStripMenuItem(); + отчётыToolStripMenuItem1 = new ToolStripMenuItem(); + sushisReportToolStripMenuItem = new ToolStripMenuItem(); + componentsReportПоСушиToolStripMenuItem = new ToolStripMenuItem(); + orderReportToolStripMenuItem = new ToolStripMenuItem(); отчётыToolStripMenuItem = new ToolStripMenuItem(); sushisToolStripMenuItem = new ToolStripMenuItem(); componentSushisToolStripMenuItem = new ToolStripMenuItem(); @@ -61,7 +65,7 @@ // menuStrip1 // menuStrip1.ImageScalingSize = new Size(20, 20); - menuStrip1.Items.AddRange(new ToolStripItem[] { toolStripMenuItem, }); + menuStrip1.Items.AddRange(new ToolStripItem[] { toolStripMenuItem, отчётыToolStripMenuItem1 }); menuStrip1.Location = new Point(0, 0); menuStrip1.Name = "menuStrip1"; menuStrip1.Size = new Size(1190, 28); @@ -71,29 +75,77 @@ // toolStripMenuItem // toolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { sushiToolStripMenuItem, componentsToolStripMenuItem }); - toolStripMenuItem.Name = "ToolStripMenuItem"; + toolStripMenuItem.Name = "toolStripMenuItem"; toolStripMenuItem.Size = new Size(117, 24); toolStripMenuItem.Text = "Справочники"; // // sushiToolStripMenuItem // - sushiToolStripMenuItem.Name = "SushiToolStripMenuItem"; + sushiToolStripMenuItem.Name = "sushiToolStripMenuItem"; sushiToolStripMenuItem.Size = new Size(182, 26); sushiToolStripMenuItem.Text = "Суши"; sushiToolStripMenuItem.Click += SushiToolStripMenuItem_Click; // // componentsToolStripMenuItem // - componentsToolStripMenuItem.Name = "ComponentsToolStripMenuItem"; + componentsToolStripMenuItem.Name = "componentsToolStripMenuItem"; componentsToolStripMenuItem.Size = new Size(182, 26); componentsToolStripMenuItem.Text = "Компоненты"; componentsToolStripMenuItem.Click += ComponentsToolStripMenuItem_Click; // + // отчётыToolStripMenuItem1 + // + отчётыToolStripMenuItem1.DropDownItems.AddRange(new ToolStripItem[] { sushisReportToolStripMenuItem, componentsReportПоСушиToolStripMenuItem, orderReportToolStripMenuItem }); + отчётыToolStripMenuItem1.Name = "отчётыToolStripMenuItem1"; + отчётыToolStripMenuItem1.Size = new Size(73, 24); + отчётыToolStripMenuItem1.Text = "Отчёты"; + // + // sushisReportToolStripMenuItem + // + sushisReportToolStripMenuItem.Name = "sushisReportToolStripMenuItem"; + sushisReportToolStripMenuItem.Size = new Size(243, 26); + sushisReportToolStripMenuItem.Text = "Список суши"; + sushisReportToolStripMenuItem.Click += sushisReportToolStripMenuItem_Click; + // + // componentsReportПоСушиToolStripMenuItem + // + componentsReportПоСушиToolStripMenuItem.Name = "componentsReportПоСушиToolStripMenuItem"; + componentsReportПоСушиToolStripMenuItem.Size = new Size(243, 26); + componentsReportПоСушиToolStripMenuItem.Text = "Компоненты по суши"; + componentsReportПоСушиToolStripMenuItem.Click += componentsReportПоСушиToolStripMenuItem_Click; + // + // orderReportToolStripMenuItem + // + orderReportToolStripMenuItem.Name = "orderReportToolStripMenuItem"; + orderReportToolStripMenuItem.Size = new Size(243, 26); + orderReportToolStripMenuItem.Text = "Список заказов"; + orderReportToolStripMenuItem.Click += orderReportToolStripMenuItem_Click; + // + // отчётыToolStripMenuItem + // + отчётыToolStripMenuItem.Name = "отчётыToolStripMenuItem"; + отчётыToolStripMenuItem.Size = new Size(32, 19); + // + // sushisToolStripMenuItem + // + sushisToolStripMenuItem.Name = "sushisToolStripMenuItem"; + sushisToolStripMenuItem.Size = new Size(32, 19); + // + // componentSushisToolStripMenuItem + // + componentSushisToolStripMenuItem.Name = "componentSushisToolStripMenuItem"; + componentSushisToolStripMenuItem.Size = new Size(32, 19); + // + // ordersToolStripMenuItem + // + ordersToolStripMenuItem.Name = "ordersToolStripMenuItem"; + ordersToolStripMenuItem.Size = new Size(32, 19); + // // buttonCreateOrder // buttonCreateOrder.Anchor = AnchorStyles.Top | AnchorStyles.Right; buttonCreateOrder.Location = new Point(998, 31); - buttonCreateOrder.Name = "ButtonCreateOrder"; + buttonCreateOrder.Name = "buttonCreateOrder"; buttonCreateOrder.Size = new Size(180, 30); buttonCreateOrder.TabIndex = 2; buttonCreateOrder.Text = "Создать заказ"; @@ -104,7 +156,7 @@ // buttonTakeOrderInWork.Anchor = AnchorStyles.Top | AnchorStyles.Right; buttonTakeOrderInWork.Location = new Point(998, 67); - buttonTakeOrderInWork.Name = "ButtonTakeOrderInWork"; + buttonTakeOrderInWork.Name = "buttonTakeOrderInWork"; buttonTakeOrderInWork.Size = new Size(180, 30); buttonTakeOrderInWork.TabIndex = 3; buttonTakeOrderInWork.Text = "Отдать на выполнение"; @@ -115,7 +167,7 @@ // buttonOrderReady.Anchor = AnchorStyles.Top | AnchorStyles.Right; buttonOrderReady.Location = new Point(998, 103); - buttonOrderReady.Name = "ButtonOrderReady"; + buttonOrderReady.Name = "buttonOrderReady"; buttonOrderReady.Size = new Size(180, 30); buttonOrderReady.TabIndex = 4; buttonOrderReady.Text = "Заказ готов"; @@ -126,7 +178,7 @@ // buttonIssuedOrder.Anchor = AnchorStyles.Top | AnchorStyles.Right; buttonIssuedOrder.Location = new Point(998, 139); - buttonIssuedOrder.Name = "ButtonIssuedOrder"; + buttonIssuedOrder.Name = "buttonIssuedOrder"; buttonIssuedOrder.Size = new Size(180, 30); buttonIssuedOrder.TabIndex = 5; buttonIssuedOrder.Text = "Заказ Выдан"; @@ -137,7 +189,7 @@ // buttonRef.Anchor = AnchorStyles.Top | AnchorStyles.Right; buttonRef.Location = new Point(998, 175); - buttonRef.Name = "ButtonRef"; + buttonRef.Name = "buttonRef"; buttonRef.Size = new Size(180, 30); buttonRef.TabIndex = 6; buttonRef.Text = "Обновить список"; @@ -185,5 +237,9 @@ private ToolStripMenuItem sushisToolStripMenuItem; private ToolStripMenuItem componentSushisToolStripMenuItem; private ToolStripMenuItem ordersToolStripMenuItem; + private ToolStripMenuItem отчётыToolStripMenuItem1; + private ToolStripMenuItem sushisReportToolStripMenuItem; + private ToolStripMenuItem componentsReportПоСушиToolStripMenuItem; + private ToolStripMenuItem orderReportToolStripMenuItem; } } \ No newline at end of file diff --git a/SushiBar/SushiBar/Forms/FormMain.cs b/SushiBar/SushiBar/Forms/FormMain.cs index c7e1a22..8b0f023 100644 --- a/SushiBar/SushiBar/Forms/FormMain.cs +++ b/SushiBar/SushiBar/Forms/FormMain.cs @@ -1,4 +1,5 @@ using Microsoft.Extensions.Logging; +using SushiBarBusinessLogic.BusinessLogics; using SushiBarContracts.BindingModels; using SushiBarContracts.BusinessLogicsContracts; @@ -8,11 +9,13 @@ namespace SushiBar.Forms { private readonly ILogger _logger; private readonly IOrderLogic _orderLogic; - public FormMain(ILogger logger, IOrderLogic orderLogic) + private readonly IReportLogic _reportLogic; + public FormMain(ILogger logger, IOrderLogic orderLogic, IReportLogic reportLogic) { InitializeComponent(); _logger = logger; _orderLogic = orderLogic; + _reportLogic = reportLogic; } private void FormMain_Load(object sender, EventArgs e) { @@ -133,5 +136,36 @@ namespace SushiBar.Forms { LoadData(); } + + private void sushisReportToolStripMenuItem_Click(object sender, EventArgs e) + { + using var dialog = new SaveFileDialog { Filter = "docx|*.docx" }; + if (dialog.ShowDialog() == DialogResult.OK) + { + _reportLogic.SaveSushisToWordFile(new ReportBindingModel + { + FileName = dialog.FileName + }); + MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK, MessageBoxIcon.Information); + } + } + + private void componentsReportПоСушиToolStripMenuItem_Click(object sender, EventArgs e) + { + var service = Program.ServiceProvider?.GetService(typeof(FormReportSushiComponents)); + if (service is FormReportSushiComponents form) + { + form.ShowDialog(); + } + } + + private void orderReportToolStripMenuItem_Click(object sender, EventArgs e) + { + var service = Program.ServiceProvider?.GetService(typeof(FormReportOrders)); + if (service is FormReportOrders form) + { + form.ShowDialog(); + } + } } }