From ca80eab8a6bb37b0d96086df9e5cba45c7ccf0c0 Mon Sep 17 00:00:00 2001 From: AparyanLuiza Date: Fri, 16 Feb 2024 00:07:37 +0400 Subject: [PATCH] =?UTF-8?q?=D0=9F=D1=80=D0=BE=D0=BF=D0=B8=D1=81=D0=B0?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20=D0=B1=D0=B8=D0=B7=D0=BD=D0=B5=D1=81-?= =?UTF-8?q?=D0=BB=D0=BE=D0=B3=D0=B8=D0=BA=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Aparyan.ISE_22.MotorPlant.sln | 26 +++- MoorPlantListImplement/DataListSingleton.cs | 27 ++++ .../Implements/ComponentStorage.cs | 110 ++++++++++++++++ .../Implements/MotorStorage.cs | 109 ++++++++++++++++ .../Implements/OrderStorage.cs | 121 ++++++++++++++++++ MoorPlantListImplement/Models/Component.cs | 45 +++++++ MoorPlantListImplement/Models/Motor.cs | 51 ++++++++ MoorPlantListImplement/Models/Order.cs | 63 +++++++++ .../MotorPlantListImplement.csproj | 14 ++ .../BusinessLogics/ComponentLogic.cs | 114 +++++++++++++++++ .../BusinessLogics/MotorLogic.cs | 111 ++++++++++++++++ .../BusinessLogics/OrderLogic.cs | 120 +++++++++++++++++ .../MotorPlantBusinessLogic.csproj | 17 +++ .../BindingModels/ComponentBindingModel.cs | 12 ++ .../BindingModels/MotorBindingModel.cs | 16 +++ .../BindingModels/OrderBindingModel.cs | 16 +++ .../IComponentLogic.cs | 15 +++ .../BusinessLogicsContracts/IMotorLogic.cs | 16 +++ .../BusinessLogicsContracts/IOrderLogic.cs | 16 +++ MotorPlantContracts/Class1.cs | 7 + .../MotorPlantContracts.csproj | 13 ++ .../SearchModels/ComponentSearchModel.cs | 8 ++ .../SearchModels/MotorSearchModel.cs | 14 ++ .../SearchModels/OrderSearchModel.cs | 7 + .../StoragesContracts/IComponentStorage.cs | 16 +++ .../StoragesContracts/IMotorStorage.cs | 16 +++ .../StoragesContracts/IOrderStorage.cs | 17 +++ .../ViewModels/ComponentViewModel.cs | 14 ++ .../ViewModels/MotorViewModel.cs | 17 +++ .../ViewModels/OrderViewModel.cs | 33 +++++ MotorPlantDataModels/Enums/OrderStatus.cs | 21 +++ MotorPlantDataModels/IId.cs | 7 + .../Models/IComponentModel.cs | 8 ++ MotorPlantDataModels/Models/IMotorModel.cs | 9 ++ MotorPlantDataModels/Models/IOrderModel.cs | 13 ++ .../MotorPlantDataModels.csproj | 9 ++ 36 files changed, 1247 insertions(+), 1 deletion(-) create mode 100644 MoorPlantListImplement/DataListSingleton.cs create mode 100644 MoorPlantListImplement/Implements/ComponentStorage.cs create mode 100644 MoorPlantListImplement/Implements/MotorStorage.cs create mode 100644 MoorPlantListImplement/Implements/OrderStorage.cs create mode 100644 MoorPlantListImplement/Models/Component.cs create mode 100644 MoorPlantListImplement/Models/Motor.cs create mode 100644 MoorPlantListImplement/Models/Order.cs create mode 100644 MoorPlantListImplement/MotorPlantListImplement.csproj create mode 100644 MotorPlantBusinessLogic/BusinessLogics/ComponentLogic.cs create mode 100644 MotorPlantBusinessLogic/BusinessLogics/MotorLogic.cs create mode 100644 MotorPlantBusinessLogic/BusinessLogics/OrderLogic.cs create mode 100644 MotorPlantBusinessLogic/MotorPlantBusinessLogic.csproj create mode 100644 MotorPlantContracts/BindingModels/ComponentBindingModel.cs create mode 100644 MotorPlantContracts/BindingModels/MotorBindingModel.cs create mode 100644 MotorPlantContracts/BindingModels/OrderBindingModel.cs create mode 100644 MotorPlantContracts/BusinessLogicsContracts/IComponentLogic.cs create mode 100644 MotorPlantContracts/BusinessLogicsContracts/IMotorLogic.cs create mode 100644 MotorPlantContracts/BusinessLogicsContracts/IOrderLogic.cs create mode 100644 MotorPlantContracts/Class1.cs create mode 100644 MotorPlantContracts/MotorPlantContracts.csproj create mode 100644 MotorPlantContracts/SearchModels/ComponentSearchModel.cs create mode 100644 MotorPlantContracts/SearchModels/MotorSearchModel.cs create mode 100644 MotorPlantContracts/SearchModels/OrderSearchModel.cs create mode 100644 MotorPlantContracts/StoragesContracts/IComponentStorage.cs create mode 100644 MotorPlantContracts/StoragesContracts/IMotorStorage.cs create mode 100644 MotorPlantContracts/StoragesContracts/IOrderStorage.cs create mode 100644 MotorPlantContracts/ViewModels/ComponentViewModel.cs create mode 100644 MotorPlantContracts/ViewModels/MotorViewModel.cs create mode 100644 MotorPlantContracts/ViewModels/OrderViewModel.cs create mode 100644 MotorPlantDataModels/Enums/OrderStatus.cs create mode 100644 MotorPlantDataModels/IId.cs create mode 100644 MotorPlantDataModels/Models/IComponentModel.cs create mode 100644 MotorPlantDataModels/Models/IMotorModel.cs create mode 100644 MotorPlantDataModels/Models/IOrderModel.cs create mode 100644 MotorPlantDataModels/MotorPlantDataModels.csproj diff --git a/Aparyan.ISE_22.MotorPlant/Aparyan.ISE_22.MotorPlant.sln b/Aparyan.ISE_22.MotorPlant/Aparyan.ISE_22.MotorPlant.sln index 2e57ea5..fae3176 100644 --- a/Aparyan.ISE_22.MotorPlant/Aparyan.ISE_22.MotorPlant.sln +++ b/Aparyan.ISE_22.MotorPlant/Aparyan.ISE_22.MotorPlant.sln @@ -3,7 +3,15 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 VisualStudioVersion = 17.8.34316.72 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Aparyan.ISE_22.MotorPlant", "Aparyan.ISE_22.MotorPlant.csproj", "{F1A04B81-A34D-4C40-BC03-FD0B410AF68E}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Aparyan.ISE_22.MotorPlant", "Aparyan.ISE_22.MotorPlant.csproj", "{F1A04B81-A34D-4C40-BC03-FD0B410AF68E}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MotorPlantDataModels", "..\MotorPlantDataModels\MotorPlantDataModels.csproj", "{1D2D7C4C-A127-4BCB-965C-E55D4BA1BBB4}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MotorPlantContracts", "..\MotorPlantContracts\MotorPlantContracts.csproj", "{2D2B3484-09AE-4DF5-A293-35A8BEDA6E1C}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MotorPlantListImplement", "..\MoorPlantListImplement\MotorPlantListImplement.csproj", "{F0D12A96-D511-4277-B576-6ED1F85F4A08}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MotorPlantBusinessLogic", "..\MotorPlantBusinessLogic\MotorPlantBusinessLogic.csproj", "{BE9E33C8-F7AD-4952-80B8-68FAE35E0BDC}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -15,6 +23,22 @@ Global {F1A04B81-A34D-4C40-BC03-FD0B410AF68E}.Debug|Any CPU.Build.0 = Debug|Any CPU {F1A04B81-A34D-4C40-BC03-FD0B410AF68E}.Release|Any CPU.ActiveCfg = Release|Any CPU {F1A04B81-A34D-4C40-BC03-FD0B410AF68E}.Release|Any CPU.Build.0 = Release|Any CPU + {1D2D7C4C-A127-4BCB-965C-E55D4BA1BBB4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1D2D7C4C-A127-4BCB-965C-E55D4BA1BBB4}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1D2D7C4C-A127-4BCB-965C-E55D4BA1BBB4}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1D2D7C4C-A127-4BCB-965C-E55D4BA1BBB4}.Release|Any CPU.Build.0 = Release|Any CPU + {2D2B3484-09AE-4DF5-A293-35A8BEDA6E1C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {2D2B3484-09AE-4DF5-A293-35A8BEDA6E1C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {2D2B3484-09AE-4DF5-A293-35A8BEDA6E1C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {2D2B3484-09AE-4DF5-A293-35A8BEDA6E1C}.Release|Any CPU.Build.0 = Release|Any CPU + {F0D12A96-D511-4277-B576-6ED1F85F4A08}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F0D12A96-D511-4277-B576-6ED1F85F4A08}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F0D12A96-D511-4277-B576-6ED1F85F4A08}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F0D12A96-D511-4277-B576-6ED1F85F4A08}.Release|Any CPU.Build.0 = Release|Any CPU + {BE9E33C8-F7AD-4952-80B8-68FAE35E0BDC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {BE9E33C8-F7AD-4952-80B8-68FAE35E0BDC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {BE9E33C8-F7AD-4952-80B8-68FAE35E0BDC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {BE9E33C8-F7AD-4952-80B8-68FAE35E0BDC}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/MoorPlantListImplement/DataListSingleton.cs b/MoorPlantListImplement/DataListSingleton.cs new file mode 100644 index 0000000..870f46c --- /dev/null +++ b/MoorPlantListImplement/DataListSingleton.cs @@ -0,0 +1,27 @@ +using MotorPlantListImplement.Models; + +namespace MotorPlantListImplement +{ + public class DataListSingleton + { + private static DataListSingleton? _instance; + public List Components { get; set; } + public List Orders { get; set; } + public List Motor { get; set; } + private DataListSingleton() + { + Components = new List(); + Orders = new List(); + Motor = new List(); + } + + public static DataListSingleton GetInstance() + { + if (_instance == null) + { + _instance = new DataListSingleton(); + } + return _instance; + } + } +} \ No newline at end of file diff --git a/MoorPlantListImplement/Implements/ComponentStorage.cs b/MoorPlantListImplement/Implements/ComponentStorage.cs new file mode 100644 index 0000000..9d9f577 --- /dev/null +++ b/MoorPlantListImplement/Implements/ComponentStorage.cs @@ -0,0 +1,110 @@ +using MotorPlantContracts.BindingModels; +using MotorPlantContracts.SearchModels; +using MotorPlantContracts.StoragesContracts; +using MotorPlantContracts.VeiwModels; +using MotorPlantListImplement.Models; +using System.ComponentModel; + + +namespace MotorPlantListImplement.Implements +{ + public class ComponentStorage : IComponentStorage + { + private readonly DataListSingleton _source; + + public ComponentStorage() + { + _source = DataListSingleton.GetInstance(); + } + + public List GetFullList() + { + var result = new List(); + foreach (var component in _source.Components) + { + result.Add(component.GetViewModel); + } + return result; + } + + public List GetFilteredList(ComponentSearchModel model) + { + var result = new List(); + if (string.IsNullOrEmpty(model.ComponentName)) + { + return result; + } + foreach (var component in _source.Components) + { + if (component.ComponentName.Contains(model.ComponentName)) + { + result.Add(component.GetViewModel); + } + } + return result; + } + + public ComponentViewModel? GetElement(ComponentSearchModel model) + { + if (string.IsNullOrEmpty(model.ComponentName) && !model.Id.HasValue) + { + return null; + } + foreach (var component in _source.Components) + { + if ((!string.IsNullOrEmpty(model.ComponentName) && component.ComponentName == model.ComponentName) || + (model.Id.HasValue && component.Id == model.Id)) + { + return component.GetViewModel; + } + } + return null; + } + + public ComponentViewModel? Insert(ComponentBindingModel model) + { + model.Id = 1; + foreach (var component in _source.Components) + { + if (model.Id <= component.Id) + { + model.Id = component.Id + 1; + } + } + var newComponent = Models.Component.Create(model); + if (newComponent == null) + { + return null; + } + _source.Components.Add(newComponent); + return newComponent.GetViewModel; + } + + public ComponentViewModel? Update(ComponentBindingModel model) + { + foreach (var component in _source.Components) + { + if (component.Id == model.Id) + { + component.Update(model); + return component.GetViewModel; + } + } + return null; + } + + public ComponentViewModel? Delete(ComponentBindingModel model) + { + for (int i = 0; i < _source.Components.Count; ++i) + { + if (_source.Components[i].Id == model.Id) + { + var element = _source.Components[i]; + _source.Components.RemoveAt(i); + return element.GetViewModel; + } + } + return null; + } + } + } diff --git a/MoorPlantListImplement/Implements/MotorStorage.cs b/MoorPlantListImplement/Implements/MotorStorage.cs new file mode 100644 index 0000000..1c85abe --- /dev/null +++ b/MoorPlantListImplement/Implements/MotorStorage.cs @@ -0,0 +1,109 @@ +using MotorPlantContracts.BindingModels; +using MotorPlantContracts.SearchModels; +using MotorPlantContracts.StoragesContracts; +using MotorPlantContracts.VeiwModels; +using MotorPlantListImplement.Models; + + +namespace MotorPlantListImplement +{ + public class Motortorage : IMotorStorage + { + private readonly DataListSingleton _source; + + public Motortorage() + { + _source = DataListSingleton.GetInstance(); + } + + public List GetFullList() + { + var result = new List(); + foreach (var Motor in _source.Motor) + { + result.Add(Motor.GetViewModel); + } + return result; + } + + public List GetFilteredList(MotorSearchModel model) + { + var result = new List(); + if (string.IsNullOrEmpty(model.MotorName)) + { + return result; + } + foreach (var Motor in _source.Motor) + { + if (Motor.MotorName.Contains(model.MotorName)) + { + result.Add(Motor.GetViewModel); + } + } + return result; + } + + public MotorViewModel? GetElement(MotorSearchModel model) + { + if (string.IsNullOrEmpty(model.MotorName) && !model.Id.HasValue) + { + return null; + } + foreach (var Motor in _source.Motor) + { + if ((!string.IsNullOrEmpty(model.MotorName) && Motor.MotorName == model.MotorName) || + (model.Id.HasValue && Motor.Id == model.Id)) + { + return Motor.GetViewModel; + } + } + return null; + } + + public MotorViewModel? Insert(MotorBindingModel model) + { + model.Id = 1; + foreach (var Motor in _source.Motor) + { + if (model.Id <= Motor.Id) + { + model.Id = Motor.Id + 1; + } + } + var newMotor = Motor.Create(model); + if (newMotor == null) + { + return null; + } + _source.Motor.Add(newMotor); + return newMotor.GetViewModel; + } + + public MotorViewModel? Update(MotorBindingModel model) + { + foreach (var Motor in _source.Motor) + { + if (Motor.Id == model.Id) + { + Motor.Update(model); + return Motor.GetViewModel; + } + } + return null; + } + + public MotorViewModel? Delete(MotorBindingModel model) + { + for (int i = 0; i < _source.Motor.Count; ++i) + { + if (_source.Motor[i].Id == model.Id) + { + var element = _source.Motor[i]; + _source.Motor.RemoveAt(i); + return element.GetViewModel; + } + } + return null; + } + } +} diff --git a/MoorPlantListImplement/Implements/OrderStorage.cs b/MoorPlantListImplement/Implements/OrderStorage.cs new file mode 100644 index 0000000..b783700 --- /dev/null +++ b/MoorPlantListImplement/Implements/OrderStorage.cs @@ -0,0 +1,121 @@ +using MotorPlantContracts.BindingModels; +using MotorPlantContracts.SearchModels; +using MotorPlantContracts.StoragesContracts; +using MotorPlantContracts.VeiwModels; +using MotorPlantListImplement.Models; + + +namespace MotorPlantListImplement +{ + public class OrderStorage : IOrderStorage + { + private readonly DataListSingleton _source; + + public OrderStorage() + { + _source = DataListSingleton.GetInstance(); + } + + public List GetFullList() + { + var result = new List(); + foreach (var order in _source.Orders) + { + result.Add(AttachMotorName(order.GetViewModel)); + } + return result; + } + + public List GetFilteredList(OrderSearchModel model) + { + var result = new List(); + if (model == null || !model.Id.HasValue) + { + return result; + } + foreach (var order in _source.Orders) + { + if (order.Id == model.Id) + { + result.Add(AttachMotorName(order.GetViewModel)); + } + } + return result; + } + + public OrderViewModel? GetElement(OrderSearchModel model) + { + if (!model.Id.HasValue) + { + return null; + } + foreach (var order in _source.Orders) + { + if (model.Id.HasValue && order.Id == model.Id) + { + return AttachMotorName(order.GetViewModel); + } + } + return null; + } + + public OrderViewModel? Insert(OrderBindingModel model) + { + model.Id = 1; + foreach (var order in _source.Orders) + { + if (model.Id <= order.Id) + { + model.Id = order.Id + 1; + } + } + var newOrder = Order.Create(model); + if (newOrder == null) + { + return null; + } + _source.Orders.Add(newOrder); + return AttachMotorName(newOrder.GetViewModel); + } + + public OrderViewModel? Update(OrderBindingModel model) + { + foreach (var order in _source.Orders) + { + if (order.Id == model.Id) + { + order.Update(model); + return AttachMotorName(order.GetViewModel); + } + } + return null; + } + + public OrderViewModel? Delete(OrderBindingModel model) + { + for (int i = 0; i < _source.Orders.Count; ++i) + { + if (_source.Orders[i].Id == model.Id) + { + var element = _source.Orders[i]; + _source.Orders.RemoveAt(i); + return AttachMotorName(element.GetViewModel); + } + } + return null; + } + + private OrderViewModel AttachMotorName(OrderViewModel model) + { + foreach (var motor in _source.Motor) + { + if (motor.Id == model.MotorId) + { + model.MotorName = motor.MotorName; + return model; + } + } + return model; + } + } +} diff --git a/MoorPlantListImplement/Models/Component.cs b/MoorPlantListImplement/Models/Component.cs new file mode 100644 index 0000000..8cf5a3a --- /dev/null +++ b/MoorPlantListImplement/Models/Component.cs @@ -0,0 +1,45 @@ +using MotorPlantContracts.BindingModels; +using MotorPlantContracts.VeiwModels; +using MotorPlantDataModels.Models; +namespace MotorPlantListImplement.Models +{ + public class Component : IComponentModel + { + public int Id { get; set; } + + public string ComponentName { get; set; } = string.Empty; + + public double Cost { get; set; } + + public static Component? Create(ComponentBindingModel? model) + { + if (model == null) + { + return null; + } + return new Component() + { + Id = model.Id, + ComponentName = model.ComponentName, + Cost = model.Cost + }; + } + + public void Update (ComponentBindingModel? model) + { + if (model == null) + { + return; + } + ComponentName = model.ComponentName; + Cost = model.Cost; + } + + public ComponentViewModel GetViewModel => new() + { + Id = Id, + ComponentName = ComponentName, + Cost = Cost + }; + } +} diff --git a/MoorPlantListImplement/Models/Motor.cs b/MoorPlantListImplement/Models/Motor.cs new file mode 100644 index 0000000..f2f9a0f --- /dev/null +++ b/MoorPlantListImplement/Models/Motor.cs @@ -0,0 +1,51 @@ +using MotorPlantContracts.BindingModels; +using MotorPlantContracts.VeiwModels; +using MotorPlantDataModels.Models; + +namespace MotorPlantListImplement.Models +{ + public class Motor: IMotorModel + { + public int Id { get; private set; } + public string MotorName { get; private set; } = string.Empty; + public double Price { get; private set; } + public Dictionary MotorComponents { get; private set; } = new Dictionary { }; + + public static Motor? Create(MotorBindingModel? model) + { + if(model == null) + { + return null; + } + return new Motor() + { + Id = model.Id, + MotorName = model.MotorName, + Price = model.Price, + MotorComponents = model.MotorComponents + }; + } + + public void Update(MotorBindingModel? model) + { + if (model == null) + { + return; + } + MotorName = model.MotorName; + Price = model.Price; + MotorComponents = model.MotorComponents; + } + + public MotorViewModel GetViewModel => new() + { + Id = Id, + MotorName = MotorName, + Price = Price, + MotorComponents = MotorComponents + }; + } + + + +} diff --git a/MoorPlantListImplement/Models/Order.cs b/MoorPlantListImplement/Models/Order.cs new file mode 100644 index 0000000..3514a79 --- /dev/null +++ b/MoorPlantListImplement/Models/Order.cs @@ -0,0 +1,63 @@ +using MotorPlantContracts.BindingModels; +using MotorPlantContracts.VeiwModels; +using MotorPlantDataModels.Enums; +using MotorPlantDataModels.Models; + +namespace MotorPlantListImplement.Models +{ + public class Order : IOrderModel + { + public int Id { get; private set; } + + public int MotorId { get; private set; } + + public int Count { get; private set; } + + public double Sum { get; private set; } + + public OrderStatus Status { get; private set; } = OrderStatus.Неизвестен; + + public DateTime DateCreate { get; private set; } = DateTime.Now; + + public DateTime? DateImplement { get; private set; } + + + public static Order? Create(OrderBindingModel? model) + { + if (model == null) + { + return null; + } + return new Order() + { + Id = model.Id, + MotorId = model.MotorId, + Count = model.Count, + Sum = model.Sum, + Status = model.Status, + DateCreate = model.DateCreate, + DateImplement = model.DateImplement, + }; + } + public void Update(OrderBindingModel? model) + { + if (model == null) + { + return; + } + Status = model.Status; + if (model.Status == OrderStatus.Выдан) DateImplement = model.DateImplement; + } + + public OrderViewModel GetViewModel => new() + { + Id = Id, + MotorId = MotorId, + Count = Count, + Sum = Sum, + Status = Status, + DateCreate = DateCreate, + DateImplement = DateImplement, + }; + } +} \ No newline at end of file diff --git a/MoorPlantListImplement/MotorPlantListImplement.csproj b/MoorPlantListImplement/MotorPlantListImplement.csproj new file mode 100644 index 0000000..51e5e3e --- /dev/null +++ b/MoorPlantListImplement/MotorPlantListImplement.csproj @@ -0,0 +1,14 @@ + + + + net8.0 + enable + enable + + + + + + + + diff --git a/MotorPlantBusinessLogic/BusinessLogics/ComponentLogic.cs b/MotorPlantBusinessLogic/BusinessLogics/ComponentLogic.cs new file mode 100644 index 0000000..8892638 --- /dev/null +++ b/MotorPlantBusinessLogic/BusinessLogics/ComponentLogic.cs @@ -0,0 +1,114 @@ +using Microsoft.Extensions.Logging; +using MotorPlantContracts.BindingModels; +using MotorPlantContracts.BusinessLogicsContracts; +using MotorPlantContracts.SearchModels; +using MotorPlantContracts.StoragesContracts; +using MotorPlantContracts.VeiwModels; + +namespace MotorPlantBusinessLogic.BusinessLogics +{ + public class ComponentLogic : IComponentLogic + { + private readonly ILogger _logger; + private readonly IComponentStorage _componentStorage; + + public ComponentLogic(ILogger logger, IComponentStorage componentStorage) + { + _logger = logger; + _componentStorage = componentStorage; + } + + public List? ReadList(ComponentSearchModel? model) + { + _logger.LogInformation("ReadList. ComponentName:{ComponentName}.Id:{ Id}", model?.ComponentName, model?.Id); + var list = model == null ? _componentStorage.GetFullList() : _componentStorage.GetFilteredList(model); + if (list == null) + { + _logger.LogWarning("ReadList return null list"); + return null; + } + _logger.LogInformation("ReadList. Count:{Count}", list.Count); + return list; + } + + public ComponentViewModel? ReadElement(ComponentSearchModel model) + { + if (model == null) + { + throw new ArgumentNullException(nameof(model)); + } + _logger.LogInformation("ReadElement. ComponentName:{ComponentName}.Id:{ Id}", model.ComponentName, model.Id); + var element = _componentStorage.GetElement(model); + if (element == null) + { + _logger.LogWarning("ReadElement element not found"); + return null; + } + _logger.LogInformation("ReadElement find. Id:{Id}", element.Id); + return element; + } + + public bool Create(ComponentBindingModel model) + { + CheckModel(model); + if (_componentStorage.Insert(model) == null) + { + _logger.LogWarning("Insert operation failed"); + return false; + } + return true; + } + + public bool Update(ComponentBindingModel model) + { + CheckModel(model); + if (_componentStorage.Update(model) == null) + { + _logger.LogWarning("Update operation failed"); + return false; + } + return true; + } + + public bool Delete(ComponentBindingModel model) + { + CheckModel(model, false); + _logger.LogInformation("Delete. Id:{Id}", model.Id); + if (_componentStorage.Delete(model) == null) + { + _logger.LogWarning("Delete operation failed"); + return false; + } + return true; + } + + private void CheckModel(ComponentBindingModel model, bool withParams = true) + { + if (model == null) + { + throw new ArgumentNullException(nameof(model)); + } + if (!withParams) + { + return; + } + if (string.IsNullOrEmpty(model.ComponentName)) + { + throw new ArgumentNullException("Нет названия ингредиента", nameof(model.ComponentName)); + } + if (model.Cost <= 0) + { + throw new ArgumentNullException("Цена ингредиента должна быть больше 0", nameof(model.Cost)); + } + _logger.LogInformation("Component. ComponentName:{ComponentName}.Cost:{ Cost}.Id: { Id}", model.ComponentName, model.Cost, model.Id); + var element = _componentStorage.GetElement(new ComponentSearchModel + { + ComponentName = model.ComponentName + }); + if (element != null && element.Id != model.Id) + { + throw new InvalidOperationException("Ингредиент с таким названием уже есть"); + } + } + } +} diff --git a/MotorPlantBusinessLogic/BusinessLogics/MotorLogic.cs b/MotorPlantBusinessLogic/BusinessLogics/MotorLogic.cs new file mode 100644 index 0000000..fdc29a3 --- /dev/null +++ b/MotorPlantBusinessLogic/BusinessLogics/MotorLogic.cs @@ -0,0 +1,111 @@ +using Microsoft.Extensions.Logging; +using MotorPlantContracts.BindingModels; +using MotorPlantContracts.BusinessLogicsContracts; +using MotorPlantContracts.SearchModels; +using MotorPlantContracts.StoragesContracts; +using MotorPlantContracts.VeiwModels; + +namespace MotorPlantBusinessLogic.BusinessLogics +{ + public class MotorLogic : IMotorLogic + { + private readonly ILogger _logger; + private readonly IMotorStorage _MotorStorage; + public MotorLogic(ILogger logger, IMotorStorage MotorStorage) + { + _logger = logger; + _MotorStorage = MotorStorage; + } + public List? ReadList(MotorSearchModel? model) + { + _logger.LogInformation("ReadList. MotorName:{MotorName}.Id:{ Id}", model?.MotorName, model?.Id); + var list = model == null ? _MotorStorage.GetFullList() : _MotorStorage.GetFilteredList(model); + if (list == null) + { + _logger.LogWarning("ReadList return null list"); + return null; + } + _logger.LogInformation("ReadList. Count:{Count}", list.Count); + return list; + } + public MotorViewModel? ReadElement(MotorSearchModel model) + { + if (model == null) + { + throw new ArgumentNullException(nameof(model)); + } + _logger.LogInformation("ReadElement. MotorName:{MotorName}.Id:{ Id}", model.MotorName, model.Id); + var element = _MotorStorage.GetElement(model); + if (element == null) + { + _logger.LogWarning("ReadElement element not found"); + return null; + } + _logger.LogInformation("ReadElement find. Id:{Id}", element.Id); + return element; + } + public bool Create(MotorBindingModel model) + { + CheckModel(model); + if (_MotorStorage.Insert(model) == null) + { + _logger.LogWarning("Insert operation failed"); + return false; + } + return true; + } + public bool Update(MotorBindingModel model) + { + CheckModel(model); + if (_MotorStorage.Update(model) == null) + { + _logger.LogWarning("Update operation failed"); + return false; + } + return true; + } + public bool Delete(MotorBindingModel model) + { + CheckModel(model, false); + _logger.LogInformation("Delete. Id:{Id}", model.Id); + if (_MotorStorage.Delete(model) == null) + { + _logger.LogWarning("Delete operation failed"); + return false; + } + return true; + } + private void CheckModel(MotorBindingModel model, bool withParams = true) + { + if (model == null) + { + throw new ArgumentNullException(nameof(model)); + } + if (!withParams) + { + return; + } + if (string.IsNullOrEmpty(model.MotorName)) + { + throw new ArgumentNullException("Нет названия мотора", nameof(model.MotorName)); + } + if (model.Price <= 0) + { + throw new ArgumentNullException("Цена мотора должна быть больше 0", nameof(model.Price)); + } + if (model.MotorComponents == null || model.MotorComponents.Count == 0) + { + throw new ArgumentNullException("Перечень деталей не может быть пустым", nameof(model.MotorComponents)); + } + _logger.LogInformation("Motor. MotorName:{MotorName}.Price:{Price}.Id: { Id}", model.MotorName, model.Price, model.Id); + var element = _MotorStorage.GetElement(new MotorSearchModel + { + MotorName = model.MotorName + }); + if (element != null && element.Id != model.Id) + { + throw new InvalidOperationException("Мотор с таким названием уже есть"); + } + } + } +} \ No newline at end of file diff --git a/MotorPlantBusinessLogic/BusinessLogics/OrderLogic.cs b/MotorPlantBusinessLogic/BusinessLogics/OrderLogic.cs new file mode 100644 index 0000000..4abcd8d --- /dev/null +++ b/MotorPlantBusinessLogic/BusinessLogics/OrderLogic.cs @@ -0,0 +1,120 @@ +using Microsoft.Extensions.Logging; +using MotorPlantContracts.BindingModels; +using MotorPlantContracts.BusinessLogicsContracts; +using MotorPlantContracts.SearchModels; +using MotorPlantContracts.StoragesContracts; +using MotorPlantContracts.VeiwModels; +using MotorPlantDataModels.Enums; + +namespace MotorPlantBusinessLogic.BusinessLogics +{ + public class OrderLogic : IOrderLogic + { + private readonly ILogger _logger; + private readonly IOrderStorage _orderStorage; + public OrderLogic(ILogger logger, IOrderStorage orderStorage) + { + _logger = logger; + _orderStorage = orderStorage; + } + public List? ReadList(OrderSearchModel? model) + { + _logger.LogInformation("ReadList. OrderId:{Id}", model?.Id); + var list = model == null ? _orderStorage.GetFullList() : _orderStorage.GetFilteredList(model); + if (list == null) + { + _logger.LogWarning("ReadList return null list"); + return null; + } + _logger.LogInformation("ReadList. Count:{Count}", list.Count); + return list; + } + public bool CreateOrder(OrderBindingModel model) + { + CheckModel(model); + if (model.Status != OrderStatus.Неизвестен) + return false; + model.Status = OrderStatus.Принят; + if (_orderStorage.Insert(model) == null) + { + _logger.LogWarning("Insert operation failed"); + return false; + } + return true; + } + + public bool TakeOrderInWork(OrderBindingModel model) + { + return ChangeStatus(model, OrderStatus.Выполняется); + } + + public bool FinishOrder(OrderBindingModel model) + { + return ChangeStatus(model, OrderStatus.Готов); + } + + public bool DeliveryOrder(OrderBindingModel model) + { + return ChangeStatus(model, OrderStatus.Выдан); + } + + private void CheckModel(OrderBindingModel model, bool withParams = true) + { + if (model == null) + { + throw new ArgumentNullException(nameof(model)); + } + if (!withParams) + { + return; + } + if (model.Count <= 0) + { + throw new ArgumentException("Колличество моторов в заказе не может быть меньше 1", nameof(model.Count)); + } + if (model.Sum <= 0) + { + throw new ArgumentException("Стоимость заказа на может быть меньше 1", nameof(model.Sum)); + } + if (model.DateImplement.HasValue && model.DateImplement < model.DateCreate) + { + throw new ArithmeticException($"Дата выдачи заказа {model.DateImplement} не может быть раньше даты его создания {model.DateCreate}"); + } + _logger.LogInformation("Motor. MotorId:{MotorId}.Count:{Count}.Sum:{Sum}Id:{Id}", + model.MotorId, model.Count, model.Sum, model.Id); + } + + private bool ChangeStatus(OrderBindingModel model, OrderStatus requiredStatus) + { + CheckModel(model, false); + var element = _orderStorage.GetElement(new OrderSearchModel() + { + Id = model.Id + }); + if (element == null) + { + throw new ArgumentNullException(nameof(element)); + } + model.DateCreate = element.DateCreate; + model.MotorId = element.MotorId; + model.DateImplement = element.DateImplement; + model.Status = element.Status; + model.Count = element.Count; + model.Sum = element.Sum; + if (requiredStatus - model.Status == 1) + { + model.Status = requiredStatus; + if (model.Status == OrderStatus.Выдан) + model.DateImplement = DateTime.Now; + if (_orderStorage.Update(model) == null) + { + _logger.LogWarning("Update operation failed"); + return false; + } + return true; + } + _logger.LogWarning("Changing status operation faled: Current-{Status}:required-{requiredStatus}.", model.Status, requiredStatus); + throw new ArgumentException($"Невозможно присвоить статус {requiredStatus} заказу с текущим статусом {model.Status}"); + } + } +} diff --git a/MotorPlantBusinessLogic/MotorPlantBusinessLogic.csproj b/MotorPlantBusinessLogic/MotorPlantBusinessLogic.csproj new file mode 100644 index 0000000..8484abc --- /dev/null +++ b/MotorPlantBusinessLogic/MotorPlantBusinessLogic.csproj @@ -0,0 +1,17 @@ + + + + net8.0 + enable + enable + + + + + + + + + + + diff --git a/MotorPlantContracts/BindingModels/ComponentBindingModel.cs b/MotorPlantContracts/BindingModels/ComponentBindingModel.cs new file mode 100644 index 0000000..53b499b --- /dev/null +++ b/MotorPlantContracts/BindingModels/ComponentBindingModel.cs @@ -0,0 +1,12 @@ +using MotorPlantDataModels.Models; + +namespace MotorPlantContracts.BindingModels +{ + public class ComponentBindingModel : IComponentModel + { + public int Id { get; set; } + public string ComponentName { get; set; } = string.Empty; + public double Cost { get; set; } + + } +} diff --git a/MotorPlantContracts/BindingModels/MotorBindingModel.cs b/MotorPlantContracts/BindingModels/MotorBindingModel.cs new file mode 100644 index 0000000..3152e2d --- /dev/null +++ b/MotorPlantContracts/BindingModels/MotorBindingModel.cs @@ -0,0 +1,16 @@ +using MotorPlantDataModels.Models; + +namespace MotorPlantContracts.BindingModels +{ + public class MotorBindingModel : IMotorModel + { + public int Id { get; set; } + public string MotorName { get; set; } = string.Empty; + public double Price { get; set; } + public Dictionary MotorComponents { get; set; } = new(); + } + +} + + + diff --git a/MotorPlantContracts/BindingModels/OrderBindingModel.cs b/MotorPlantContracts/BindingModels/OrderBindingModel.cs new file mode 100644 index 0000000..e9ce1c0 --- /dev/null +++ b/MotorPlantContracts/BindingModels/OrderBindingModel.cs @@ -0,0 +1,16 @@ +using MotorPlantDataModels.Enums; +using MotorPlantDataModels.Models; + +namespace MotorPlantContracts.BindingModels +{ + public class OrderBindingModel: IOrderModel + { + public int Id { get; set; } + public int MotorId { get; set; } + public int Count { get; set; } + public double Sum { get; set; } + public OrderStatus Status { get; set; } = OrderStatus.Неизвестен; + public DateTime DateCreate { get; set; } = DateTime.Now; + public DateTime? DateImplement { get; set; } + } +} diff --git a/MotorPlantContracts/BusinessLogicsContracts/IComponentLogic.cs b/MotorPlantContracts/BusinessLogicsContracts/IComponentLogic.cs new file mode 100644 index 0000000..e612888 --- /dev/null +++ b/MotorPlantContracts/BusinessLogicsContracts/IComponentLogic.cs @@ -0,0 +1,15 @@ +using MotorPlantContracts.BindingModels; +using MotorPlantContracts.SearchModels; +using MotorPlantContracts.VeiwModels; +namespace MotorPlantContracts.BusinessLogicsContracts +{ + public interface IComponentLogic + { + List? ReadList(ComponentSearchModel? model); + + ComponentViewModel? ReadElement(ComponentSearchModel model); + bool Create(ComponentBindingModel model); + bool Update(ComponentBindingModel model); + bool Delete(ComponentBindingModel model); + } +} diff --git a/MotorPlantContracts/BusinessLogicsContracts/IMotorLogic.cs b/MotorPlantContracts/BusinessLogicsContracts/IMotorLogic.cs new file mode 100644 index 0000000..bdfb955 --- /dev/null +++ b/MotorPlantContracts/BusinessLogicsContracts/IMotorLogic.cs @@ -0,0 +1,16 @@ +using MotorPlantContracts.BindingModels; +using MotorPlantContracts.SearchModels; +using MotorPlantContracts.VeiwModels; + +namespace MotorPlantContracts.BusinessLogicsContracts +{ + public interface IMotorLogic + { + List? ReadList(MotorSearchModel? model); + + MotorViewModel? ReadElement(MotorSearchModel model); + bool Create(MotorBindingModel model); + bool Update(MotorBindingModel model); + bool Delete(MotorBindingModel model); + } +} diff --git a/MotorPlantContracts/BusinessLogicsContracts/IOrderLogic.cs b/MotorPlantContracts/BusinessLogicsContracts/IOrderLogic.cs new file mode 100644 index 0000000..39b8bda --- /dev/null +++ b/MotorPlantContracts/BusinessLogicsContracts/IOrderLogic.cs @@ -0,0 +1,16 @@ +using MotorPlantContracts.BindingModels; +using MotorPlantContracts.SearchModels; +using MotorPlantContracts.VeiwModels; + +namespace MotorPlantContracts.BusinessLogicsContracts +{ + public interface IOrderLogic + { + List? ReadList(OrderSearchModel? model); + bool CreateOrder(OrderBindingModel model); + bool TakeOrderInWork(OrderBindingModel model); + bool FinishOrder(OrderBindingModel model); + bool DeliveryOrder(OrderBindingModel model); + + } +} diff --git a/MotorPlantContracts/Class1.cs b/MotorPlantContracts/Class1.cs new file mode 100644 index 0000000..4832fee --- /dev/null +++ b/MotorPlantContracts/Class1.cs @@ -0,0 +1,7 @@ +namespace MotorPlantContracts +{ + public class Class1 + { + + } +} diff --git a/MotorPlantContracts/MotorPlantContracts.csproj b/MotorPlantContracts/MotorPlantContracts.csproj new file mode 100644 index 0000000..f24da29 --- /dev/null +++ b/MotorPlantContracts/MotorPlantContracts.csproj @@ -0,0 +1,13 @@ + + + + net8.0 + enable + enable + + + + + + + diff --git a/MotorPlantContracts/SearchModels/ComponentSearchModel.cs b/MotorPlantContracts/SearchModels/ComponentSearchModel.cs new file mode 100644 index 0000000..004f6d9 --- /dev/null +++ b/MotorPlantContracts/SearchModels/ComponentSearchModel.cs @@ -0,0 +1,8 @@ +namespace MotorPlantContracts.SearchModels +{ + public class ComponentSearchModel + { + public int? Id { get; set; } + public string? ComponentName { get; set; } + } +} diff --git a/MotorPlantContracts/SearchModels/MotorSearchModel.cs b/MotorPlantContracts/SearchModels/MotorSearchModel.cs new file mode 100644 index 0000000..1efddbd --- /dev/null +++ b/MotorPlantContracts/SearchModels/MotorSearchModel.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace MotorPlantContracts.SearchModels +{ + public class MotorSearchModel + { + public int? Id { get; set; } + public string? MotorName { get; set; } + } +} diff --git a/MotorPlantContracts/SearchModels/OrderSearchModel.cs b/MotorPlantContracts/SearchModels/OrderSearchModel.cs new file mode 100644 index 0000000..2255ebd --- /dev/null +++ b/MotorPlantContracts/SearchModels/OrderSearchModel.cs @@ -0,0 +1,7 @@ +namespace MotorPlantContracts.SearchModels +{ + public class OrderSearchModel + { + public int? Id { get; set; } + } +} diff --git a/MotorPlantContracts/StoragesContracts/IComponentStorage.cs b/MotorPlantContracts/StoragesContracts/IComponentStorage.cs new file mode 100644 index 0000000..c6d5494 --- /dev/null +++ b/MotorPlantContracts/StoragesContracts/IComponentStorage.cs @@ -0,0 +1,16 @@ +using MotorPlantContracts.BindingModels; +using MotorPlantContracts.SearchModels; +using MotorPlantContracts.VeiwModels; + +namespace MotorPlantContracts.StoragesContracts +{ + public interface IComponentStorage + { + List GetFullList(); + List GetFilteredList(ComponentSearchModel model); + ComponentViewModel? GetElement(ComponentSearchModel model); + ComponentViewModel? Insert(ComponentBindingModel model); + ComponentViewModel? Update(ComponentBindingModel model); + ComponentViewModel? Delete(ComponentBindingModel model); + } +} diff --git a/MotorPlantContracts/StoragesContracts/IMotorStorage.cs b/MotorPlantContracts/StoragesContracts/IMotorStorage.cs new file mode 100644 index 0000000..7499d9c --- /dev/null +++ b/MotorPlantContracts/StoragesContracts/IMotorStorage.cs @@ -0,0 +1,16 @@ +using MotorPlantContracts.BindingModels; +using MotorPlantContracts.SearchModels; +using MotorPlantContracts.VeiwModels; + +namespace MotorPlantContracts.StoragesContracts +{ + public interface IMotorStorage + { + List GetFullList(); + List GetFilteredList(MotorSearchModel model); + MotorViewModel? GetElement(MotorSearchModel model); + MotorViewModel? Insert(MotorBindingModel model); + MotorViewModel? Update(MotorBindingModel model); + MotorViewModel? Delete(MotorBindingModel model); + } +} diff --git a/MotorPlantContracts/StoragesContracts/IOrderStorage.cs b/MotorPlantContracts/StoragesContracts/IOrderStorage.cs new file mode 100644 index 0000000..b4b196c --- /dev/null +++ b/MotorPlantContracts/StoragesContracts/IOrderStorage.cs @@ -0,0 +1,17 @@ +using MotorPlantContracts.BindingModels; +using MotorPlantContracts.SearchModels; +using MotorPlantContracts.VeiwModels; + + +namespace MotorPlantContracts.StoragesContracts +{ + public interface IOrderStorage + { + List GetFullList(); + List GetFilteredList(OrderSearchModel model); + OrderViewModel? GetElement(OrderSearchModel model); + OrderViewModel? Insert(OrderBindingModel model); + OrderViewModel? Update(OrderBindingModel model); + OrderViewModel? Delete(OrderBindingModel model); + } +} diff --git a/MotorPlantContracts/ViewModels/ComponentViewModel.cs b/MotorPlantContracts/ViewModels/ComponentViewModel.cs new file mode 100644 index 0000000..299cf60 --- /dev/null +++ b/MotorPlantContracts/ViewModels/ComponentViewModel.cs @@ -0,0 +1,14 @@ +using MotorPlantDataModels.Models; +using System.ComponentModel; +namespace MotorPlantContracts.VeiwModels +{ + public class ComponentViewModel: IComponentModel + { + public int Id { get; set; } + [DisplayName("Название компонента")] + public string ComponentName { get; set; } = string.Empty; + + [DisplayName("Цена")] + public double Cost { get; set; } + } +} diff --git a/MotorPlantContracts/ViewModels/MotorViewModel.cs b/MotorPlantContracts/ViewModels/MotorViewModel.cs new file mode 100644 index 0000000..d8cb694 --- /dev/null +++ b/MotorPlantContracts/ViewModels/MotorViewModel.cs @@ -0,0 +1,17 @@ +using MotorPlantDataModels.Models; +using System.ComponentModel; + +namespace MotorPlantContracts.VeiwModels +{ + public class MotorViewModel : IMotorModel + { + public int Id { get; set; } + [DisplayName("Название мотора")] + public string MotorName { get; set; } = string.Empty; + + [DisplayName("Цена")] + public double Price { get; set; } + public Dictionary MotorComponents { get; set; } = new(); + + } +} diff --git a/MotorPlantContracts/ViewModels/OrderViewModel.cs b/MotorPlantContracts/ViewModels/OrderViewModel.cs new file mode 100644 index 0000000..d3d7c42 --- /dev/null +++ b/MotorPlantContracts/ViewModels/OrderViewModel.cs @@ -0,0 +1,33 @@ +using MotorPlantDataModels.Enums; +using MotorPlantDataModels.Models; +using System.ComponentModel; +namespace MotorPlantContracts.VeiwModels +{ + public class OrderViewModel : IOrderModel + { + [DisplayName("Номер")] + public int Id { get; set; } + + public int MotorId { get; set; } + + [DisplayName("Мотор")] + public string MotorName { get; set; } = string.Empty; + + [DisplayName("Количество")] + public int Count { get; set; } + + [DisplayName("Сумма")] + public double Sum { get; set; } + + [DisplayName("Статус")] + public OrderStatus Status { get; set; } = OrderStatus.Неизвестен; + + [DisplayName("Дата создания")] + public DateTime DateCreate { get; set; } = DateTime.Now; + + [DisplayName("Дата выполнения")] + public DateTime? DateImplement { get; set; } + } + } + + diff --git a/MotorPlantDataModels/Enums/OrderStatus.cs b/MotorPlantDataModels/Enums/OrderStatus.cs new file mode 100644 index 0000000..3fec86a --- /dev/null +++ b/MotorPlantDataModels/Enums/OrderStatus.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace MotorPlantDataModels.Enums +{ + public enum OrderStatus + { + Неизвестен = -1, + + Принят = 0, + + Выполняется = 1, + + Готов = 2, + + Выдан = 3 + } +} diff --git a/MotorPlantDataModels/IId.cs b/MotorPlantDataModels/IId.cs new file mode 100644 index 0000000..d105c90 --- /dev/null +++ b/MotorPlantDataModels/IId.cs @@ -0,0 +1,7 @@ +namespace MotorPlantDataModels +{ + public interface IId + { + int Id { get; } + } +} diff --git a/MotorPlantDataModels/Models/IComponentModel.cs b/MotorPlantDataModels/Models/IComponentModel.cs new file mode 100644 index 0000000..7239b56 --- /dev/null +++ b/MotorPlantDataModels/Models/IComponentModel.cs @@ -0,0 +1,8 @@ +namespace MotorPlantDataModels.Models +{ + public interface IComponentModel : IId + { + string ComponentName { get; } + double Cost { get; } + } +} diff --git a/MotorPlantDataModels/Models/IMotorModel.cs b/MotorPlantDataModels/Models/IMotorModel.cs new file mode 100644 index 0000000..3a1322f --- /dev/null +++ b/MotorPlantDataModels/Models/IMotorModel.cs @@ -0,0 +1,9 @@ +namespace MotorPlantDataModels.Models +{ + public interface IMotorModel : IId + { + string MotorName { get; } + double Price { get; } + Dictionary MotorComponents { get; } + } +} diff --git a/MotorPlantDataModels/Models/IOrderModel.cs b/MotorPlantDataModels/Models/IOrderModel.cs new file mode 100644 index 0000000..6ddf0dc --- /dev/null +++ b/MotorPlantDataModels/Models/IOrderModel.cs @@ -0,0 +1,13 @@ +using MotorPlantDataModels.Enums; +namespace MotorPlantDataModels.Models +{ + public interface IOrderModel : IId + { + int MotorId { get; } + int Count { get; } + double Sum { get; } + OrderStatus Status { get; } + DateTime DateCreate { get; } + DateTime? DateImplement { get; } + } +} diff --git a/MotorPlantDataModels/MotorPlantDataModels.csproj b/MotorPlantDataModels/MotorPlantDataModels.csproj new file mode 100644 index 0000000..fa71b7a --- /dev/null +++ b/MotorPlantDataModels/MotorPlantDataModels.csproj @@ -0,0 +1,9 @@ + + + + net8.0 + enable + enable + + +