From 8571a9a7478366854cae7679b893212d923ddcf1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=94=D0=B0=D0=BD=D0=B8=D1=8F=D1=80=20=D0=90=D0=B3=D0=BB?= =?UTF-8?q?=D0=B8=D1=83=D0=BB=D0=BB=D0=BE=D0=B2?= Date: Sun, 5 Feb 2023 22:03:41 +0400 Subject: [PATCH] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D1=8B=20=D0=B7=D0=B0=D0=BA=D0=B0=D0=B7=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ConfectionaryBusinessLogic/OrderLogic.cs | 8 +++++++- ConfectionaryListImplement/OrderStorage.cs | 20 +++++++++++++++++--- Confectionery/FormMain.cs | 4 ++-- Confectionery/FormViewPastry.cs | 1 + 4 files changed, 27 insertions(+), 6 deletions(-) diff --git a/ConfectionaryBusinessLogic/OrderLogic.cs b/ConfectionaryBusinessLogic/OrderLogic.cs index b0de921..441332b 100644 --- a/ConfectionaryBusinessLogic/OrderLogic.cs +++ b/ConfectionaryBusinessLogic/OrderLogic.cs @@ -39,7 +39,13 @@ namespace ConfectioneryBusinessLogic.BusinessLogics 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 FinishOrder(OrderBindingModel model) + { + var res = SetOrderStatus(model, OrderStatus.Готов); + if (res) + model.DateImplement = DateTime.Now; + return res; + } public List? ReadList(OrderSearchModel? model) { diff --git a/ConfectionaryListImplement/OrderStorage.cs b/ConfectionaryListImplement/OrderStorage.cs index 1bcd0ca..d6a964e 100644 --- a/ConfectionaryListImplement/OrderStorage.cs +++ b/ConfectionaryListImplement/OrderStorage.cs @@ -38,7 +38,7 @@ namespace ConfectioneryListImplement { if (model.Id.HasValue && order.Id == model.Id) { - return order.GetViewModel; + return GetViewModel(order); } } return null; @@ -55,7 +55,7 @@ namespace ConfectioneryListImplement { if (order.Id == model.Id) { - return new() { order.GetViewModel }; + return new() { GetViewModel(order) }; } } return new(); @@ -66,7 +66,7 @@ namespace ConfectioneryListImplement 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 ConfectioneryListImplement } return null; } + + private OrderViewModel GetViewModel(Order model) + { + var res = model.GetViewModel; + foreach (var pastry in _source.Pastry) + { + if (pastry.Id == model.PastryId) + { + res.PastryName = pastry.PastryName; + break; + } + } + return res; + } } } diff --git a/Confectionery/FormMain.cs b/Confectionery/FormMain.cs index 628ea63..b75e953 100644 --- a/Confectionery/FormMain.cs +++ b/Confectionery/FormMain.cs @@ -30,8 +30,8 @@ namespace ConfectioneryView { dataGridView.DataSource = list; dataGridView.Columns["Id"].Visible = false; - /*dataGridView.Columns["PastryName"].AutoSizeMode = - DataGridViewAutoSizeColumnMode.Fill;*/ + dataGridView.Columns["PastryName"].AutoSizeMode = + DataGridViewAutoSizeColumnMode.Fill; } _logger.LogInformation(" "); } diff --git a/Confectionery/FormViewPastry.cs b/Confectionery/FormViewPastry.cs index 6d82947..c622d3f 100644 --- a/Confectionery/FormViewPastry.cs +++ b/Confectionery/FormViewPastry.cs @@ -36,6 +36,7 @@ namespace ConfectioneryView { dataGridView.DataSource = list; dataGridView.Columns["Id"].Visible = false; + dataGridView.Columns["PastryComponents"].Visible = false; dataGridView.Columns["PastryName"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; }