интересно как вносить изменения в другую ветку, не сломается ли у меня щас 6 лаба...

This commit is contained in:
malimova 2024-05-04 00:20:03 +04:00
parent db32d4fc50
commit f044c9cd9b
2 changed files with 364 additions and 346 deletions

View File

@ -20,182 +20,190 @@
base.Dispose(disposing); base.Dispose(disposing);
} }
#region Windows Form Designer generated code #region Windows Form Designer generated code
/// <summary> /// <summary>
/// Required method for Designer support - do not modify /// Required method for Designer support - do not modify
/// the contents of this method with the code editor. /// the contents of this method with the code editor.
/// </summary> /// </summary>
private void InitializeComponent() private void InitializeComponent()
{ {
dataGridView = new DataGridView(); dataGridView = new DataGridView();
menuStrip = new MenuStrip(); menuStrip = new MenuStrip();
toolStripMenuItem = new ToolStripMenuItem(); toolStripMenuItem = new ToolStripMenuItem();
componentsToolStripMenuItem = new ToolStripMenuItem(); componentsToolStripMenuItem = new ToolStripMenuItem();
pastryToolStripMenuItem = new ToolStripMenuItem(); pastryToolStripMenuItem = new ToolStripMenuItem();
отчетыToolStripMenuItem = new ToolStripMenuItem(); отчетыToolStripMenuItem = new ToolStripMenuItem();
pastrysListToolStripMenuItem = new ToolStripMenuItem(); pastrysListToolStripMenuItem = new ToolStripMenuItem();
componentPastryToolStripMenuItem = new ToolStripMenuItem(); componentPastryToolStripMenuItem = new ToolStripMenuItem();
ordersListToolStripMenuItem = new ToolStripMenuItem(); ordersListToolStripMenuItem = new ToolStripMenuItem();
buttonCreateOrder = new Button(); buttonCreateOrder = new Button();
buttonTakeOrderInWork = new Button(); buttonTakeOrderInWork = new Button();
buttonOrderReady = new Button(); buttonOrderReady = new Button();
buttonIssuedOrder = new Button(); buttonIssuedOrder = new Button();
buttonRef = new Button(); buttonRef = new Button();
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit(); clientsToolStripMenuItem = new ToolStripMenuItem();
menuStrip.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
SuspendLayout(); menuStrip.SuspendLayout();
// SuspendLayout();
// dataGridView //
// // dataGridView
dataGridView.BackgroundColor = Color.AliceBlue; //
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; dataGridView.BackgroundColor = Color.AliceBlue;
dataGridView.Location = new Point(12, 60); dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
dataGridView.Name = "dataGridView"; dataGridView.Location = new Point(12, 60);
dataGridView.RowHeadersWidth = 62; dataGridView.Name = "dataGridView";
dataGridView.Size = new Size(1374, 549); dataGridView.RowHeadersWidth = 62;
dataGridView.TabIndex = 0; dataGridView.Size = new Size(1374, 549);
// dataGridView.TabIndex = 0;
// menuStrip //
// // menuStrip
menuStrip.ImageScalingSize = new Size(24, 24); //
menuStrip.Items.AddRange(new ToolStripItem[] { toolStripMenuItem, отчетыToolStripMenuItem }); menuStrip.ImageScalingSize = new Size(24, 24);
menuStrip.Location = new Point(0, 0); menuStrip.Items.AddRange(new ToolStripItem[] { toolStripMenuItem, отчетыToolStripMenuItem });
menuStrip.Name = "menuStrip"; menuStrip.Location = new Point(0, 0);
menuStrip.Size = new Size(1666, 33); menuStrip.Name = "menuStrip";
menuStrip.TabIndex = 1; menuStrip.Size = new Size(1666, 33);
menuStrip.Text = "menuStrip1"; menuStrip.TabIndex = 1;
// menuStrip.Text = "menuStrip1";
// toolStripMenuItem //
// // toolStripMenuItem
toolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { componentsToolStripMenuItem, pastryToolStripMenuItem }); //
toolStripMenuItem.Name = "toolStripMenuItem"; toolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { componentsToolStripMenuItem, pastryToolStripMenuItem, clientsToolStripMenuItem });
toolStripMenuItem.Size = new Size(139, 29); toolStripMenuItem.Name = "toolStripMenuItem";
toolStripMenuItem.Text = "Справочники"; toolStripMenuItem.Size = new Size(139, 29);
// toolStripMenuItem.Text = "Справочники";
// componentsToolStripMenuItem //
// // componentsToolStripMenuItem
componentsToolStripMenuItem.Name = "componentsToolStripMenuItem"; //
componentsToolStripMenuItem.Size = new Size(298, 34); componentsToolStripMenuItem.Name = "componentsToolStripMenuItem";
componentsToolStripMenuItem.Text = "Компоненты"; componentsToolStripMenuItem.Size = new Size(298, 34);
componentsToolStripMenuItem.Click += componentsToolStripMenuItem_Click; componentsToolStripMenuItem.Text = "Компоненты";
// componentsToolStripMenuItem.Click += componentsToolStripMenuItem_Click;
// pastryToolStripMenuItem //
// // pastryToolStripMenuItem
pastryToolStripMenuItem.Name = "pastryToolStripMenuItem"; //
pastryToolStripMenuItem.Size = new Size(298, 34); pastryToolStripMenuItem.Name = "pastryToolStripMenuItem";
pastryToolStripMenuItem.Text = "Кондитерские изделия"; pastryToolStripMenuItem.Size = new Size(298, 34);
pastryToolStripMenuItem.Click += pastryToolStripMenuItem_Click; pastryToolStripMenuItem.Text = "Кондитерские изделия";
// pastryToolStripMenuItem.Click += pastryToolStripMenuItem_Click;
// отчетыToolStripMenuItem //
// // отчетыToolStripMenuItem
отчетыToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { pastrysListToolStripMenuItem, componentPastryToolStripMenuItem, ordersListToolStripMenuItem }); //
отчетыToolStripMenuItem.Name = "отчетыToolStripMenuItem"; отчетыToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { pastrysListToolStripMenuItem, componentPastryToolStripMenuItem, ordersListToolStripMenuItem });
отчетыToolStripMenuItem.Size = new Size(88, 29); отчетыToolStripMenuItem.Name = "отчетыToolStripMenuItem";
отчетыToolStripMenuItem.Text = "Отчеты"; отчетыToolStripMenuItem.Size = new Size(88, 29);
// отчетыToolStripMenuItem.Text = "Отчеты";
// pastrysListToolStripMenuItem //
// // pastrysListToolStripMenuItem
pastrysListToolStripMenuItem.Name = "pastrysListToolStripMenuItem"; //
pastrysListToolStripMenuItem.Size = new Size(327, 34); pastrysListToolStripMenuItem.Name = "pastrysListToolStripMenuItem";
pastrysListToolStripMenuItem.Text = "Список изделий"; pastrysListToolStripMenuItem.Size = new Size(327, 34);
pastrysListToolStripMenuItem.Click += pastrysListToolStripMenuItem_Click; pastrysListToolStripMenuItem.Text = "Список изделий";
// pastrysListToolStripMenuItem.Click += pastrysListToolStripMenuItem_Click;
// componentPastryToolStripMenuItem //
// // componentPastryToolStripMenuItem
componentPastryToolStripMenuItem.Name = "componentPastryToolStripMenuItem"; //
componentPastryToolStripMenuItem.Size = new Size(327, 34); componentPastryToolStripMenuItem.Name = "componentPastryToolStripMenuItem";
componentPastryToolStripMenuItem.Text = "Компоненты по изделиям"; componentPastryToolStripMenuItem.Size = new Size(327, 34);
componentPastryToolStripMenuItem.Click += componentPastryToolStripMenuItem_Click; componentPastryToolStripMenuItem.Text = "Компоненты по изделиям";
// componentPastryToolStripMenuItem.Click += componentPastryToolStripMenuItem_Click;
// ordersListToolStripMenuItem //
// // ordersListToolStripMenuItem
ordersListToolStripMenuItem.Name = "ordersListToolStripMenuItem"; //
ordersListToolStripMenuItem.Size = new Size(327, 34); ordersListToolStripMenuItem.Name = "ordersListToolStripMenuItem";
ordersListToolStripMenuItem.Text = "Список заказов"; ordersListToolStripMenuItem.Size = new Size(327, 34);
ordersListToolStripMenuItem.Click += ordersListToolStripMenuItem_Click; ordersListToolStripMenuItem.Text = "Список заказов";
// ordersListToolStripMenuItem.Click += ordersListToolStripMenuItem_Click;
// buttonCreateOrder //
// // buttonCreateOrder
buttonCreateOrder.Anchor = AnchorStyles.Top | AnchorStyles.Right; //
buttonCreateOrder.Location = new Point(1402, 83); buttonCreateOrder.Anchor = AnchorStyles.Top | AnchorStyles.Right;
buttonCreateOrder.Name = "buttonCreateOrder"; buttonCreateOrder.Location = new Point(1402, 83);
buttonCreateOrder.Size = new Size(232, 34); buttonCreateOrder.Name = "buttonCreateOrder";
buttonCreateOrder.TabIndex = 2; buttonCreateOrder.Size = new Size(232, 34);
buttonCreateOrder.Text = "Создать заказ"; buttonCreateOrder.TabIndex = 2;
buttonCreateOrder.UseVisualStyleBackColor = true; buttonCreateOrder.Text = "Создать заказ";
buttonCreateOrder.Click += buttonCreateOrder_Click; buttonCreateOrder.UseVisualStyleBackColor = true;
// buttonCreateOrder.Click += buttonCreateOrder_Click;
// buttonTakeOrderInWork //
// // buttonTakeOrderInWork
buttonTakeOrderInWork.Anchor = AnchorStyles.Top | AnchorStyles.Right; //
buttonTakeOrderInWork.Location = new Point(1402, 143); buttonTakeOrderInWork.Anchor = AnchorStyles.Top | AnchorStyles.Right;
buttonTakeOrderInWork.Name = "buttonTakeOrderInWork"; buttonTakeOrderInWork.Location = new Point(1402, 143);
buttonTakeOrderInWork.Size = new Size(232, 34); buttonTakeOrderInWork.Name = "buttonTakeOrderInWork";
buttonTakeOrderInWork.TabIndex = 3; buttonTakeOrderInWork.Size = new Size(232, 34);
buttonTakeOrderInWork.Text = "Отдать на выполнение"; buttonTakeOrderInWork.TabIndex = 3;
buttonTakeOrderInWork.UseVisualStyleBackColor = true; buttonTakeOrderInWork.Text = "Отдать на выполнение";
buttonTakeOrderInWork.Click += buttonTakeOrderInWork_Click; buttonTakeOrderInWork.UseVisualStyleBackColor = true;
// buttonTakeOrderInWork.Click += buttonTakeOrderInWork_Click;
// buttonOrderReady //
// // buttonOrderReady
buttonOrderReady.Anchor = AnchorStyles.Top | AnchorStyles.Right; //
buttonOrderReady.Location = new Point(1402, 203); buttonOrderReady.Anchor = AnchorStyles.Top | AnchorStyles.Right;
buttonOrderReady.Name = "buttonOrderReady"; buttonOrderReady.Location = new Point(1402, 203);
buttonOrderReady.Size = new Size(232, 34); buttonOrderReady.Name = "buttonOrderReady";
buttonOrderReady.TabIndex = 4; buttonOrderReady.Size = new Size(232, 34);
buttonOrderReady.Text = "Заказ готов"; buttonOrderReady.TabIndex = 4;
buttonOrderReady.UseVisualStyleBackColor = true; buttonOrderReady.Text = "Заказ готов";
buttonOrderReady.Click += buttonOrderReady_Click; buttonOrderReady.UseVisualStyleBackColor = true;
// buttonOrderReady.Click += buttonOrderReady_Click;
// buttonIssuedOrder //
// // buttonIssuedOrder
buttonIssuedOrder.Anchor = AnchorStyles.Top | AnchorStyles.Right; //
buttonIssuedOrder.Location = new Point(1402, 266); buttonIssuedOrder.Anchor = AnchorStyles.Top | AnchorStyles.Right;
buttonIssuedOrder.Name = "buttonIssuedOrder"; buttonIssuedOrder.Location = new Point(1402, 266);
buttonIssuedOrder.Size = new Size(232, 34); buttonIssuedOrder.Name = "buttonIssuedOrder";
buttonIssuedOrder.TabIndex = 5; buttonIssuedOrder.Size = new Size(232, 34);
buttonIssuedOrder.Text = "Заказ выдан"; buttonIssuedOrder.TabIndex = 5;
buttonIssuedOrder.UseVisualStyleBackColor = true; buttonIssuedOrder.Text = "Заказ выдан";
buttonIssuedOrder.Click += buttonIssuedOrder_Click; buttonIssuedOrder.UseVisualStyleBackColor = true;
// buttonIssuedOrder.Click += buttonIssuedOrder_Click;
// buttonRef //
// // buttonRef
buttonRef.Anchor = AnchorStyles.Top | AnchorStyles.Right; //
buttonRef.Location = new Point(1402, 329); buttonRef.Anchor = AnchorStyles.Top | AnchorStyles.Right;
buttonRef.Name = "buttonRef"; buttonRef.Location = new Point(1402, 329);
buttonRef.Size = new Size(232, 34); buttonRef.Name = "buttonRef";
buttonRef.TabIndex = 6; buttonRef.Size = new Size(232, 34);
buttonRef.Text = "Обновить список"; buttonRef.TabIndex = 6;
buttonRef.UseVisualStyleBackColor = true; buttonRef.Text = "Обновить список";
buttonRef.Click += buttonRef_Click; buttonRef.UseVisualStyleBackColor = true;
// buttonRef.Click += buttonRef_Click;
// FormMain //
// // clientsToolStripMenuItem
AutoScaleDimensions = new SizeF(10F, 25F); //
AutoScaleMode = AutoScaleMode.Font; clientsToolStripMenuItem.Name = "clientsToolStripMenuItem";
ClientSize = new Size(1666, 621); clientsToolStripMenuItem.Size = new Size(298, 34);
Controls.Add(buttonRef); clientsToolStripMenuItem.Text = "Клиенты";
Controls.Add(buttonIssuedOrder); clientsToolStripMenuItem.Click += clientsToolStripMenuItem_Click;
Controls.Add(buttonOrderReady); //
Controls.Add(buttonTakeOrderInWork); // FormMain
Controls.Add(buttonCreateOrder); //
Controls.Add(dataGridView); AutoScaleDimensions = new SizeF(10F, 25F);
Controls.Add(menuStrip); AutoScaleMode = AutoScaleMode.Font;
MainMenuStrip = menuStrip; ClientSize = new Size(1666, 621);
Name = "FormMain"; Controls.Add(buttonRef);
Text = "Кондитерская"; Controls.Add(buttonIssuedOrder);
Load += FormMain_Load; Controls.Add(buttonOrderReady);
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit(); Controls.Add(buttonTakeOrderInWork);
menuStrip.ResumeLayout(false); Controls.Add(buttonCreateOrder);
menuStrip.PerformLayout(); Controls.Add(dataGridView);
ResumeLayout(false); Controls.Add(menuStrip);
PerformLayout(); MainMenuStrip = menuStrip;
} Name = "FormMain";
Text = "Кондитерская";
Load += FormMain_Load;
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
menuStrip.ResumeLayout(false);
menuStrip.PerformLayout();
ResumeLayout(false);
PerformLayout();
}
#endregion #endregion
private DataGridView dataGridView; private DataGridView dataGridView;
private MenuStrip menuStrip; private MenuStrip menuStrip;
private ToolStripMenuItem toolStripMenuItem; private ToolStripMenuItem toolStripMenuItem;
private Button buttonCreateOrder; private Button buttonCreateOrder;
@ -209,5 +217,6 @@
private ToolStripMenuItem pastrysListToolStripMenuItem; private ToolStripMenuItem pastrysListToolStripMenuItem;
private ToolStripMenuItem componentPastryToolStripMenuItem; private ToolStripMenuItem componentPastryToolStripMenuItem;
private ToolStripMenuItem ordersListToolStripMenuItem; private ToolStripMenuItem ordersListToolStripMenuItem;
} private ToolStripMenuItem clientsToolStripMenuItem;
}
} }

