Шаг 8. Лаба сдана

This commit is contained in:
Кашин Максим 2023-01-31 12:51:03 +04:00
parent 1b1b8ee7bf
commit aa8fe69769
20 changed files with 14 additions and 21 deletions

View File

@ -12,7 +12,6 @@ using PrecastConcretePlantContracts.BusinessLogicsContracts;
using PrecastConcretePlantContracts.SearchModels;
using Microsoft.Extensions.Logging;
namespace PrecastConcretePlantView
{
public partial class FormCreateOrder : Form
@ -109,6 +108,7 @@ namespace PrecastConcretePlantView
var operationResult = _logicO.CreateOrder(new OrderBindingModel
{
ReinforcedId = Convert.ToInt32(ReinforcedComboBox.SelectedValue),
ReinforcedName = ReinforcedComboBox.Text,
Count = Convert.ToInt32(CountTextBox.Text),
Sum = Convert.ToDouble(SumTextBox.Text)
});

View File

@ -99,6 +99,7 @@ namespace PrecastConcretePlantView
{
Id = id,
ReinforcedId = Convert.ToInt32(DataGridView.SelectedRows[0].Cells["ReinforcedId"].Value),
ReinforcedName = DataGridView.SelectedRows[0].Cells["ReinforcedName"].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()),
@ -133,6 +134,7 @@ namespace PrecastConcretePlantView
{
Id = id,
ReinforcedId = Convert.ToInt32(DataGridView.SelectedRows[0].Cells["ReinforcedId"].Value),
ReinforcedName = DataGridView.SelectedRows[0].Cells["ReinforcedName"].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()),
@ -167,6 +169,7 @@ namespace PrecastConcretePlantView
{
Id = id,
ReinforcedId = Convert.ToInt32(DataGridView.SelectedRows[0].Cells["ReinforcedId"].Value),
ReinforcedName = DataGridView.SelectedRows[0].Cells["ReinforcedName"].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()),

View File

@ -13,7 +13,6 @@ using PrecastConcretePlantContracts.SearchModels;
using PrecastConcretePlantDataModels.Models;
using Microsoft.Extensions.Logging;
namespace PrecastConcretePlantView
{
public partial class FormReinforced : Form

View File

@ -10,7 +10,6 @@ using PrecastConcretePlantContracts.StoragesContracts;
using PrecastConcretePlantContracts.ViewModels;
using Microsoft.Extensions.Logging;
namespace PrecastConcretePlantBusinessLogic.BusinessLogic
{
public class ComponentLogic : IComponentLogic

View File

@ -70,12 +70,10 @@ namespace PrecastConcretePlantBusinessLogic.BusinessLogic
return true;
}
public bool TakeOrderInWork(OrderBindingModel model)
{
return StatusUpdate(model, OrderStatus.Выполняется);
}
public bool DeliveryOrder(OrderBindingModel model)
{
return StatusUpdate(model, OrderStatus.Готов);
@ -85,7 +83,6 @@ namespace PrecastConcretePlantBusinessLogic.BusinessLogic
{
return StatusUpdate(model, OrderStatus.Выдан);
}
public List<OrderViewModel>? ReadList(OrderSearchModel? model)
{
_logger.LogInformation("Order. OrderId:{Id}", model?.Id);
@ -101,7 +98,6 @@ namespace PrecastConcretePlantBusinessLogic.BusinessLogic
_logger.LogInformation("ReadList. Count:{Count}", list.Count);
return list;
}
private void CheckModel(OrderBindingModel model, bool withParams = true)
{
if (model == null)

View File

@ -39,7 +39,6 @@ namespace PrecastConcretePlantBusinessLogic
return true;
}
public bool Delete(ReinforcedBindingModel model)
{
CheckModel(model, false);
@ -54,7 +53,6 @@ namespace PrecastConcretePlantBusinessLogic
return true;
}
public ReinforcedViewModel? ReadElement(ReinforcedSearchModel model)
{
if (model == null)

View File

@ -5,7 +5,6 @@ using System.Text;
using System.Threading.Tasks;
using PrecastConcretePlantDataModels.Models;
namespace PrecastConcretePlantContracts.BindingModels
{
public class ComponentBindingModel : IComponentModel

View File

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

View File

@ -7,7 +7,6 @@ using PrecastConcretePlantContracts.BindingModels;
using PrecastConcretePlantContracts.SearchModels;
using PrecastConcretePlantContracts.ViewModels;
namespace PrecastConcretePlantContracts.BusinessLogicsContracts
{
public interface IComponentLogic

View File

@ -7,7 +7,6 @@ using PrecastConcretePlantContracts.BindingModels;
using PrecastConcretePlantContracts.SearchModels;
using PrecastConcretePlantContracts.ViewModels;
namespace PrecastConcretePlantContracts.BusinessLogicsContracts
{
public interface IReinforcedLogic

View File

@ -7,7 +7,6 @@ using PrecastConcretePlantContracts.BindingModels;
using PrecastConcretePlantContracts.SearchModels;
using PrecastConcretePlantContracts.ViewModels;
namespace PrecastConcretePlantContracts.StoragesContracts
{
public interface IComponentStorage

View File

@ -9,7 +9,6 @@ using PrecastConcretePlantContracts.ViewModels;
namespace PrecastConcretePlantContracts.StoragesContracts
{
public interface IReinforcedStorage
{
List<ReinforcedViewModel> GetFullList();

View File

@ -6,7 +6,6 @@ using System.Threading.Tasks;
using PrecastConcretePlantDataModels.Models;
using System.ComponentModel;
namespace PrecastConcretePlantContracts.ViewModels
{
public class ComponentViewModel : IComponentModel

View File

@ -7,14 +7,13 @@ using PrecastConcretePlantDataModels.Enums;
using PrecastConcretePlantDataModels.Models;
using System.ComponentModel;
namespace PrecastConcretePlantContracts.ViewModels
{
public class OrderViewModel : IOrderModel
{
public int ReinforcedId { get; set; }
[DisplayName("Номер")]
public int Id { get; set; }
public int ReinforcedId { get; set; }
[DisplayName("Изделие")]
public string ReinforcedName { get; set; } = string.Empty;
[DisplayName("Количество")]
@ -27,5 +26,7 @@ namespace PrecastConcretePlantContracts.ViewModels
public DateTime DateCreate { get; set; } = DateTime.Now;
[DisplayName("Дата выполнения")]
public DateTime? DateImplement { get; set; }
}
}

View File

@ -6,7 +6,6 @@ using System.Threading.Tasks;
using PrecastConcretePlantDataModels.Models;
using System.ComponentModel;
namespace PrecastConcretePlantContracts.ViewModels
{
public class ReinforcedViewModel : IReinforcedModel

View File

@ -10,6 +10,7 @@ namespace PrecastConcretePlantDataModels.Enums
public interface IOrderModel : IId
{
int ReinforcedId { get; }
string ReinforcedName { get; }
int Count { get; }
double Sum { get; }
OrderStatus Status { get; }

View File

@ -9,7 +9,6 @@ using PrecastConcretePlantContracts.StoragesContracts;
using PrecastConcretePlantContracts.ViewModels;
using PrecastConcretePlantListImplement.Models;
namespace PrecastConcretePlantListImplement.Implements
{
public class ComponentStorage : IComponentStorage

View File

@ -7,7 +7,6 @@ using PrecastConcretePlantContracts.BindingModels;
using PrecastConcretePlantContracts.ViewModels;
using PrecastConcretePlantDataModels.Models;
namespace PrecastConcretePlantListImplement.Models
{
public class Component : IComponentModel

View File

@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using PrecastConcretePlantContracts.BindingModels;
@ -13,6 +14,7 @@ namespace PrecastConcretePlantListImplement.Models
public class Order : IOrderModel
{
public int ReinforcedId { get; private set; }
public string ReinforcedName { get; private set; }
public int Count { get; private set; }
@ -36,6 +38,7 @@ namespace PrecastConcretePlantListImplement.Models
{
Id = model.Id,
ReinforcedId = model.ReinforcedId,
ReinforcedName = model.ReinforcedName,
Count = model.Count,
Sum = model.Sum,
Status = model.Status,
@ -51,6 +54,7 @@ namespace PrecastConcretePlantListImplement.Models
return;
}
ReinforcedId = model.ReinforcedId;
ReinforcedName = model.ReinforcedName;
Count = model.Count;
Sum = model.Sum;
Status = model.Status;
@ -62,6 +66,7 @@ namespace PrecastConcretePlantListImplement.Models
{
Id = Id,
ReinforcedId = ReinforcedId,
ReinforcedName = ReinforcedName,
Count = Count,
Sum = Sum,
Status = Status,

View File

@ -7,7 +7,6 @@ using PrecastConcretePlantContracts.BindingModels;
using PrecastConcretePlantContracts.ViewModels;
using PrecastConcretePlantDataModels.Models;
namespace PrecastConcretePlantListImplement.Models
{
public class Reinforced : IReinforcedModel