Решен конфликт при удалении кнопок

This commit is contained in:
Данияр Аглиуллов 2023-03-19 16:58:50 +04:00
commit 05f7855a11
2 changed files with 281 additions and 359 deletions

View File

@ -33,6 +33,8 @@
pastryToolStripMenuItem = new ToolStripMenuItem(); pastryToolStripMenuItem = new ToolStripMenuItem();
componentToolStripMenuItem = new ToolStripMenuItem(); componentToolStripMenuItem = new ToolStripMenuItem();
ShopsToolStripMenuItem = new ToolStripMenuItem(); ShopsToolStripMenuItem = new ToolStripMenuItem();
clientsToolStripMenuItem = new ToolStripMenuItem();
ImplementersToolStripMenuItem = new ToolStripMenuItem();
reportsToolStripMenuItem = new ToolStripMenuItem(); reportsToolStripMenuItem = new ToolStripMenuItem();
reportShopsToolStripMenuItem = new ToolStripMenuItem(); reportShopsToolStripMenuItem = new ToolStripMenuItem();
ShopPastriesToolStripMenuItem = new ToolStripMenuItem(); ShopPastriesToolStripMenuItem = new ToolStripMenuItem();
@ -43,15 +45,11 @@
mailToolStripMenuItem = new ToolStripMenuItem(); mailToolStripMenuItem = new ToolStripMenuItem();
dataGridView = new DataGridView(); dataGridView = new DataGridView();
buttonCreateOrder = new Button(); buttonCreateOrder = new Button();
buttonTakeOrderInWork = new Button();
button2 = new Button();
button3 = new Button(); button3 = new Button();
button4 = new Button(); button4 = new Button();
buttonAddPastryInShop = new Button(); buttonAddPastryInShop = new Button();
ImplementersToolStripMenuItem = new ToolStripMenuItem();
DoWorkToolStripMenuItem = new ToolStripMenuItem(); DoWorkToolStripMenuItem = new ToolStripMenuItem();
buttonSellPastry = new Button(); buttonSellPastry = new Button();
clientsToolStripMenuItem = new ToolStripMenuItem();
menuStrip1.SuspendLayout(); menuStrip1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit(); ((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
SuspendLayout(); SuspendLayout();
@ -75,24 +73,38 @@
// pastryToolStripMenuItem // pastryToolStripMenuItem
// //
pastryToolStripMenuItem.Name = "pastryToolStripMenuItem"; pastryToolStripMenuItem.Name = "pastryToolStripMenuItem";
pastryToolStripMenuItem.Size = new Size(180, 22); pastryToolStripMenuItem.Size = new Size(149, 22);
pastryToolStripMenuItem.Text = "Изделия"; pastryToolStripMenuItem.Text = "Изделия";
pastryToolStripMenuItem.Click += PastryToolStripMenuItem_Click; pastryToolStripMenuItem.Click += PastryToolStripMenuItem_Click;
// //
// componentToolStripMenuItem // componentToolStripMenuItem
// //
componentToolStripMenuItem.Name = "componentToolStripMenuItem"; componentToolStripMenuItem.Name = "componentToolStripMenuItem";
componentToolStripMenuItem.Size = new Size(180, 22); componentToolStripMenuItem.Size = new Size(149, 22);
componentToolStripMenuItem.Text = "Компоненты"; componentToolStripMenuItem.Text = "Компоненты";
componentToolStripMenuItem.Click += ComponentsToolStripMenuItem_Click; componentToolStripMenuItem.Click += ComponentsToolStripMenuItem_Click;
// //
// ShopsToolStripMenuItem // ShopsToolStripMenuItem
// //
ShopsToolStripMenuItem.Name = "ShopsToolStripMenuItem"; ShopsToolStripMenuItem.Name = "ShopsToolStripMenuItem";
ShopsToolStripMenuItem.Size = new Size(145, 22); ShopsToolStripMenuItem.Size = new Size(149, 22);
ShopsToolStripMenuItem.Text = "Магазины"; ShopsToolStripMenuItem.Text = "Магазины";
ShopsToolStripMenuItem.Click += ShopsToolStripMenuItem_Click; ShopsToolStripMenuItem.Click += ShopsToolStripMenuItem_Click;
// //
// clientsToolStripMenuItem
//
clientsToolStripMenuItem.Name = "clientsToolStripMenuItem";
clientsToolStripMenuItem.Size = new Size(149, 22);
clientsToolStripMenuItem.Text = "Клиенты";
clientsToolStripMenuItem.Click += ClientsToolStripMenuItem_Click;
//
// ImplementersToolStripMenuItem
//
ImplementersToolStripMenuItem.Name = "ImplementersToolStripMenuItem";
ImplementersToolStripMenuItem.Size = new Size(149, 22);
ImplementersToolStripMenuItem.Text = "Исполнители";
ImplementersToolStripMenuItem.Click += ImplementersToolStripMenuItem_Click;
//
// reportsToolStripMenuItem // reportsToolStripMenuItem
// //
reportsToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { reportShopsToolStripMenuItem, ShopPastriesToolStripMenuItem, groupOrdersToolStripMenuItem, pastriesToolStripMenuItem, pastryComponentsToolStripMenuItem, ordersToolStripMenuItem }); reportsToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { reportShopsToolStripMenuItem, ShopPastriesToolStripMenuItem, groupOrdersToolStripMenuItem, pastriesToolStripMenuItem, pastryComponentsToolStripMenuItem, ordersToolStripMenuItem });
@ -103,14 +115,14 @@
// reportShopsToolStripMenuItem // reportShopsToolStripMenuItem
// //
reportShopsToolStripMenuItem.Name = "reportShopsToolStripMenuItem"; reportShopsToolStripMenuItem.Name = "reportShopsToolStripMenuItem";
reportShopsToolStripMenuItem.Size = new Size(202, 22); reportShopsToolStripMenuItem.Size = new Size(215, 22);
reportShopsToolStripMenuItem.Text = "Список магазинов"; reportShopsToolStripMenuItem.Text = "Список магазинов";
reportShopsToolStripMenuItem.Click += ReportShopsToolStripMenuItem_Click; reportShopsToolStripMenuItem.Click += ReportShopsToolStripMenuItem_Click;
// //
// ShopPastriesToolStripMenuItem // ShopPastriesToolStripMenuItem
// //
ShopPastriesToolStripMenuItem.Name = "ShopPastriesToolStripMenuItem"; ShopPastriesToolStripMenuItem.Name = "ShopPastriesToolStripMenuItem";
ShopPastriesToolStripMenuItem.Size = new Size(202, 22); ShopPastriesToolStripMenuItem.Size = new Size(215, 22);
ShopPastriesToolStripMenuItem.Text = "Магазины с изделиями"; ShopPastriesToolStripMenuItem.Text = "Магазины с изделиями";
ShopPastriesToolStripMenuItem.Click += ShopPastriesToolStripMenuItem_Click; ShopPastriesToolStripMenuItem.Click += ShopPastriesToolStripMenuItem_Click;
// //
@ -138,10 +150,17 @@
// ordersToolStripMenuItem // ordersToolStripMenuItem
// //
ordersToolStripMenuItem.Name = "ordersToolStripMenuItem"; ordersToolStripMenuItem.Name = "ordersToolStripMenuItem";
ordersToolStripMenuItem.Size = new Size(202, 22); ordersToolStripMenuItem.Size = new Size(215, 22);
ordersToolStripMenuItem.Text = "Список заказов"; ordersToolStripMenuItem.Text = "Список заказов";
ordersToolStripMenuItem.Click += OrdersToolStripMenuItem_Click; ordersToolStripMenuItem.Click += OrdersToolStripMenuItem_Click;
// //
// DoWorkToolStripMenuItem
//
DoWorkToolStripMenuItem.Name = "DoWorkToolStripMenuItem";
DoWorkToolStripMenuItem.Size = new Size(92, 20);
DoWorkToolStripMenuItem.Text = "Запуск работ";
DoWorkToolStripMenuItem.Click += DoWorkToolStripMenuItem_Click;
//
// dataGridView // dataGridView
// //
dataGridView.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right; dataGridView.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
@ -163,39 +182,17 @@
buttonCreateOrder.UseVisualStyleBackColor = true; buttonCreateOrder.UseVisualStyleBackColor = true;
buttonCreateOrder.Click += ButtonCreateOrder_Click; buttonCreateOrder.Click += ButtonCreateOrder_Click;
// //
// buttonTakeOrderInWork
//
buttonTakeOrderInWork.Anchor = AnchorStyles.Top | AnchorStyles.Right;
buttonTakeOrderInWork.Location = new Point(624, 98);
buttonTakeOrderInWork.Name = "buttonTakeOrderInWork";
buttonTakeOrderInWork.Size = new Size(147, 32);
buttonTakeOrderInWork.TabIndex = 3;
buttonTakeOrderInWork.Text = "Отдать на выполнение";
buttonTakeOrderInWork.UseVisualStyleBackColor = true;
buttonTakeOrderInWork.Click += ButtonTakeOrderInWork_Click;
//
// mailToolStripMenuItem // mailToolStripMenuItem
// //
mailToolStripMenuItem.Name = "mailToolStripMenuItem"; mailToolStripMenuItem.Name = "mailToolStripMenuItem";
mailToolStripMenuItem.Size = new Size(62, 20); mailToolStripMenuItem.Size = new Size(62, 20);
mailToolStripMenuItem.Text = "Письма"; mailToolStripMenuItem.Text = "Письма";
mailToolStripMenuItem.Click += MailToolStripMenuItem_Click; mailToolStripMenuItem.Click += MailToolStripMenuItem_Click;
//
// button2
//
button2.Anchor = AnchorStyles.Top | AnchorStyles.Right;
button2.Location = new Point(624, 157);
button2.Name = "button2";
button2.Size = new Size(147, 32);
button2.TabIndex = 4;
button2.Text = "Заказ готов";
button2.UseVisualStyleBackColor = true;
button2.Click += ButtonOrderReady_Click;
// //
// button3 // button3
// //
button3.Anchor = AnchorStyles.Top | AnchorStyles.Right; button3.Anchor = AnchorStyles.Top | AnchorStyles.Right;
button3.Location = new Point(624, 215); button3.Location = new Point(624, 95);
button3.Name = "button3"; button3.Name = "button3";
button3.Size = new Size(147, 32); button3.Size = new Size(147, 32);
button3.TabIndex = 5; button3.TabIndex = 5;
@ -206,7 +203,7 @@
// button4 // button4
// //
button4.Anchor = AnchorStyles.Top | AnchorStyles.Right; button4.Anchor = AnchorStyles.Top | AnchorStyles.Right;
button4.Location = new Point(624, 274); button4.Location = new Point(624, 154);
button4.Name = "button4"; button4.Name = "button4";
button4.Size = new Size(147, 32); button4.Size = new Size(147, 32);
button4.TabIndex = 6; button4.TabIndex = 6;
@ -224,24 +221,10 @@
buttonAddPastryInShop.Text = "Пополнение магазина"; buttonAddPastryInShop.Text = "Пополнение магазина";
buttonAddPastryInShop.UseVisualStyleBackColor = true; buttonAddPastryInShop.UseVisualStyleBackColor = true;
buttonAddPastryInShop.Click += ButtonAddPastryInShop_Click; buttonAddPastryInShop.Click += ButtonAddPastryInShop_Click;
//
// ImplementersToolStripMenuItem
//
ImplementersToolStripMenuItem.Name = "ImplementersToolStripMenuItem";
ImplementersToolStripMenuItem.Size = new Size(180, 22);
ImplementersToolStripMenuItem.Text = "Исполнители";
ImplementersToolStripMenuItem.Click += ImplementersToolStripMenuItem_Click;
//
// DoWorkToolStripMenuItem
//
DoWorkToolStripMenuItem.Name = "DoWorkToolStripMenuItem";
DoWorkToolStripMenuItem.Size = new Size(92, 20);
DoWorkToolStripMenuItem.Text = "Запуск работ";
DoWorkToolStripMenuItem.Click += DoWorkToolStripMenuItem_Click;
// //
// buttonSellPastry // buttonSellPastry
// //
buttonSellPastry.Anchor = AnchorStyles.Top | AnchorStyles.Right; buttonSellPastry.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
buttonSellPastry.Location = new Point(624, 331); buttonSellPastry.Location = new Point(624, 331);
buttonSellPastry.Name = "buttonSellPastry"; buttonSellPastry.Name = "buttonSellPastry";
buttonSellPastry.Size = new Size(147, 31); buttonSellPastry.Size = new Size(147, 31);
@ -250,13 +233,6 @@
buttonSellPastry.UseVisualStyleBackColor = true; buttonSellPastry.UseVisualStyleBackColor = true;
buttonSellPastry.Click += ButtonSellPastry_Click; buttonSellPastry.Click += ButtonSellPastry_Click;
// //
// clientsToolStripMenuItem
//
clientsToolStripMenuItem.Name = "clientsToolStripMenuItem";
clientsToolStripMenuItem.Size = new Size(180, 22);
clientsToolStripMenuItem.Text = "Клиенты";
clientsToolStripMenuItem.Click += ClientsToolStripMenuItem_Click;
//
// FormMain // FormMain
// //
AutoScaleDimensions = new SizeF(7F, 15F); AutoScaleDimensions = new SizeF(7F, 15F);
@ -266,8 +242,6 @@
Controls.Add(buttonAddPastryInShop); Controls.Add(buttonAddPastryInShop);
Controls.Add(button4); Controls.Add(button4);
Controls.Add(button3); Controls.Add(button3);
Controls.Add(button2);
Controls.Add(buttonTakeOrderInWork);
Controls.Add(buttonCreateOrder); Controls.Add(buttonCreateOrder);
Controls.Add(dataGridView); Controls.Add(dataGridView);
Controls.Add(menuStrip1); Controls.Add(menuStrip1);
@ -288,8 +262,6 @@
private ToolStripMenuItem справочникиToolStripMenuItem; private ToolStripMenuItem справочникиToolStripMenuItem;
private DataGridView dataGridView; private DataGridView dataGridView;
private Button buttonCreateOrder; private Button buttonCreateOrder;
private Button buttonTakeOrderInWork;
private Button button2;
private Button button3; private Button button3;
private Button button4; private Button button4;
private ToolStripMenuItem pastryToolStripMenuItem; private ToolStripMenuItem pastryToolStripMenuItem;

