diff --git a/Confectionery/Confectionery/FormMain.Designer.cs b/Confectionery/Confectionery/FormMain.Designer.cs index 86afe81..39f4a1a 100644 --- a/Confectionery/Confectionery/FormMain.Designer.cs +++ b/Confectionery/Confectionery/FormMain.Designer.cs @@ -113,7 +113,7 @@ // // referencesToolStripMenuItem // - referencesToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { pastriesToolStripMenuItem, componentsToolStripMenuItem }); + referencesToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { componentsToolStripMenuItem, pastriesToolStripMenuItem }); referencesToolStripMenuItem.Name = "referencesToolStripMenuItem"; referencesToolStripMenuItem.Size = new Size(139, 29); referencesToolStripMenuItem.Text = "Справочники"; diff --git a/Confectionery/Confectionery/FormMain.cs b/Confectionery/Confectionery/FormMain.cs index bcc89bc..599d3ac 100644 --- a/Confectionery/Confectionery/FormMain.cs +++ b/Confectionery/Confectionery/FormMain.cs @@ -79,7 +79,7 @@ namespace ConfectioneryView try { var operationResult = _orderLogic.TakeOrderInWork( - new OrderBindingModel { Id = id }); + CreateBindingModel(id)); if (!operationResult) { throw new Exception( @@ -107,7 +107,7 @@ namespace ConfectioneryView try { var operationResult = _orderLogic.FinishOrder( - new OrderBindingModel { Id = id }); + CreateBindingModel(id)); if (!operationResult) { throw new Exception("Ошибка при сохранении. " + @@ -134,7 +134,7 @@ namespace ConfectioneryView try { var operationResult = _orderLogic.DeliveryOrder( - new OrderBindingModel { Id = id }); + CreateBindingModel(id)); if (!operationResult) { throw new Exception("Ошибка при сохранении. " + @@ -155,5 +155,22 @@ namespace ConfectioneryView { LoadData(); } + private OrderBindingModel CreateBindingModel(int id, bool isDone = false) + { + return new OrderBindingModel + { + Id = id, + PastryId = Convert.ToInt32(dataGridView.SelectedRows[ + 0].Cells["PastryId"].Value), + Status = Enum.Parse(dataGridView.SelectedRows[ + 0].Cells["Status"].Value.ToString()), + Count = Convert.ToInt32(dataGridView.SelectedRows[ + 0].Cells["Count"].Value), + Sum = double.Parse(dataGridView.SelectedRows[ + 0].Cells["Sum"].Value.ToString()), + DateCreate = DateTime.Parse(dataGridView.SelectedRows[ + 0].Cells["DateCreate"].Value.ToString()), + }; + } } }