From a8cd32adebfe69a457a006154faff1bcf4a91ab6 Mon Sep 17 00:00:00 2001 From: maxnes3 <112558334+maxnes3@users.noreply.github.com> Date: Tue, 14 Mar 2023 00:57:05 +0400 Subject: [PATCH] =?UTF-8?q?=D0=92=D1=81=D1=91,=20=D0=BA=D1=80=D0=BE=D0=BC?= =?UTF-8?q?=D0=B5=20pdf?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ComputersShopView/FormMain.Designer.cs | 5 +- ComputersShop/ComputersShopView/FormMain.cs | 17 ++- .../FormReportOrders.Designer.cs | 133 +++++++++--------- .../ComputersShopView/FormReportOrders.resx | 62 +------- 4 files changed, 88 insertions(+), 129 deletions(-) diff --git a/ComputersShop/ComputersShopView/FormMain.Designer.cs b/ComputersShop/ComputersShopView/FormMain.Designer.cs index 8c4463f..dadc261 100644 --- a/ComputersShop/ComputersShopView/FormMain.Designer.cs +++ b/ComputersShop/ComputersShopView/FormMain.Designer.cs @@ -87,14 +87,15 @@ // списокКомпонентовToolStripMenuItem.Name = "списокКомпонентовToolStripMenuItem"; списокКомпонентовToolStripMenuItem.Size = new Size(242, 22); - списокКомпонентовToolStripMenuItem.Text = "список компонентов"; - списокКомпонентовToolStripMenuItem.Click += ComputerComponentsToolStripMenuItem_Click; + списокКомпонентовToolStripMenuItem.Text = "список компьютеров"; + списокКомпонентовToolStripMenuItem.Click += ComponentsDocxToolStripMenuItem_Click; // // компонентыПоКомпьютерамToolStripMenuItem // компонентыПоКомпьютерамToolStripMenuItem.Name = "компонентыПоКомпьютерамToolStripMenuItem"; компонентыПоКомпьютерамToolStripMenuItem.Size = new Size(242, 22); компонентыПоКомпьютерамToolStripMenuItem.Text = "компоненты по компьютерам"; + компонентыПоКомпьютерамToolStripMenuItem.Click += ComputerComponentsToolStripMenuItem_Click; // // списокЗаказовToolStripMenuItem // diff --git a/ComputersShop/ComputersShopView/FormMain.cs b/ComputersShop/ComputersShopView/FormMain.cs index 4412971..2cd77e8 100644 --- a/ComputersShop/ComputersShopView/FormMain.cs +++ b/ComputersShop/ComputersShopView/FormMain.cs @@ -1,4 +1,5 @@ -using ComputersShopContracts.BindingModels; +using ComputersShopBusinessLogic.BusinessLogics; +using ComputersShopContracts.BindingModels; using ComputersShopContracts.BusinessLogicContracts; using ComputersShopDataModels.Enums; using Microsoft.Extensions.Logging; @@ -18,12 +19,14 @@ namespace ComputersShopView { private readonly ILogger _logger; private readonly IOrderLogic _orderLogic; + private readonly IReportLogic _reportLogic; - public FormMain(ILogger logger, IOrderLogic orderLogic) + public FormMain(ILogger logger, IOrderLogic orderLogic, IReportLogic reportlogic) { InitializeComponent(); _logger = logger; _orderLogic = orderLogic; + _reportLogic = reportlogic; } private void FormMain_Load(object sender, EventArgs e) @@ -166,6 +169,16 @@ namespace ComputersShopView } } + private void ComponentsDocxToolStripMenuItem_Click(object sender, EventArgs e) + { + using var dialog = new SaveFileDialog { Filter = "docx|*.docx" }; + if (dialog.ShowDialog() == DialogResult.OK) + { + _reportLogic.SaveComputersToWordFile(new ReportBindingModel { FileName = dialog.FileName }); + MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK, MessageBoxIcon.Information); + } + } + private void ComputerComponentsToolStripMenuItem_Click(object sender, EventArgs e) { var service = Program.ServiceProvider?.GetService(typeof(FormReportComputerComponents)); diff --git a/ComputersShop/ComputersShopView/FormReportOrders.Designer.cs b/ComputersShop/ComputersShopView/FormReportOrders.Designer.cs index 3df50ad..1155483 100644 --- a/ComputersShop/ComputersShopView/FormReportOrders.Designer.cs +++ b/ComputersShop/ComputersShopView/FormReportOrders.Designer.cs @@ -28,94 +28,99 @@ /// private void InitializeComponent() { - this.panel = new System.Windows.Forms.Panel(); - this.buttonToPdf = new System.Windows.Forms.Button(); - this.buttonMake = new System.Windows.Forms.Button(); - this.dateTimePickerTo = new System.Windows.Forms.DateTimePicker(); - this.labelTo = new System.Windows.Forms.Label(); - this.dateTimePickerFrom = new System.Windows.Forms.DateTimePicker(); - this.labelFrom = new System.Windows.Forms.Label(); - this.panel.SuspendLayout(); - this.SuspendLayout(); + panel = new Panel(); + buttonToPdf = new Button(); + buttonMake = new Button(); + dateTimePickerTo = new DateTimePicker(); + labelTo = new Label(); + dateTimePickerFrom = new DateTimePicker(); + labelFrom = new Label(); + panel.SuspendLayout(); + SuspendLayout(); // // panel // - this.panel.Controls.Add(this.buttonToPdf); - this.panel.Controls.Add(this.buttonMake); - this.panel.Controls.Add(this.dateTimePickerTo); - this.panel.Controls.Add(this.labelTo); - this.panel.Controls.Add(this.dateTimePickerFrom); - this.panel.Controls.Add(this.labelFrom); - this.panel.Dock = System.Windows.Forms.DockStyle.Top; - this.panel.Location = new System.Drawing.Point(0, 0); - this.panel.Name = "panel"; - this.panel.Size = new System.Drawing.Size(926, 47); - this.panel.TabIndex = 0; + panel.Controls.Add(buttonToPdf); + panel.Controls.Add(buttonMake); + panel.Controls.Add(dateTimePickerTo); + panel.Controls.Add(labelTo); + panel.Controls.Add(dateTimePickerFrom); + panel.Controls.Add(labelFrom); + panel.Dock = DockStyle.Top; + panel.Location = new Point(0, 0); + panel.Margin = new Padding(3, 2, 3, 2); + panel.Name = "panel"; + panel.Size = new Size(810, 35); + panel.TabIndex = 0; // // buttonToPdf // - this.buttonToPdf.Location = new System.Drawing.Point(825, 7); - this.buttonToPdf.Name = "buttonToPdf"; - this.buttonToPdf.Size = new System.Drawing.Size(94, 29); - this.buttonToPdf.TabIndex = 5; - this.buttonToPdf.Text = "в Pdf"; - this.buttonToPdf.UseVisualStyleBackColor = true; - this.buttonToPdf.Click += new System.EventHandler(this.ButtonToPdf_Click); + buttonToPdf.Location = new Point(722, 5); + buttonToPdf.Margin = new Padding(3, 2, 3, 2); + buttonToPdf.Name = "buttonToPdf"; + buttonToPdf.Size = new Size(82, 22); + buttonToPdf.TabIndex = 5; + buttonToPdf.Text = "в Pdf"; + buttonToPdf.UseVisualStyleBackColor = true; + buttonToPdf.Click += ButtonToPdf_Click; // // buttonMake // - this.buttonMake.Location = new System.Drawing.Point(643, 7); - this.buttonMake.Name = "buttonMake"; - this.buttonMake.Size = new System.Drawing.Size(149, 29); - this.buttonMake.TabIndex = 4; - this.buttonMake.Text = "Сформировать"; - this.buttonMake.UseVisualStyleBackColor = true; - this.buttonMake.Click += new System.EventHandler(this.ButtonMake_Click); + buttonMake.Location = new Point(563, 5); + buttonMake.Margin = new Padding(3, 2, 3, 2); + buttonMake.Name = "buttonMake"; + buttonMake.Size = new Size(130, 22); + buttonMake.TabIndex = 4; + buttonMake.Text = "Сформировать"; + buttonMake.UseVisualStyleBackColor = true; + buttonMake.Click += ButtonMake_Click; // // dateTimePickerTo // - this.dateTimePickerTo.Location = new System.Drawing.Point(348, 9); - this.dateTimePickerTo.Name = "dateTimePickerTo"; - this.dateTimePickerTo.Size = new System.Drawing.Size(250, 27); - this.dateTimePickerTo.TabIndex = 3; + dateTimePickerTo.Location = new Point(304, 7); + dateTimePickerTo.Margin = new Padding(3, 2, 3, 2); + dateTimePickerTo.Name = "dateTimePickerTo"; + dateTimePickerTo.Size = new Size(219, 23); + dateTimePickerTo.TabIndex = 3; // // labelTo // - this.labelTo.AutoSize = true; - this.labelTo.Location = new System.Drawing.Point(292, 14); - this.labelTo.Name = "labelTo"; - this.labelTo.Size = new System.Drawing.Size(50, 20); - this.labelTo.TabIndex = 2; - this.labelTo.Text = "label1"; + labelTo.AutoSize = true; + labelTo.Location = new Point(256, 10); + labelTo.Name = "labelTo"; + labelTo.Size = new Size(38, 15); + labelTo.TabIndex = 2; + labelTo.Text = "label1"; // // dateTimePickerFrom // - this.dateTimePickerFrom.Location = new System.Drawing.Point(36, 9); - this.dateTimePickerFrom.Name = "dateTimePickerFrom"; - this.dateTimePickerFrom.Size = new System.Drawing.Size(250, 27); - this.dateTimePickerFrom.TabIndex = 1; + dateTimePickerFrom.Location = new Point(32, 7); + dateTimePickerFrom.Margin = new Padding(3, 2, 3, 2); + dateTimePickerFrom.Name = "dateTimePickerFrom"; + dateTimePickerFrom.Size = new Size(219, 23); + dateTimePickerFrom.TabIndex = 1; // // labelFrom // - this.labelFrom.AutoSize = true; - this.labelFrom.Location = new System.Drawing.Point(12, 14); - this.labelFrom.Name = "labelFrom"; - this.labelFrom.Size = new System.Drawing.Size(18, 20); - this.labelFrom.TabIndex = 0; - this.labelFrom.Text = "C"; + labelFrom.AutoSize = true; + labelFrom.Location = new Point(10, 10); + labelFrom.Name = "labelFrom"; + labelFrom.Size = new Size(15, 15); + labelFrom.TabIndex = 0; + labelFrom.Text = "C"; // // FormReportOrders // - this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(926, 450); - this.Controls.Add(this.panel); - this.Name = "FormReportOrders"; - this.Text = "Заказы"; - this.panel.ResumeLayout(false); - this.panel.PerformLayout(); - this.ResumeLayout(false); - + AutoScaleDimensions = new SizeF(7F, 15F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(810, 582); + Controls.Add(panel); + Margin = new Padding(3, 2, 3, 2); + Name = "FormReportOrders"; + Text = "Заказы"; + panel.ResumeLayout(false); + panel.PerformLayout(); + ResumeLayout(false); } #endregion diff --git a/ComputersShop/ComputersShopView/FormReportOrders.resx b/ComputersShop/ComputersShopView/FormReportOrders.resx index 1af7de1..f298a7b 100644 --- a/ComputersShop/ComputersShopView/FormReportOrders.resx +++ b/ComputersShop/ComputersShopView/FormReportOrders.resx @@ -1,64 +1,4 @@ - - - +