From 5a144131bda8180d84bef9d35a81504cb3abdc68 Mon Sep 17 00:00:00 2001 From: Factorino73 Date: Mon, 11 Mar 2024 04:44:47 +0400 Subject: [PATCH] Fix --- .../BusinessLogics/OrderLogic.cs | 12 ++++++------ AircraftPlant/AircraftPlantView/FormShop.cs | 1 + 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/AircraftPlant/AircraftPlantBusinessLogic/BusinessLogics/OrderLogic.cs b/AircraftPlant/AircraftPlantBusinessLogic/BusinessLogics/OrderLogic.cs index 870f28f..41901c2 100644 --- a/AircraftPlant/AircraftPlantBusinessLogic/BusinessLogics/OrderLogic.cs +++ b/AircraftPlant/AircraftPlantBusinessLogic/BusinessLogics/OrderLogic.cs @@ -184,23 +184,23 @@ namespace AircraftPlantBusinessLogic.BusinessLogics return false; } - if (newStatus == OrderStatus.Готов) + model.Status = newStatus; + + if (newStatus == OrderStatus.Выдан) { - var plane = _planeStorage.GetElement(new PlaneSearchModel { Id = model.PlaneId }); + var plane = _planeStorage.GetElement(new PlaneSearchModel { Id = element.PlaneId }); if (plane == null) { _logger.LogWarning("Status change error. Plane not found"); return false; } - if (!CheckSupply(plane, model.Count)) + if (!CheckSupply(plane, element.Count)) { - _logger.LogWarning("Status change error. Shop doesnt have planes"); + _logger.LogWarning("Status change error. Shop is overflowed"); return false; } } - model.Status = newStatus; - if (model.Status == OrderStatus.Выдан) { model.DateImplement = DateTime.Now; diff --git a/AircraftPlant/AircraftPlantView/FormShop.cs b/AircraftPlant/AircraftPlantView/FormShop.cs index 17e1f14..dc022f6 100644 --- a/AircraftPlant/AircraftPlantView/FormShop.cs +++ b/AircraftPlant/AircraftPlantView/FormShop.cs @@ -111,6 +111,7 @@ namespace AircraftPlantView ShopName = textBoxName.Text, Address = textBoxAddress.Text, DateOpening = dateTimePicker.Value.Date, + ShopPlanes = _shopPlanes, MaxPlanes = Convert.ToInt32(numericUpDownMaxPlanes.Value) }; var operationResult = _id.HasValue ? _logic.Update(model) : _logic.Create(model);