This commit is contained in:
Павел Сорокин 2023-02-07 13:13:16 +04:00
parent 62ac8eeee0
commit c9752877f1
4 changed files with 9 additions and 3 deletions

View File

@ -99,6 +99,7 @@ namespace ShipyardView
var operationResult = _logicO.CreateOrder(new OrderBindingModel
{
ShipId = Convert.ToInt32(ComboBoxShips.SelectedValue),
ShipName = ComboBoxShips.Text,
Count = Convert.ToInt32(TextBoxCount.Text),
Sum = Convert.ToDouble(TextBoxSum.Text)
});

View File

@ -87,7 +87,7 @@ namespace ShipyardView
_logger.LogInformation("Заказ №{id}. Меняется статус на 'В работе'", id);
try
{
var operationResult = _orderLogic.TakeOrderInWork(new OrderBindingModel{ Id = id , Count = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Count"].Value), Sum = double.Parse(dataGridView.SelectedRows[0].Cells["Sum"].Value.ToString()), Status = Enum.Parse<OrderStatus>(dataGridView.SelectedRows[0].Cells["Status"].Value.ToString()), ShipId = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["ShipId"].Value), DateCreate = DateTime.Parse(dataGridView.SelectedRows[0].Cells["DateCreate"].Value.ToString()), });
var operationResult = _orderLogic.TakeOrderInWork(new OrderBindingModel{ Id = id , Count = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Count"].Value), Sum = double.Parse(dataGridView.SelectedRows[0].Cells["Sum"].Value.ToString()), Status = Enum.Parse<OrderStatus>(dataGridView.SelectedRows[0].Cells["Status"].Value.ToString()), ShipId = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["ShipId"].Value), ShipName = dataGridView.SelectedRows[0].Cells["ShipName"].Value.ToString(),DateCreate = DateTime.Parse(dataGridView.SelectedRows[0].Cells["DateCreate"].Value.ToString()), });
if (!operationResult)
{
throw new Exception("Ошибка при сохранении. Дополнительная информация в логах.");
@ -111,7 +111,7 @@ namespace ShipyardView
_logger.LogInformation("Заказ №{id}. Меняется статус на 'Готов'",id);
try
{
var operationResult = _orderLogic.FinishOrder(new OrderBindingModel { Id = id, Count = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Count"].Value), Sum = double.Parse(dataGridView.SelectedRows[0].Cells["Sum"].Value.ToString()), Status = Enum.Parse<OrderStatus>(dataGridView.SelectedRows[0].Cells["Status"].Value.ToString()), ShipId = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["ShipId"].Value), DateCreate = DateTime.Parse(dataGridView.SelectedRows[0].Cells["DateCreate"].Value.ToString()), });
var operationResult = _orderLogic.FinishOrder(new OrderBindingModel { Id = id, Count = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Count"].Value), Sum = double.Parse(dataGridView.SelectedRows[0].Cells["Sum"].Value.ToString()), Status = Enum.Parse<OrderStatus>(dataGridView.SelectedRows[0].Cells["Status"].Value.ToString()), ShipId = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["ShipId"].Value), ShipName = dataGridView.SelectedRows[0].Cells["ShipName"].Value.ToString(), DateCreate = DateTime.Parse(dataGridView.SelectedRows[0].Cells["DateCreate"].Value.ToString()), });
if (!operationResult)
{
throw new Exception("Ошибка при сохранении.Дополнительная информация в логах.");
@ -134,7 +134,7 @@ namespace ShipyardView
_logger.LogInformation("Заказ №{id}. Меняется статус на 'Выдан'",id);
try
{
var operationResult = _orderLogic.DeliveryOrder(new OrderBindingModel { Id = id, Count = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Count"].Value), Sum = double.Parse(dataGridView.SelectedRows[0].Cells["Sum"].Value.ToString()), Status = Enum.Parse<OrderStatus>(dataGridView.SelectedRows[0].Cells["Status"].Value.ToString()), ShipId = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["ShipId"].Value), DateCreate = DateTime.Parse(dataGridView.SelectedRows[0].Cells["DateCreate"].Value.ToString()), });
var operationResult = _orderLogic.DeliveryOrder(new OrderBindingModel { Id = id, Count = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Count"].Value), Sum = double.Parse(dataGridView.SelectedRows[0].Cells["Sum"].Value.ToString()), Status = Enum.Parse<OrderStatus>(dataGridView.SelectedRows[0].Cells["Status"].Value.ToString()), ShipId = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["ShipId"].Value), ShipName = dataGridView.SelectedRows[0].Cells["ShipName"].Value.ToString(), DateCreate = DateTime.Parse(dataGridView.SelectedRows[0].Cells["DateCreate"].Value.ToString()), });
if (!operationResult)
{
throw new Exception("Ошибка при сохранении. Дополнительная информация в логах.");

View File

@ -12,6 +12,7 @@ namespace ShipyardContracts.BindingModels
{
public int Id { get; set; }
public int ShipId { get; set; }
public string ShipName { get; set; }
public int Count { get; set; }
public double Sum { get; set; }
public OrderStatus Status { get; set; } = OrderStatus.Неизвестен;

View File

@ -16,6 +16,7 @@ namespace ShipyardListImplement.Models
{
public int Id { get; private set; }
public int ShipId { get; private set; }
public string ShipName { get; private set; }
public int Count { get; private set; }
public double Sum { get; private set; }
public OrderStatus Status { get; private set; } = OrderStatus.Неизвестен;
@ -32,6 +33,7 @@ namespace ShipyardListImplement.Models
{
Id = model.Id,
ShipId = model.ShipId,
ShipName = model.ShipName,
Count = model.Count,
Sum = model.Sum,
Status = model.Status,
@ -47,6 +49,7 @@ namespace ShipyardListImplement.Models
}
Id = model.Id;
ShipId = model.ShipId;
ShipName = model.ShipName;
Count = model.Count;
Sum = model.Sum;
Status = model.Status;
@ -57,6 +60,7 @@ namespace ShipyardListImplement.Models
{
Id = Id,
ShipId = ShipId,
ShipName = ShipName,
Count = Count,
Sum = Sum,
Status = Status,