LabWork01_Base: Исправлена логика изменения статуса
This commit is contained in:
parent
fdff71ec88
commit
b54bfe2d87
@ -89,13 +89,7 @@ namespace AutomobilePlant
|
|||||||
{
|
{
|
||||||
var operationResult = _orderLogic.TakeOrderInWork(new OrderBindingModel
|
var operationResult = _orderLogic.TakeOrderInWork(new OrderBindingModel
|
||||||
{
|
{
|
||||||
Id = id,
|
Id = id
|
||||||
CarId = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["CarId"].Value),
|
|
||||||
CarName = dataGridView.SelectedRows[0].Cells["CarName"].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)
|
||||||
{
|
{
|
||||||
@ -122,13 +116,7 @@ namespace AutomobilePlant
|
|||||||
{
|
{
|
||||||
var operationResult = _orderLogic.DeliveryOrder(new OrderBindingModel
|
var operationResult = _orderLogic.DeliveryOrder(new OrderBindingModel
|
||||||
{
|
{
|
||||||
Id = id,
|
Id = id
|
||||||
CarId = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["CarId"].Value),
|
|
||||||
CarName = dataGridView.SelectedRows[0].Cells["CarName"].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)
|
||||||
{
|
{
|
||||||
@ -154,13 +142,7 @@ namespace AutomobilePlant
|
|||||||
{
|
{
|
||||||
var operationResult = _orderLogic.FinishOrder(new OrderBindingModel
|
var operationResult = _orderLogic.FinishOrder(new OrderBindingModel
|
||||||
{
|
{
|
||||||
Id = id,
|
Id = id
|
||||||
CarId = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["CarId"].Value),
|
|
||||||
CarName = dataGridView.SelectedRows[0].Cells["CarName"].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)
|
||||||
{
|
{
|
||||||
|
@ -42,8 +42,31 @@ namespace AutomobilePlantBusinessLogic.BusinessLogics
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool StatusUpdate(OrderBindingModel model, OrderStatus newStatus)
|
public bool StatusUpdate(OrderBindingModel rawModel, OrderStatus newStatus)
|
||||||
{
|
{
|
||||||
|
var viewModel = _orderStorage.GetElement(new OrderSearchModel
|
||||||
|
{
|
||||||
|
Id = rawModel.Id
|
||||||
|
});
|
||||||
|
|
||||||
|
if (viewModel == null)
|
||||||
|
{
|
||||||
|
_logger.LogWarning("Order model not found");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
OrderBindingModel model = new OrderBindingModel
|
||||||
|
{
|
||||||
|
Id = viewModel.Id,
|
||||||
|
CarId = viewModel.CarId,
|
||||||
|
CarName = viewModel.CarName,
|
||||||
|
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)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user