diff --git a/FishFactory/FormMain.cs b/FishFactory/FormMain.cs
index 4c661cf..b8c0b8f 100644
--- a/FishFactory/FormMain.cs
+++ b/FishFactory/FormMain.cs
@@ -65,7 +65,6 @@ namespace FishFactory.Forms
form.ShowDialog();
}
}
-
private void buttonCreateOrder_Click(object sender, EventArgs e)
{
var service = Program.ServiceProvider?.GetService(typeof(FormCreateOrder));
@@ -84,7 +83,9 @@ namespace FishFactory.Forms
try
{
var operationResult = _orderLogic.TakeOrderInWork(new OrderBindingModel
- { Id = id });
+ {
+ Id = id,
+ });
if (!operationResult)
{
throw new Exception("Ошибка при сохранении. Дополнительная информация в логах.");
diff --git a/FishFactory/nlog.config b/FishFactory/nlog.config
index 40d8642..af70d20 100644
--- a/FishFactory/nlog.config
+++ b/FishFactory/nlog.config
@@ -5,7 +5,7 @@
autoReload="true" internalLogLevel="Info">
-
+
diff --git a/FishFactoryBusinessLogic/BusinessLogic/OrderLogic.cs b/FishFactoryBusinessLogic/BusinessLogic/OrderLogic.cs
index 3df114c..9ea6392 100644
--- a/FishFactoryBusinessLogic/BusinessLogic/OrderLogic.cs
+++ b/FishFactoryBusinessLogic/BusinessLogic/OrderLogic.cs
@@ -75,7 +75,7 @@ namespace FishFactoryBusinessLogic.BusinessLogic
public bool ToNextStatus(OrderBindingModel model, OrderStatus orderStatus)
{
- CheckModel(model);
+ CheckModel(model, false);
var element = _orderStorage.GetElement(new OrderSearchModel()
{
Id = model.Id
@@ -131,7 +131,11 @@ namespace FishFactoryBusinessLogic.BusinessLogic
{
throw new ArgumentNullException("Цена заказа должна быть больше 0", nameof(model.Sum));
}
- _logger.LogInformation("Canned. CannedId:{CannedId}.Count:{Count}.Sum:{Sum}Id:{Id}", model.CannedId, model.Count, model.Sum, model.Id);
+ if (model.DateImplement.HasValue && model.DateImplement < model.DateCreate)
+ {
+ throw new ArithmeticException($"Дата выдачи заказа {model.DateImplement} должна быть позже даты его создания {model.DateCreate}");
+ }
+ _logger.LogInformation("Canned. CannedId:{CannedId}.Count:{Count}.Sum:{Sum}Id:{Id}", model.CannedId, model.Count, model.Sum, model.Id);
}
}
}