diff --git a/ComputersShop/ComputersShopView/FormMain.cs b/ComputersShop/ComputersShopView/FormMain.cs index 348a1e4..c660b1a 100644 --- a/ComputersShop/ComputersShopView/FormMain.cs +++ b/ComputersShop/ComputersShopView/FormMain.cs @@ -1,5 +1,6 @@ using ComputersShopContracts.BindingModels; using ComputersShopContracts.BusinessLogicContracts; +using ComputersShopDataModels.Enums; using Microsoft.Extensions.Logging; using System; using System.Collections.Generic; @@ -82,7 +83,14 @@ namespace ComputersShopView try { var operationResult = _orderLogic.TakeOrderInWork(new OrderBindingModel - { Id = id }); + { + Id = id, + ComputerId = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["ComputerId"].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()) + }); if (!operationResult) { throw new Exception("Ошибка при сохранении. Дополнительная информация в логах."); @@ -105,8 +113,13 @@ namespace ComputersShopView try { var operationResult = _orderLogic.FinishOrder(new OrderBindingModel - { - Id = id + { + Id = id, + ComputerId = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["ComputerId"].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()) }); if (!operationResult) { @@ -130,8 +143,13 @@ namespace ComputersShopView try { var operationResult = _orderLogic.DeliveryOrder(new OrderBindingModel - { - Id = id + { + Id = id, + ComputerId = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["ComputerId"].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()) }); if (!operationResult) {