This commit is contained in:
parent 5d4ee306ce
commit 5a144131bd
2 changed files with 7 additions and 6 deletions

View File

@ -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;

View File

@ -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);