View File

@ -79,56 +79,6 @@ namespace ConfectioneryView
} }
} }
private void ButtonTakeOrderInWork_Click(object sender, EventArgs e)
{
if (dataGridView.SelectedRows.Count == 1)
{
int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
_logger.LogInformation("Çàêàç No{id}. Ìåíÿåòñÿ ñòàòóñ íà 'Â ðàáîòå'", id);
try
{
var operationResult = _orderLogic.TakeOrderInWork(new OrderBindingModel { Id = id });
if (!operationResult)
{
throw new Exception("Îøèáêà ïðè ñîõðàíåíèè. Äîïîëíèòåëüíàÿ èíôîðìàöèÿ â ëîãàõ.");
}
LoadData();
}
catch (Exception ex)
{
_logger.LogError(ex, "Îøèáêà ïåðåäà÷è çàêàçà â ðàáîòó");
MessageBox.Show(ex.Message, "Îøèáêà", MessageBoxButtons.OK,
MessageBoxIcon.Error);
}
}
}
private void ButtonOrderReady_Click(object sender, EventArgs e)
{
if (dataGridView.SelectedRows.Count == 1)
{
int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
OrderStatus orderStatus = (OrderStatus)dataGridView.SelectedRows[0].Cells["Status"].Value;
_logger.LogInformation("Çàêàç No{id}. Ìåíÿåòñÿ ñòàòóñ íà 'Ãîòîâ'", id);
try
{
var operationResult = _orderLogic.FinishOrder(new OrderBindingModel
{
Id = id,
Status = orderStatus
});
if (!operationResult)
{
throw new Exception("Îøèáêà ïðè ñîõðàíåíèè. Äîïîëíèòåëüíàÿ èíôîðìàöèÿ â ëîãàõ.");
}
LoadData();
}
catch (Exception ex)
{
_logger.LogError(ex, "Îøèáêà îòìåòêè î ãîòîâíîñòè çàêàçà");
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)