View File

@ -13,186 +13,195 @@ using System.Windows.Forms;
namespace ConfectioneryView namespace ConfectioneryView
{ {
public partial class FormMain : Form public partial class FormMain : Form
{ {
private readonly ILogger _logger; private readonly ILogger _logger;
private readonly IOrderLogic _orderLogic; private readonly IOrderLogic _orderLogic;
private readonly IReportLogic _reportLogic; private readonly IReportLogic _reportLogic;
public FormMain(ILogger<FormMain> logger, IOrderLogic orderLogic, IReportLogic reportLogic) public FormMain(ILogger<FormMain> logger, IOrderLogic orderLogic, IReportLogic reportLogic)
{ {
InitializeComponent(); InitializeComponent();
_logger = logger; _logger = logger;
_orderLogic = orderLogic; _orderLogic = orderLogic;
_reportLogic = reportLogic; _reportLogic = reportLogic;
} }
private void FormMain_Load(object sender, EventArgs e) private void FormMain_Load(object sender, EventArgs e)
{ {
LoadData(); LoadData();
} }
private void LoadData() private void LoadData()
{ {
_logger.LogInformation("Загрузка заказов"); _logger.LogInformation("Загрузка заказов");
try try
{ {
var list = _orderLogic.ReadList(null); var list = _orderLogic.ReadList(null);
if (list != null) if (list != null)
{ {
dataGridView.DataSource = list; dataGridView.DataSource = list;
dataGridView.Columns["PastryId"].Visible = false; dataGridView.Columns["PastryId"].Visible = false;
dataGridView.Columns["ClientId"].Visible = false; dataGridView.Columns["ClientId"].Visible = false;
dataGridView.Columns["PastryName"].AutoSizeMode = dataGridView.Columns["PastryName"].AutoSizeMode =
DataGridViewAutoSizeColumnMode.Fill; DataGridViewAutoSizeColumnMode.Fill;
} }
_logger.LogInformation("Загрузка заказов"); _logger.LogInformation("Загрузка заказов");
} }
catch (Exception ex) catch (Exception ex)
{ {
_logger.LogError(ex, "Ошибка загрузки заказов"); _logger.LogError(ex, "Ошибка загрузки заказов");
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
} }
} }
private void componentsToolStripMenuItem_Click(object sender, EventArgs e) private void componentsToolStripMenuItem_Click(object sender, EventArgs e)
{ {
var service = Program.ServiceProvider?.GetService(typeof(FormComponents)); var service = Program.ServiceProvider?.GetService(typeof(FormComponents));
if (service is FormComponents form) if (service is FormComponents form)
{ {
form.ShowDialog(); form.ShowDialog();
} }
} }
private void pastryToolStripMenuItem_Click(object sender, EventArgs e) private void pastryToolStripMenuItem_Click(object sender, EventArgs e)
{ {
var service = Program.ServiceProvider?.GetService(typeof(FormPastrys)); var service = Program.ServiceProvider?.GetService(typeof(FormPastrys));
if (service is FormPastrys form) if (service is FormPastrys form)
{ {
form.ShowDialog(); form.ShowDialog();
} }
} }
private void buttonCreateOrder_Click(object sender, EventArgs e) private void buttonCreateOrder_Click(object sender, EventArgs e)
{ {
var service = Program.ServiceProvider?.GetService(typeof(FormCreateOrder)); var service = Program.ServiceProvider?.GetService(typeof(FormCreateOrder));
if (service is FormCreateOrder form) if (service is FormCreateOrder form)
{ {
form.ShowDialog(); form.ShowDialog();
LoadData(); LoadData();
} }
} }
private void buttonTakeOrderInWork_Click(object sender, EventArgs e) private void buttonTakeOrderInWork_Click(object sender, EventArgs e)
{ {
if (dataGridView.SelectedRows.Count == 1) if (dataGridView.SelectedRows.Count == 1)
{ {
int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value); int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
_logger.LogInformation("Заказ №{id}. Меняется статус на 'В работе'", id); _logger.LogInformation("Заказ №{id}. Меняется статус на 'В работе'", id);
try try
{ {
var operationResult = _orderLogic.TakeOrderInWork(new var operationResult = _orderLogic.TakeOrderInWork(new
OrderBindingModel OrderBindingModel
{ Id = id }); { Id = id });
if (!operationResult) if (!operationResult)
{ {
throw new Exception("Ошибка при сохранении. Дополнительная информация в логах."); throw new Exception("Ошибка при сохранении. Дополнительная информация в логах.");
} }
LoadData(); LoadData();
} }
catch (Exception ex) catch (Exception ex)
{ {
_logger.LogError(ex, "Ошибка передачи заказа в работу"); _logger.LogError(ex, "Ошибка передачи заказа в работу");
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
MessageBoxIcon.Error); MessageBoxIcon.Error);
} }
} }
} }
private void buttonOrderReady_Click(object sender, EventArgs e) private void buttonOrderReady_Click(object sender, EventArgs e)
{ {
if (dataGridView.SelectedRows.Count == 1) if (dataGridView.SelectedRows.Count == 1)
{ {
int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value); int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
_logger.LogInformation("Заказ №{id}. Меняется статус на 'Готов'", id); _logger.LogInformation("Заказ №{id}. Меняется статус на 'Готов'", id);
try try
{ {
var operationResult = _orderLogic.FinishOrder(new var operationResult = _orderLogic.FinishOrder(new
OrderBindingModel OrderBindingModel
{ Id = id }); { Id = id });
if (!operationResult) if (!operationResult)
{ {
throw new Exception("Ошибка при сохранении. Дополнительная информация в логах."); throw new Exception("Ошибка при сохранении. Дополнительная информация в логах.");
} }
LoadData(); LoadData();
} }
catch (Exception ex) catch (Exception ex)
{ {
_logger.LogError(ex, "Ошибка отметки о готовности заказа"); _logger.LogError(ex, "Ошибка отметки о готовности заказа");
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
} }
} }
} }
private void buttonIssuedOrder_Click(object sender, EventArgs e) private void buttonIssuedOrder_Click(object sender, EventArgs e)
{ {
if (dataGridView.SelectedRows.Count == 1) if (dataGridView.SelectedRows.Count == 1)
{ {
int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value); int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
_logger.LogInformation("Заказ №{id}. Меняется статус на 'Выдан'", id); _logger.LogInformation("Заказ №{id}. Меняется статус на 'Выдан'", id);
try try
{ {
var operationResult = _orderLogic.DeliveryOrder(new var operationResult = _orderLogic.DeliveryOrder(new
OrderBindingModel OrderBindingModel
{ Id = id }); { Id = id });
if (!operationResult) if (!operationResult)
{ {
throw new Exception("Ошибка при сохранении. Дополнительная информация в логах."); throw new Exception("Ошибка при сохранении. Дополнительная информация в логах.");
} }
_logger.LogInformation("Заказ №{id} выдан", id); _logger.LogInformation("Заказ №{id} выдан", id);
LoadData(); LoadData();
} }
catch (Exception ex) catch (Exception ex)
{ {
_logger.LogError(ex, "Ошибка отметки о выдачи заказа"); _logger.LogError(ex, "Ошибка отметки о выдачи заказа");
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
MessageBoxIcon.Error); MessageBoxIcon.Error);
} }
} }
} }
private void buttonRef_Click(object sender, EventArgs e) private void buttonRef_Click(object sender, EventArgs e)
{ {
LoadData(); LoadData();
} }
private void componentPastryToolStripMenuItem_Click(object sender, EventArgs e) private void componentPastryToolStripMenuItem_Click(object sender, EventArgs e)
{ {
var service = Program.ServiceProvider?.GetService(typeof(FormReportPastryComponents)); var service = Program.ServiceProvider?.GetService(typeof(FormReportPastryComponents));
if (service is FormReportPastryComponents form) if (service is FormReportPastryComponents form)
{ {
form.ShowDialog(); form.ShowDialog();
} }
} }
private void ordersListToolStripMenuItem_Click(object sender, EventArgs e) private void ordersListToolStripMenuItem_Click(object sender, EventArgs e)
{ {
var service = Program.ServiceProvider?.GetService(typeof(FormReportOrders)); var service = Program.ServiceProvider?.GetService(typeof(FormReportOrders));
if (service is FormReportOrders form) if (service is FormReportOrders form)
{ {
form.ShowDialog(); form.ShowDialog();
} }
} }
private void pastrysListToolStripMenuItem_Click(object sender, EventArgs e) private void pastrysListToolStripMenuItem_Click(object sender, EventArgs e)
{ {
using var dialog = new SaveFileDialog { Filter = "docx|*.docx" }; using var dialog = new SaveFileDialog { Filter = "docx|*.docx" };
if (dialog.ShowDialog() == DialogResult.OK) if (dialog.ShowDialog() == DialogResult.OK)
{ {
_reportLogic.SaveComponentsToWordFile(new ReportBindingModel _reportLogic.SaveComponentsToWordFile(new ReportBindingModel
{ {
FileName = dialog.FileName FileName = dialog.FileName
}); });
MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK, MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK,
MessageBoxIcon.Information); MessageBoxIcon.Information);
} }
} }
}
private void clientsToolStripMenuItem_Click(object sender, EventArgs e)
{
var service = Program.ServiceProvider?.GetService(typeof(FormClients));
if (service is FormClients form)
{
form.ShowDialog();
}
}
}
} }