diff --git a/Shipyard/Shipyard/FormCreateOrder.cs b/Shipyard/Shipyard/FormCreateOrder.cs index 1cb08d9..54d5ef5 100644 --- a/Shipyard/Shipyard/FormCreateOrder.cs +++ b/Shipyard/Shipyard/FormCreateOrder.cs @@ -99,6 +99,7 @@ namespace ShipyardView var operationResult = _logicO.CreateOrder(new OrderBindingModel { ShipId = Convert.ToInt32(ComboBoxShips.SelectedValue), + ShipName = ComboBoxShips.Text, Count = Convert.ToInt32(TextBoxCount.Text), Sum = Convert.ToDouble(TextBoxSum.Text) }); diff --git a/Shipyard/Shipyard/FormMain.cs b/Shipyard/Shipyard/FormMain.cs index e1275ca..67ec6e3 100644 --- a/Shipyard/Shipyard/FormMain.cs +++ b/Shipyard/Shipyard/FormMain.cs @@ -87,7 +87,7 @@ namespace ShipyardView _logger.LogInformation("Заказ №{id}. Меняется статус на 'В работе'", id); try { - var operationResult = _orderLogic.TakeOrderInWork(new OrderBindingModel{ Id = id , Count = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Count"].Value), Sum = double.Parse(dataGridView.SelectedRows[0].Cells["Sum"].Value.ToString()), Status = Enum.Parse(dataGridView.SelectedRows[0].Cells["Status"].Value.ToString()), ShipId = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["ShipId"].Value), DateCreate = DateTime.Parse(dataGridView.SelectedRows[0].Cells["DateCreate"].Value.ToString()), }); + var operationResult = _orderLogic.TakeOrderInWork(new OrderBindingModel{ Id = id , Count = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Count"].Value), Sum = double.Parse(dataGridView.SelectedRows[0].Cells["Sum"].Value.ToString()), Status = Enum.Parse(dataGridView.SelectedRows[0].Cells["Status"].Value.ToString()), ShipId = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["ShipId"].Value), ShipName = dataGridView.SelectedRows[0].Cells["ShipName"].Value.ToString(),DateCreate = DateTime.Parse(dataGridView.SelectedRows[0].Cells["DateCreate"].Value.ToString()), }); if (!operationResult) { throw new Exception("Ошибка при сохранении. Дополнительная информация в логах."); @@ -111,7 +111,7 @@ namespace ShipyardView _logger.LogInformation("Заказ №{id}. Меняется статус на 'Готов'",id); try { - var operationResult = _orderLogic.FinishOrder(new OrderBindingModel { Id = id, Count = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Count"].Value), Sum = double.Parse(dataGridView.SelectedRows[0].Cells["Sum"].Value.ToString()), Status = Enum.Parse(dataGridView.SelectedRows[0].Cells["Status"].Value.ToString()), ShipId = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["ShipId"].Value), DateCreate = DateTime.Parse(dataGridView.SelectedRows[0].Cells["DateCreate"].Value.ToString()), }); + var operationResult = _orderLogic.FinishOrder(new OrderBindingModel { Id = id, Count = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Count"].Value), Sum = double.Parse(dataGridView.SelectedRows[0].Cells["Sum"].Value.ToString()), Status = Enum.Parse(dataGridView.SelectedRows[0].Cells["Status"].Value.ToString()), ShipId = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["ShipId"].Value), ShipName = dataGridView.SelectedRows[0].Cells["ShipName"].Value.ToString(), DateCreate = DateTime.Parse(dataGridView.SelectedRows[0].Cells["DateCreate"].Value.ToString()), }); if (!operationResult) { throw new Exception("Ошибка при сохранении.Дополнительная информация в логах."); @@ -134,7 +134,7 @@ namespace ShipyardView _logger.LogInformation("Заказ №{id}. Меняется статус на 'Выдан'",id); try { - var operationResult = _orderLogic.DeliveryOrder(new OrderBindingModel { Id = id, Count = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Count"].Value), Sum = double.Parse(dataGridView.SelectedRows[0].Cells["Sum"].Value.ToString()), Status = Enum.Parse(dataGridView.SelectedRows[0].Cells["Status"].Value.ToString()), ShipId = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["ShipId"].Value), DateCreate = DateTime.Parse(dataGridView.SelectedRows[0].Cells["DateCreate"].Value.ToString()), }); + var operationResult = _orderLogic.DeliveryOrder(new OrderBindingModel { Id = id, Count = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Count"].Value), Sum = double.Parse(dataGridView.SelectedRows[0].Cells["Sum"].Value.ToString()), Status = Enum.Parse(dataGridView.SelectedRows[0].Cells["Status"].Value.ToString()), ShipId = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["ShipId"].Value), ShipName = dataGridView.SelectedRows[0].Cells["ShipName"].Value.ToString(), DateCreate = DateTime.Parse(dataGridView.SelectedRows[0].Cells["DateCreate"].Value.ToString()), }); if (!operationResult) { throw new Exception("Ошибка при сохранении. Дополнительная информация в логах."); diff --git a/Shipyard/ShipyardContracts/BindingModels/OrderBindingModel.cs b/Shipyard/ShipyardContracts/BindingModels/OrderBindingModel.cs index b46f18b..c3768ef 100644 --- a/Shipyard/ShipyardContracts/BindingModels/OrderBindingModel.cs +++ b/Shipyard/ShipyardContracts/BindingModels/OrderBindingModel.cs @@ -12,6 +12,7 @@ namespace ShipyardContracts.BindingModels { public int Id { get; set; } public int ShipId { get; set; } + public string ShipName { get; set; } public int Count { get; set; } public double Sum { get; set; } public OrderStatus Status { get; set; } = OrderStatus.Неизвестен; diff --git a/Shipyard/ShipyardListImplement»/Models/Order.cs b/Shipyard/ShipyardListImplement»/Models/Order.cs index 0d60465..882e147 100644 --- a/Shipyard/ShipyardListImplement»/Models/Order.cs +++ b/Shipyard/ShipyardListImplement»/Models/Order.cs @@ -16,6 +16,7 @@ namespace ShipyardListImplement.Models { public int Id { get; private set; } public int ShipId { get; private set; } + public string ShipName { get; private set; } public int Count { get; private set; } public double Sum { get; private set; } public OrderStatus Status { get; private set; } = OrderStatus.Неизвестен; @@ -32,6 +33,7 @@ namespace ShipyardListImplement.Models { Id = model.Id, ShipId = model.ShipId, + ShipName = model.ShipName, Count = model.Count, Sum = model.Sum, Status = model.Status, @@ -47,6 +49,7 @@ namespace ShipyardListImplement.Models } Id = model.Id; ShipId = model.ShipId; + ShipName = model.ShipName; Count = model.Count; Sum = model.Sum; Status = model.Status; @@ -57,6 +60,7 @@ namespace ShipyardListImplement.Models { Id = Id, ShipId = ShipId, + ShipName = ShipName, Count = Count, Sum = Sum, Status = Status,