готова

This commit is contained in:
Shtyrkin_Egor 2024-02-07 09:25:10 +04:00
parent 0332135213
commit 30f244c552
3 changed files with 10 additions and 5 deletions

View File

@ -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("Ошибка при сохранении. Дополнительная информация в логах.");

View File

@ -5,7 +5,7 @@
autoReload="true" internalLogLevel="Info">
<targets>
<target xsi:type="File" name="tofile" fileName="${basedir}/Logs/log-${shortdate}.log" />
<target xsi:type="File" name="tofile" fileName="${basedir}/log-${shortdate}.log" />
</targets>
<rules>

View File

@ -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
@ -130,6 +130,10 @@ namespace FishFactoryBusinessLogic.BusinessLogic
if (model.Sum <= 0)
{
throw new ArgumentNullException("Цена заказа должна быть больше 0", nameof(model.Sum));
}
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);
}