diff --git a/PrecastConcretePlant/PrecastConcretePlant/FormMain.cs b/PrecastConcretePlant/PrecastConcretePlant/FormMain.cs index f2fae29..4f024b5 100644 --- a/PrecastConcretePlant/PrecastConcretePlant/FormMain.cs +++ b/PrecastConcretePlant/PrecastConcretePlant/FormMain.cs @@ -3,15 +3,7 @@ using PrecastConcretePlant; using PrecastConcretePlantContracts.BindingModels; using PrecastConcretePlantContracts.BusinessLogicsContracts; using PrecastConcretePlantDataModels.Enums; -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Forms; + namespace PrecastConcretePlantView { @@ -38,6 +30,8 @@ namespace PrecastConcretePlantView { dataGridView.DataSource = list; dataGridView.Columns["Id"].Visible = false; + dataGridView.Columns["ReinforcedName"].AutoSizeMode = + DataGridViewAutoSizeColumnMode.Fill; } _logger.LogInformation("Загрузка заказов"); } diff --git a/PrecastConcretePlant/PrecastConcretePlantBusinessLogic/OrderLogic.cs b/PrecastConcretePlant/PrecastConcretePlantBusinessLogic/OrderLogic.cs index ba445b6..edba0bf 100644 --- a/PrecastConcretePlant/PrecastConcretePlantBusinessLogic/OrderLogic.cs +++ b/PrecastConcretePlant/PrecastConcretePlantBusinessLogic/OrderLogic.cs @@ -37,8 +37,12 @@ namespace PrecastConcretePlantBusinessLogic.BusinessLogic } public bool TakeOrderInWork(OrderBindingModel model) => SetOrderStatus(model, OrderStatus.Выполняется); - public bool DeliveryOrder(OrderBindingModel model) => SetOrderStatus(model, OrderStatus.Выдан); public bool FinishOrder(OrderBindingModel model) => SetOrderStatus(model, OrderStatus.Готов); + public bool DeliveryOrder(OrderBindingModel model) + { + model.DateImplement = DateTime.Now; + return SetOrderStatus(model, OrderStatus.Выдан); + } public List? ReadList(OrderSearchModel? model) { @@ -92,6 +96,11 @@ namespace PrecastConcretePlantBusinessLogic.BusinessLogic nameof(vmodel)); } model.Status = orderStatus; + model.Status = orderStatus; + model.DateCreate = vmodel.DateCreate; + model.ReinforcedId = vmodel.ReinforcedId; + model.Sum = vmodel.Sum; + model.Count = vmodel.Count; if (_orderStorage.Update(model) == null) { _logger.LogWarning("Update operation failed"); diff --git a/PrecastConcretePlant/PrecastConcretePlantListImplement/OrderStorage.cs b/PrecastConcretePlant/PrecastConcretePlantListImplement/OrderStorage.cs index 9edba7e..653873e 100644 --- a/PrecastConcretePlant/PrecastConcretePlantListImplement/OrderStorage.cs +++ b/PrecastConcretePlant/PrecastConcretePlantListImplement/OrderStorage.cs @@ -66,7 +66,7 @@ namespace PrecastConcretePlantListImplement var result = new List(); foreach (var order in _source.Orders) { - result.Add(order.GetViewModel); + result.Add(GetViewModel(order)); } return result; } @@ -102,5 +102,19 @@ namespace PrecastConcretePlantListImplement } return null; } + + private OrderViewModel GetViewModel(Order model) + { + var res = model.GetViewModel; + foreach (var pastry in _source.Reinforced) + { + if (pastry.Id == model.ReinforcedId) + { + res.ReinforcedName = pastry.ReinforcedName; + break; + } + } + return res; + } } }