From 5df83b8834a6c7c760331140b6bf23105bf2b88e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=BA=20=D0=98=D0=B3=D0=BE=D1=80=D1=8C?= Date: Tue, 9 May 2023 18:16:32 +0400 Subject: [PATCH] =?UTF-8?q?=D0=B8=20=D0=B5=D1=89=D0=B5=20=D0=BE=D0=B4?= =?UTF-8?q?=D0=B8=D0=BD=20=D1=84=D0=B8=D0=BA=D1=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BlacksmithWorkshop/FormMain.Designer.cs | 69 ++++++++++--------- .../BlacksmithWorkshop/FormMain.cs | 27 ++++++++ .../BlacksmithWorkshop/Program.cs | 2 + 3 files changed, 65 insertions(+), 33 deletions(-) diff --git a/BlacksmithWorkshop/BlacksmithWorkshop/FormMain.Designer.cs b/BlacksmithWorkshop/BlacksmithWorkshop/FormMain.Designer.cs index 2a034b9..fb9eeed 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshop/FormMain.Designer.cs +++ b/BlacksmithWorkshop/BlacksmithWorkshop/FormMain.Designer.cs @@ -33,8 +33,10 @@ this.componentsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.manufacturesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.storesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.отчетToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.componentsReportToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.reportToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.reportComponentsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.reportManufactureComponentsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.reportOrdersToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.dataGridView = new System.Windows.Forms.DataGridView(); this.buttonCreateOrder = new System.Windows.Forms.Button(); this.buttonTakeOrderInWork = new System.Windows.Forms.Button(); @@ -43,8 +45,6 @@ this.buttonRef = new System.Windows.Forms.Button(); this.buttonFillStore = new System.Windows.Forms.Button(); this.buttonSellManufacture = new System.Windows.Forms.Button(); - this.manufactureComponentsReportToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.ordersReportToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.menuStrip.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit(); this.SuspendLayout(); @@ -53,7 +53,7 @@ // this.menuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.refbooksToolStripMenuItem, - this.отчетToolStripMenuItem}); + this.reportToolStripMenuItem}); this.menuStrip.Location = new System.Drawing.Point(0, 0); this.menuStrip.Name = "menuStrip"; this.menuStrip.Size = new System.Drawing.Size(1108, 24); @@ -91,21 +91,36 @@ this.storesToolStripMenuItem.Text = "Магазины"; this.storesToolStripMenuItem.Click += new System.EventHandler(this.StoresToolStripMenuItem_Click); // - // отчетToolStripMenuItem + // reportToolStripMenuItem // - this.отчетToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.componentsReportToolStripMenuItem, - this.manufactureComponentsReportToolStripMenuItem, - this.ordersReportToolStripMenuItem}); - this.отчетToolStripMenuItem.Name = "отчетToolStripMenuItem"; - this.отчетToolStripMenuItem.Size = new System.Drawing.Size(51, 20); - this.отчетToolStripMenuItem.Text = "Отчет"; + this.reportToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.reportComponentsToolStripMenuItem, + this.reportManufactureComponentsToolStripMenuItem, + this.reportOrdersToolStripMenuItem}); + this.reportToolStripMenuItem.Name = "reportToolStripMenuItem"; + this.reportToolStripMenuItem.Size = new System.Drawing.Size(51, 20); + this.reportToolStripMenuItem.Text = "Отчет"; // - // componentsReportToolStripMenuItem + // reportComponentsToolStripMenuItem // - this.componentsReportToolStripMenuItem.Name = "componentsReportToolStripMenuItem"; - this.componentsReportToolStripMenuItem.Size = new System.Drawing.Size(218, 22); - this.componentsReportToolStripMenuItem.Text = "Список компонентов"; + this.reportComponentsToolStripMenuItem.Name = "reportComponentsToolStripMenuItem"; + this.reportComponentsToolStripMenuItem.Size = new System.Drawing.Size(218, 22); + this.reportComponentsToolStripMenuItem.Text = "Список компонентов"; + this.reportComponentsToolStripMenuItem.Click += new System.EventHandler(this.ReportComponentsToolStripMenuItem_Click); + // + // reportManufactureComponentsToolStripMenuItem + // + this.reportManufactureComponentsToolStripMenuItem.Name = "reportManufactureComponentsToolStripMenuItem"; + this.reportManufactureComponentsToolStripMenuItem.Size = new System.Drawing.Size(218, 22); + this.reportManufactureComponentsToolStripMenuItem.Text = "Компоненты по изделиям"; + this.reportManufactureComponentsToolStripMenuItem.Click += new System.EventHandler(this.ReportManufactureComponentsToolStripMenuItem_Click); + // + // reportOrdersToolStripMenuItem + // + this.reportOrdersToolStripMenuItem.Name = "reportOrdersToolStripMenuItem"; + this.reportOrdersToolStripMenuItem.Size = new System.Drawing.Size(218, 22); + this.reportOrdersToolStripMenuItem.Text = "Список заказов"; + this.reportOrdersToolStripMenuItem.Click += new System.EventHandler(this.ReportOrdersToolStripMenuItem_Click); // // dataGridView // @@ -193,18 +208,6 @@ this.buttonSellManufacture.UseVisualStyleBackColor = true; this.buttonSellManufacture.Click += new System.EventHandler(this.ButtonSellManufacture_Click); // - // manufactureComponentsReportToolStripMenuItem - // - this.manufactureComponentsReportToolStripMenuItem.Name = "manufactureComponentsReportToolStripMenuItem"; - this.manufactureComponentsReportToolStripMenuItem.Size = new System.Drawing.Size(218, 22); - this.manufactureComponentsReportToolStripMenuItem.Text = "Компоненты по изделиям"; - // - // ordersReportToolStripMenuItem - // - this.ordersReportToolStripMenuItem.Name = "ordersReportToolStripMenuItem"; - this.ordersReportToolStripMenuItem.Size = new System.Drawing.Size(218, 22); - this.ordersReportToolStripMenuItem.Text = "Список заказов"; - // // FormMain // this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); @@ -246,9 +249,9 @@ private ToolStripMenuItem storesToolStripMenuItem; private Button buttonFillStore; private Button buttonSellManufacture; - private ToolStripMenuItem отчетToolStripMenuItem; - private ToolStripMenuItem componentsReportToolStripMenuItem; - private ToolStripMenuItem manufactureComponentsReportToolStripMenuItem; - private ToolStripMenuItem ordersReportToolStripMenuItem; + private ToolStripMenuItem reportToolStripMenuItem; + private ToolStripMenuItem reportComponentsToolStripMenuItem; + private ToolStripMenuItem reportManufactureComponentsToolStripMenuItem; + private ToolStripMenuItem reportOrdersToolStripMenuItem; } } \ No newline at end of file diff --git a/BlacksmithWorkshop/BlacksmithWorkshop/FormMain.cs b/BlacksmithWorkshop/BlacksmithWorkshop/FormMain.cs index 3af5e22..9da2eb9 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshop/FormMain.cs +++ b/BlacksmithWorkshop/BlacksmithWorkshop/FormMain.cs @@ -173,5 +173,32 @@ namespace BlacksmithWorkshopView form.ShowDialog(); } } + private void ReportComponentsToolStripMenuItem_Click(object sender, EventArgs e) + { + using var dialog = new SaveFileDialog { Filter = "docx|*.docx" }; + if (dialog.ShowDialog() == DialogResult.OK) + { + _reportLogic.SaveComponentsToWordFile(new ReportBindingModel { FileName = dialog.FileName }); + MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK, MessageBoxIcon.Information); + } + } + private void ReportManufactureComponentsToolStripMenuItem_Click(object sender, EventArgs e) + { + var service = Program.ServiceProvider?.GetService(typeof(FormReportManufactureComponents)); + if (service is FormReportManufactureComponents form) + { + form.ShowDialog(); + LoadData(); + } + } + private void ReportOrdersToolStripMenuItem_Click(object sender, EventArgs e) + { + var service = Program.ServiceProvider?.GetService(typeof(FormReportOrders)); + if (service is FormReportOrders form) + { + form.ShowDialog(); + LoadData(); + } + } } } \ No newline at end of file diff --git a/BlacksmithWorkshop/BlacksmithWorkshop/Program.cs b/BlacksmithWorkshop/BlacksmithWorkshop/Program.cs index da8585b..e964944 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshop/Program.cs +++ b/BlacksmithWorkshop/BlacksmithWorkshop/Program.cs @@ -57,6 +57,8 @@ namespace BlacksmithWorkshopView services.AddTransient(); services.AddTransient(); services.AddTransient(); + services.AddTransient(); + services.AddTransient(); } } } \ No newline at end of file