sadsa
This commit is contained in:
parent
b53646627e
commit
7be7815a51
@ -144,7 +144,22 @@ namespace IceCreamShopBusinessLogic.BusinessLogic
|
||||
_logger.LogWarning("Read operation failed");
|
||||
return false;
|
||||
}
|
||||
if (element.Status != status - 1 && status != OrderStatus.Ожидается && element.Status != OrderStatus.Ожидается)
|
||||
if(element.Status == OrderStatus.Ожидается) {
|
||||
if (status != OrderStatus.Готов)
|
||||
{
|
||||
_logger.LogWarning("Status change operation failed");
|
||||
throw new InvalidOperationException("Текущий статус заказа не может быть переведен в выбранный");
|
||||
}
|
||||
}
|
||||
else if(status == OrderStatus.Ожидается)
|
||||
{
|
||||
if (status != OrderStatus.Выполняется)
|
||||
{
|
||||
_logger.LogWarning("Status change operation failed");
|
||||
throw new InvalidOperationException("Текущий статус заказа не может быть переведен в выбранный");
|
||||
}
|
||||
}
|
||||
else if (element.Status != status - 1)
|
||||
{
|
||||
_logger.LogWarning("Status change operation failed");
|
||||
throw new InvalidOperationException("Текущий статус заказа не может быть переведен в выбранный");
|
||||
@ -164,7 +179,7 @@ namespace IceCreamShopBusinessLogic.BusinessLogic
|
||||
_logger.LogWarning("Status update to " + status.ToString() + " operation failed. Document not found.");
|
||||
return false;
|
||||
}
|
||||
if (CheckSupply(icecream, model.Count) == false)
|
||||
if (!CheckSupply(icecream, model.Count))
|
||||
{
|
||||
model.Status = OrderStatus.Ожидается;
|
||||
_orderStorage.Update(model);
|
||||
@ -186,13 +201,10 @@ namespace IceCreamShopBusinessLogic.BusinessLogic
|
||||
}
|
||||
|
||||
public bool FinishOrder(OrderBindingModel model)
|
||||
{
|
||||
lock (locker)
|
||||
{
|
||||
return ChangeStatus(model, OrderStatus.Готов);
|
||||
|
||||
}
|
||||
}
|
||||
public bool TakeOrderInWaiting(OrderBindingModel model)
|
||||
{
|
||||
return ChangeStatus(model, OrderStatus.Ожидается);
|
||||
|
@ -35,6 +35,8 @@ namespace IceCreamShopDatabaseImplement.Implements
|
||||
(!model.ClientId.HasValue || x.ClientId == model.ClientId)
|
||||
&&
|
||||
(!model.Status.HasValue || x.Status == model.Status)
|
||||
&&
|
||||
(!model.ImplementerId.HasValue || x.ImplementerId == model.ImplementerId)
|
||||
)
|
||||
)
|
||||
.Select(x => x.GetViewModel)
|
||||
|
BIN
IceCreamShop/ImplementationExtensions/IceCreamShopContracts.dll
Normal file
BIN
IceCreamShop/ImplementationExtensions/IceCreamShopContracts.dll
Normal file
Binary file not shown.
BIN
IceCreamShop/ImplementationExtensions/IceCreamShopDataModels.dll
Normal file
BIN
IceCreamShop/ImplementationExtensions/IceCreamShopDataModels.dll
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue
Block a user