Исправлены заказы

This commit is contained in:
Данияр Аглиуллов 2023-02-05 22:03:41 +04:00
parent 241e701722
commit 8571a9a747
4 changed files with 27 additions and 6 deletions

View File

@ -39,7 +39,13 @@ namespace ConfectioneryBusinessLogic.BusinessLogics
public bool TakeOrderInWork(OrderBindingModel model) => SetOrderStatus(model, OrderStatus.Выполняется);
public bool DeliveryOrder(OrderBindingModel model) => SetOrderStatus(model, OrderStatus.Выдан);
public bool FinishOrder(OrderBindingModel model) => SetOrderStatus(model, OrderStatus.Готов);
public bool FinishOrder(OrderBindingModel model)
{
var res = SetOrderStatus(model, OrderStatus.Готов);
if (res)
model.DateImplement = DateTime.Now;
return res;
}
public List<OrderViewModel>? ReadList(OrderSearchModel? model)
{

View File

@ -38,7 +38,7 @@ namespace ConfectioneryListImplement
{
if (model.Id.HasValue && order.Id == model.Id)
{
return order.GetViewModel;
return GetViewModel(order);
}
}
return null;
@ -55,7 +55,7 @@ namespace ConfectioneryListImplement
{
if (order.Id == model.Id)
{
return new() { order.GetViewModel };
return new() { GetViewModel(order) };
}
}
return new();
@ -66,7 +66,7 @@ namespace ConfectioneryListImplement
var result = new List<OrderViewModel>();
foreach (var order in _source.Orders)
{
result.Add(order.GetViewModel);
result.Add(GetViewModel(order));
}
return result;
}
@ -102,5 +102,19 @@ namespace ConfectioneryListImplement
}
return null;
}
private OrderViewModel GetViewModel(Order model)
{
var res = model.GetViewModel;
foreach (var pastry in _source.Pastry)
{
if (pastry.Id == model.PastryId)
{
res.PastryName = pastry.PastryName;
break;
}
}
return res;
}
}
}

View File

@ -30,8 +30,8 @@ namespace ConfectioneryView
{
dataGridView.DataSource = list;
dataGridView.Columns["Id"].Visible = false;
/*dataGridView.Columns["PastryName"].AutoSizeMode =
DataGridViewAutoSizeColumnMode.Fill;*/
dataGridView.Columns["PastryName"].AutoSizeMode =
DataGridViewAutoSizeColumnMode.Fill;
}
_logger.LogInformation("Çàãðóçêà çàêàçîâ");
}

View File

@ -36,6 +36,7 @@ namespace ConfectioneryView
{
dataGridView.DataSource = list;
dataGridView.Columns["Id"].Visible = false;
dataGridView.Columns["PastryComponents"].Visible = false;
dataGridView.Columns["PastryName"].AutoSizeMode =
DataGridViewAutoSizeColumnMode.Fill;
}