Редактирование главной формы.

This commit is contained in:
Programmist73 2023-03-17 15:43:10 +04:00
parent 556b83d46d
commit d09961c4f2
2 changed files with 72 additions and 4 deletions

View File

@ -38,6 +38,9 @@
this.toolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.workPieceToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.manufactureToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.workPiecesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.workPieceManufacturesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.ordersToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();
this.menuStrip1.SuspendLayout();
this.SuspendLayout();
@ -117,7 +120,10 @@
//
this.toolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.workPieceToolStripMenuItem,
this.manufactureToolStripMenuItem});
this.manufactureToolStripMenuItem,
this.workPiecesToolStripMenuItem,
this.workPieceManufacturesToolStripMenuItem,
this.ordersToolStripMenuItem});
this.toolStripMenuItem.Name = "toolStripMenuItem";
this.toolStripMenuItem.Size = new System.Drawing.Size(117, 24);
this.toolStripMenuItem.Text = "Справочники";
@ -125,17 +131,38 @@
// workPieceToolStripMenuItem
//
this.workPieceToolStripMenuItem.Name = "workPieceToolStripMenuItem";
this.workPieceToolStripMenuItem.Size = new System.Drawing.Size(162, 26);
this.workPieceToolStripMenuItem.Size = new System.Drawing.Size(288, 26);
this.workPieceToolStripMenuItem.Text = "Заготовки";
this.workPieceToolStripMenuItem.Click += new System.EventHandler(this.WorkPieceToolStripMenuItem_Click);
//
// manufactureToolStripMenuItem
//
this.manufactureToolStripMenuItem.Name = "manufactureToolStripMenuItem";
this.manufactureToolStripMenuItem.Size = new System.Drawing.Size(162, 26);
this.manufactureToolStripMenuItem.Size = new System.Drawing.Size(288, 26);
this.manufactureToolStripMenuItem.Text = "Изделия";
this.manufactureToolStripMenuItem.Click += new System.EventHandler(this.ManufactureToolStripMenuItem_Click);
//
// workPiecesToolStripMenuItem
//
this.workPiecesToolStripMenuItem.Name = "workPiecesToolStripMenuItem";
this.workPiecesToolStripMenuItem.Size = new System.Drawing.Size(288, 26);
this.workPiecesToolStripMenuItem.Text = "Список заготовок";
this.workPiecesToolStripMenuItem.Click += new System.EventHandler(this.WorkPiecesToolStripMenuItem_Click);
//
// workPieceManufacturesToolStripMenuItem
//
this.workPieceManufacturesToolStripMenuItem.Name = "workPieceManufacturesToolStripMenuItem";
this.workPieceManufacturesToolStripMenuItem.Size = new System.Drawing.Size(288, 26);
this.workPieceManufacturesToolStripMenuItem.Text = "Заготовки по изделиям";
this.workPieceManufacturesToolStripMenuItem.Click += new System.EventHandler(this.WorkPieceManufacturesToolStripMenuItem_Click);
//
// ordersToolStripMenuItem
//
this.ordersToolStripMenuItem.Name = "ordersToolStripMenuItem";
this.ordersToolStripMenuItem.Size = new System.Drawing.Size(288, 26);
this.ordersToolStripMenuItem.Text = "Отчёт по заказам за период";
this.ordersToolStripMenuItem.Click += new System.EventHandler(this.OrdersToolStripMenuItem_Click);
//
// FormMain
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
@ -172,5 +199,8 @@
private ToolStripMenuItem toolStripMenuItem;
private ToolStripMenuItem workPieceToolStripMenuItem;
private ToolStripMenuItem manufactureToolStripMenuItem;
private ToolStripMenuItem workPiecesToolStripMenuItem;
private ToolStripMenuItem workPieceManufacturesToolStripMenuItem;
private ToolStripMenuItem ordersToolStripMenuItem;
}
}

View File

@ -1,4 +1,5 @@
using BlacksmithWorkshopContracts.BindingModels;
using BlacksmithWorkshopBusinessLogic.BusinessLogic;
using BlacksmithWorkshopContracts.BindingModels;
using BlacksmithWorkshopContracts.BusinessLogicsContracts;
using BlacksmithWorkshopDataModels.Enums;
using Microsoft.Extensions.Logging;
@ -20,6 +21,8 @@ namespace BlacksmithWorkshop
private readonly IOrderLogic _orderLogic;
private readonly IReportLogic _reportLogic;
public FormMain(ILogger<FormMain> logger, IOrderLogic orderLogic)
{
InitializeComponent();
@ -177,6 +180,41 @@ namespace BlacksmithWorkshop
}
}
private void WorkPiecesToolStripMenuItem_Click(object sender, EventArgs e)
{
using var dialog = new SaveFileDialog { Filter = "docx|*.docx" };
if (dialog.ShowDialog() == DialogResult.OK)
{
_reportLogic.SaveWorkPiecesToWordFile(new ReportBindingModel
{
FileName = dialog.FileName
});
MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
private void WorkPieceManufacturesToolStripMenuItem_Click(object sender, EventArgs e)
{
var service = Program.ServiceProvider?.GetService(typeof(FormReportManufactureWorkPieces));
if (service is FormReportManufactureWorkPieces form)
{
form.ShowDialog();
}
}
private void OrdersToolStripMenuItem_Click(object sender, EventArgs e)
{
var service = Program.ServiceProvider?.GetService(typeof(FormReportOrders));
if (service is FormReportOrders form)
{
form.ShowDialog();
}
}
private void ButtonRef_Click(object sender, EventArgs e)
{
LoadData();