Лабораторная доделана

This commit is contained in:
Павел Путилин 2023-02-06 22:08:55 +04:00
parent 03d743635a
commit ef03486ce2
3 changed files with 28 additions and 11 deletions

View File

@ -3,15 +3,7 @@ using PrecastConcretePlant;
using PrecastConcretePlantContracts.BindingModels; using PrecastConcretePlantContracts.BindingModels;
using PrecastConcretePlantContracts.BusinessLogicsContracts; using PrecastConcretePlantContracts.BusinessLogicsContracts;
using PrecastConcretePlantDataModels.Enums; using PrecastConcretePlantDataModels.Enums;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace PrecastConcretePlantView namespace PrecastConcretePlantView
{ {
@ -38,6 +30,8 @@ namespace PrecastConcretePlantView
{ {
dataGridView.DataSource = list; dataGridView.DataSource = list;
dataGridView.Columns["Id"].Visible = false; dataGridView.Columns["Id"].Visible = false;
dataGridView.Columns["ReinforcedName"].AutoSizeMode =
DataGridViewAutoSizeColumnMode.Fill;
} }
_logger.LogInformation("Загрузка заказов"); _logger.LogInformation("Загрузка заказов");
} }

View File

@ -37,8 +37,12 @@ namespace PrecastConcretePlantBusinessLogic.BusinessLogic
} }
public bool TakeOrderInWork(OrderBindingModel model) => SetOrderStatus(model, OrderStatus.Выполняется); 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) => SetOrderStatus(model, OrderStatus.Готов);
public bool DeliveryOrder(OrderBindingModel model)
{
model.DateImplement = DateTime.Now;
return SetOrderStatus(model, OrderStatus.Выдан);
}
public List<OrderViewModel>? ReadList(OrderSearchModel? model) public List<OrderViewModel>? ReadList(OrderSearchModel? model)
{ {
@ -92,6 +96,11 @@ namespace PrecastConcretePlantBusinessLogic.BusinessLogic
nameof(vmodel)); nameof(vmodel));
} }
model.Status = orderStatus; model.Status = orderStatus;
model.Status = orderStatus;
model.DateCreate = vmodel.DateCreate;
model.ReinforcedId = vmodel.ReinforcedId;
model.Sum = vmodel.Sum;
model.Count = vmodel.Count;
if (_orderStorage.Update(model) == null) if (_orderStorage.Update(model) == null)
{ {
_logger.LogWarning("Update operation failed"); _logger.LogWarning("Update operation failed");

View File

@ -66,7 +66,7 @@ namespace PrecastConcretePlantListImplement
var result = new List<OrderViewModel>(); var result = new List<OrderViewModel>();
foreach (var order in _source.Orders) foreach (var order in _source.Orders)
{ {
result.Add(order.GetViewModel); result.Add(GetViewModel(order));
} }
return result; return result;
} }
@ -102,5 +102,19 @@ namespace PrecastConcretePlantListImplement
} }
return null; return null;
} }
private OrderViewModel GetViewModel(Order model)
{
var res = model.GetViewModel;
foreach (var pastry in _source.Reinforced)
{
if (pastry.Id == model.ReinforcedId)
{
res.ReinforcedName = pastry.ReinforcedName;
break;
}
}
return res;
}
} }
} }