ПИбд-22 Боровков М В 4 лабораторная работа #4

Closed
bekodeg wants to merge 23 commits from labWork4 into labWork3
2 changed files with 100 additions and 10 deletions
Showing only changes of commit 5baaf295a0 - Show all commits

View File

@ -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;
}
}

View File

@ -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<FormMain> logger, IOrderLogic orderLogic)
private readonly IReportLogic _reportLogic;
public FormMain(ILogger<FormMain> 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();
}
}
}
}