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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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