Доработки
This commit is contained in:
parent
ed13752309
commit
1bebeeae57
@ -95,8 +95,30 @@ namespace IceCreamBusinessLogic.BusinessLogics
|
|||||||
_logger.LogInformation("Order. OrderID:{Id}.Sum:{ Sum}. DocumentId: { DocumentId}", model.Id, model.Sum, model.IceCreamId);
|
_logger.LogInformation("Order. OrderID:{Id}.Sum:{ Sum}. DocumentId: { DocumentId}", model.Id, model.Sum, model.IceCreamId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool SetNewStatus(OrderBindingModel model, OrderStatus newStatus)
|
public bool SetNewStatus(OrderBindingModel orderModel, OrderStatus newStatus)
|
||||||
{
|
{
|
||||||
|
var viewModel = _orderStorage.GetElement(new OrderSearchModel
|
||||||
|
{
|
||||||
|
Id = orderModel.Id
|
||||||
|
});
|
||||||
|
|
||||||
|
if (viewModel == null)
|
||||||
|
{
|
||||||
|
_logger.LogWarning("Order model not found");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
OrderBindingModel model = new OrderBindingModel
|
||||||
|
{
|
||||||
|
Id = viewModel.Id,
|
||||||
|
IceCreamId = viewModel.IceCreamId,
|
||||||
|
IceCreamName = viewModel.IceCreamName,
|
||||||
|
Status = viewModel.Status,
|
||||||
|
DateCreate = viewModel.DateCreate,
|
||||||
|
DateImplement = viewModel.DateImplement,
|
||||||
|
Count = viewModel.Count,
|
||||||
|
Sum = viewModel.Sum
|
||||||
|
};
|
||||||
CheckModel(model);
|
CheckModel(model);
|
||||||
if (model.Status + 1 != newStatus)
|
if (model.Status + 1 != newStatus)
|
||||||
{
|
{
|
||||||
|
@ -90,12 +90,6 @@ namespace IceCreamShopView
|
|||||||
var operationResult = _orderLogic.TakeOrderInWork(new OrderBindingModel
|
var operationResult = _orderLogic.TakeOrderInWork(new OrderBindingModel
|
||||||
{
|
{
|
||||||
Id = id,
|
Id = id,
|
||||||
IceCreamId = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["IceCreamId"].Value),
|
|
||||||
IceCreamName = dataGridView.SelectedRows[0].Cells["IceCreamName"].Value.ToString(),
|
|
||||||
Status = Enum.Parse<OrderStatus>(dataGridView.SelectedRows[0].Cells["Status"].Value.ToString()),
|
|
||||||
Count = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Count"].Value),
|
|
||||||
Sum = double.Parse(dataGridView.SelectedRows[0].Cells["Sum"].Value.ToString()),
|
|
||||||
DateCreate = DateTime.Parse(dataGridView.SelectedRows[0].Cells["DateCreate"].Value.ToString()),
|
|
||||||
});
|
});
|
||||||
if (!operationResult)
|
if (!operationResult)
|
||||||
{
|
{
|
||||||
@ -123,12 +117,6 @@ namespace IceCreamShopView
|
|||||||
var operationResult = _orderLogic.DeliveryOrder(new OrderBindingModel
|
var operationResult = _orderLogic.DeliveryOrder(new OrderBindingModel
|
||||||
{
|
{
|
||||||
Id = id,
|
Id = id,
|
||||||
IceCreamId = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["IceCreamId"].Value),
|
|
||||||
IceCreamName = dataGridView.SelectedRows[0].Cells["IceCreamName"].Value.ToString(),
|
|
||||||
Status = Enum.Parse<OrderStatus>(dataGridView.SelectedRows[0].Cells["Status"].Value.ToString()),
|
|
||||||
Count = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Count"].Value),
|
|
||||||
Sum = double.Parse(dataGridView.SelectedRows[0].Cells["Sum"].Value.ToString()),
|
|
||||||
DateCreate = DateTime.Parse(dataGridView.SelectedRows[0].Cells["DateCreate"].Value.ToString()),
|
|
||||||
});
|
});
|
||||||
if (!operationResult)
|
if (!operationResult)
|
||||||
{
|
{
|
||||||
@ -155,12 +143,6 @@ namespace IceCreamShopView
|
|||||||
var operationResult = _orderLogic.FinishOrder(new OrderBindingModel
|
var operationResult = _orderLogic.FinishOrder(new OrderBindingModel
|
||||||
{
|
{
|
||||||
Id = id,
|
Id = id,
|
||||||
IceCreamId = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["IceCreamId"].Value),
|
|
||||||
IceCreamName = dataGridView.SelectedRows[0].Cells["IceCreamName"].Value.ToString(),
|
|
||||||
Status = Enum.Parse<OrderStatus>(dataGridView.SelectedRows[0].Cells["Status"].Value.ToString()),
|
|
||||||
Count = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Count"].Value),
|
|
||||||
Sum = double.Parse(dataGridView.SelectedRows[0].Cells["Sum"].Value.ToString()),
|
|
||||||
DateCreate = DateTime.Parse(dataGridView.SelectedRows[0].Cells["DateCreate"].Value.ToString()),
|
|
||||||
});
|
});
|
||||||
if (!operationResult)
|
if (!operationResult)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user