From 950263a842bd209deb1dc8563c65770ee887e31d Mon Sep 17 00:00:00 2001 From: Programmist73 Date: Fri, 10 Feb 2023 12:19:17 +0400 Subject: [PATCH] =?UTF-8?q?=D0=98=D0=B7=D0=BC=D0=B5=D0=BD=D0=B5=D0=BD?= =?UTF-8?q?=D0=B8=D0=B5=20=D0=BD=D0=B0=D0=B7=D0=B2=D0=B0=D0=BD=D0=B8=D0=B9?= =?UTF-8?q?=20=D0=B2=20=D0=BF=D1=80=D0=BE=D0=B5=D0=BA=D1=82=D0=B5=20DataMo?= =?UTF-8?q?dels.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BusinessLogic/ComponentLogic.cs | 14 +++++++------- .../BusinessLogic/OrderLogic.cs | 6 +++--- .../BusinessLogic/ProductLogic.cs | 14 +++++++------- .../BindingModels/ComponentBindingModel.cs | 4 ++-- .../BindingModels/OrderBindingModel.cs | 2 +- .../BindingModels/ProductBindingModel.cs | 6 +++--- .../SearchModels/ComponentSearchModel.cs | 2 +- .../SearchModels/ProductSearchModel.cs | 2 +- .../ViewModels/ComponentViewModel.cs | 4 ++-- .../ViewModels/OrderViewModel.cs | 4 ++-- .../ViewModels/ProductViewModel.cs | 6 +++--- .../Models/{IProductModel.cs => IArticleModel.cs} | 6 +++--- .../Models/IOrderModel.cs | 4 ++-- .../{IComponentModel.cs => IWorkPieceModel.cs} | 4 ++-- 14 files changed, 39 insertions(+), 39 deletions(-) rename BlacksmithWorkshop/BlacksmithWorkshopDataModels/Models/{IProductModel.cs => IArticleModel.cs} (75%) rename BlacksmithWorkshop/BlacksmithWorkshopDataModels/Models/{IComponentModel.cs => IWorkPieceModel.cs} (84%) diff --git a/BlacksmithWorkshop/BlacksmithWorkshopBusinessLogic/BusinessLogic/ComponentLogic.cs b/BlacksmithWorkshop/BlacksmithWorkshopBusinessLogic/BusinessLogic/ComponentLogic.cs index 4daf480..9a73fda 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshopBusinessLogic/BusinessLogic/ComponentLogic.cs +++ b/BlacksmithWorkshop/BlacksmithWorkshopBusinessLogic/BusinessLogic/ComponentLogic.cs @@ -29,7 +29,7 @@ namespace BlacksmithWorkshopBusinessLogic.BusinessLogic //вывод отфильтрованного списка компонентов public List? ReadList(ComponentSearchModel? model) { - _logger.LogInformation("ReadList. ComponentName:{ComponentName}. Id:{Id}", model?.ComponentName, model?.Id); + _logger.LogInformation("ReadList. WorkPieceName:{WorkPieceName}. Id:{Id}", model?.WorkPieceName, model?.Id); //list хранит весь список в случае, если model пришло со значением null на вход метода var list = model == null ? _componentStorage.GetFullList() : _componentStorage.GetFilteredList(model); @@ -53,7 +53,7 @@ namespace BlacksmithWorkshopBusinessLogic.BusinessLogic throw new ArgumentNullException(nameof(model)); } - _logger.LogInformation("ReadElement. ComponentName:{Componentame}. Id:{Id}", model.ComponentName, model.Id); + _logger.LogInformation("ReadElement. WorkPieceName:{Componentame}. Id:{Id}", model.WorkPieceName, model.Id); var element = _componentStorage.GetElement(model); @@ -125,8 +125,8 @@ namespace BlacksmithWorkshopBusinessLogic.BusinessLogic } //проверка на наличие названия компонента - if (string.IsNullOrEmpty(model.ComponentName)){ - throw new ArgumentNullException("Нет названия компонента", nameof(model.ComponentName)); + if (string.IsNullOrEmpty(model.WorkPieceName)){ + throw new ArgumentNullException("Нет названия компонента", nameof(model.WorkPieceName)); } //проверка на наличие нормальной цены у компонента @@ -135,13 +135,13 @@ namespace BlacksmithWorkshopBusinessLogic.BusinessLogic throw new ArgumentNullException("Цена компонента должна быть больше 0", nameof(model.Cost)); } - _logger.LogInformation("Component. ComponentName:{ComponentName}. Cost:{Cost}. Id:{Id}", - model.ComponentName, model.Cost, model.Id); + _logger.LogInformation("Component. WorkPieceName:{WorkPieceName}. Cost:{Cost}. Id:{Id}", + model.WorkPieceName, model.Cost, model.Id); //проверка на наличие такого же компонента в списке var element = _componentStorage.GetElement(new ComponentSearchModel { - ComponentName = model.ComponentName, + WorkPieceName = model.WorkPieceName, }); if(element != null && element.Id != model.Id) diff --git a/BlacksmithWorkshop/BlacksmithWorkshopBusinessLogic/BusinessLogic/OrderLogic.cs b/BlacksmithWorkshop/BlacksmithWorkshopBusinessLogic/BusinessLogic/OrderLogic.cs index cb24790..f317b34 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshopBusinessLogic/BusinessLogic/OrderLogic.cs +++ b/BlacksmithWorkshop/BlacksmithWorkshopBusinessLogic/BusinessLogic/OrderLogic.cs @@ -110,9 +110,9 @@ namespace BlacksmithWorkshopBusinessLogic.BusinessLogic } //проверка корректности id у продуктов - if (model.ProductId < 0) + if (model.ArticleId < 0) { - throw new ArgumentNullException("Некорректный id у продукта", nameof(model.ProductId)); + throw new ArgumentNullException("Некорректный id у продукта", nameof(model.ArticleId)); } //проверка корректности дат @@ -121,7 +121,7 @@ namespace BlacksmithWorkshopBusinessLogic.BusinessLogic throw new InvalidOperationException("Дата создания должна быть более ранней, нежели дата завершения"); } - _logger.LogInformation("Order. OrderId:{Id}. Sun:{Sum}. ProductId:{Id}", model.Id, model.Sum, model.ProductId); + _logger.LogInformation("Order. OrderId:{Id}. Sun:{Sum}. ArticleId:{Id}", model.Id, model.Sum, model.ArticleId); } //обновление статуса заказа diff --git a/BlacksmithWorkshop/BlacksmithWorkshopBusinessLogic/BusinessLogic/ProductLogic.cs b/BlacksmithWorkshop/BlacksmithWorkshopBusinessLogic/BusinessLogic/ProductLogic.cs index f0d8dbf..b885924 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshopBusinessLogic/BusinessLogic/ProductLogic.cs +++ b/BlacksmithWorkshop/BlacksmithWorkshopBusinessLogic/BusinessLogic/ProductLogic.cs @@ -28,7 +28,7 @@ namespace BlacksmithWorkshopBusinessLogic.BusinessLogic //вывод отфильтрованного списка public List? ReadList(ProductSearchModel? model) { - _logger.LogInformation("ReadList. ProductName:{ProductName}. Id:{Id}", model?.ProductName, model?.Id); + _logger.LogInformation("ReadList. ArticleName:{ArticleName}. Id:{Id}", model?.ArticleName, model?.Id); //list хранит весь список в случае, если model пришло со значением null на вход метода var list = model == null ? _productStorage.GetFullList() : _productStorage.GetFilteredList(model); @@ -52,7 +52,7 @@ namespace BlacksmithWorkshopBusinessLogic.BusinessLogic throw new ArgumentNullException(nameof(model)); } - _logger.LogInformation("ReadProduct. ProductName:{ProductName}. Id:{Id}", model.ProductName, model.Id); + _logger.LogInformation("ReadProduct. ArticleName:{ArticleName}. Id:{Id}", model.ArticleName, model.Id); var element = _productStorage.GetElement(model); @@ -124,9 +124,9 @@ namespace BlacksmithWorkshopBusinessLogic.BusinessLogic } //проверка на наличие названия продукта - if (string.IsNullOrEmpty(model.ProductName)) + if (string.IsNullOrEmpty(model.ArticleName)) { - throw new ArgumentNullException("Нет названия продукта", nameof(model.ProductName)); + throw new ArgumentNullException("Нет названия продукта", nameof(model.ArticleName)); } //проверка на наличие нормальной цены у продукта @@ -135,13 +135,13 @@ namespace BlacksmithWorkshopBusinessLogic.BusinessLogic throw new ArgumentNullException("Цена продукта должна быть больше 0", nameof(model.Price)); } - _logger.LogInformation("Product. ProductName:{ProductName}. Price:{Price}. Id:{Id}", - model.ProductName, model.Price, model.Id); + _logger.LogInformation("Product. ArticleName:{ArticleName}. Price:{Price}. Id:{Id}", + model.ArticleName, model.Price, model.Id); //проверка на наличие такого же продукта в списке var element = _productStorage.GetElement(new ProductSearchModel { - ProductName = model.ProductName, + ArticleName = model.ArticleName, }); if(element != null && element.Id != model.Id) diff --git a/BlacksmithWorkshop/BlacksmithWorkshopContracts/BindingModels/ComponentBindingModel.cs b/BlacksmithWorkshop/BlacksmithWorkshopContracts/BindingModels/ComponentBindingModel.cs index 5dc4a58..9b6949f 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshopContracts/BindingModels/ComponentBindingModel.cs +++ b/BlacksmithWorkshop/BlacksmithWorkshopContracts/BindingModels/ComponentBindingModel.cs @@ -8,12 +8,12 @@ using BlacksmithWorkshopDataModels.Models; namespace BlacksmithWorkshopContracts.BindingModels { //реализация сущности "Компонент" - public class ComponentBindingModel : IComponentModel + public class ComponentBindingModel : IWorkPieceModel { public int Id { get; set; } public double Cost { get; set; } - public string ComponentName { get; set; } = string.Empty; + public string WorkPieceName { get; set; } = string.Empty; } } diff --git a/BlacksmithWorkshop/BlacksmithWorkshopContracts/BindingModels/OrderBindingModel.cs b/BlacksmithWorkshop/BlacksmithWorkshopContracts/BindingModels/OrderBindingModel.cs index 641b634..ec8912a 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshopContracts/BindingModels/OrderBindingModel.cs +++ b/BlacksmithWorkshop/BlacksmithWorkshopContracts/BindingModels/OrderBindingModel.cs @@ -13,7 +13,7 @@ namespace BlacksmithWorkshopContracts.BindingModels { public int Id { get; set; } - public int ProductId { get; set; } + public int ArticleId { get; set; } public int Count { get; set; } diff --git a/BlacksmithWorkshop/BlacksmithWorkshopContracts/BindingModels/ProductBindingModel.cs b/BlacksmithWorkshop/BlacksmithWorkshopContracts/BindingModels/ProductBindingModel.cs index f8f5ddd..48d689f 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshopContracts/BindingModels/ProductBindingModel.cs +++ b/BlacksmithWorkshop/BlacksmithWorkshopContracts/BindingModels/ProductBindingModel.cs @@ -8,14 +8,14 @@ using System.Threading.Tasks; namespace BlacksmithWorkshopContracts.BindingModels { //реализация сущности "Продукт" - public class ProductBindingModel : IProductModel + public class ProductBindingModel : IArticleModel { public int Id { get; set; } - public string ProductName { get; set; } = string.Empty; + public string ArticleName { get; set; } = string.Empty; public double Price { get; set; } - public Dictionary ProductComponents { get; set; } = new(); + public Dictionary ArticleWorkPiece { get; set; } = new(); } } diff --git a/BlacksmithWorkshop/BlacksmithWorkshopContracts/SearchModels/ComponentSearchModel.cs b/BlacksmithWorkshop/BlacksmithWorkshopContracts/SearchModels/ComponentSearchModel.cs index c858c99..302941e 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshopContracts/SearchModels/ComponentSearchModel.cs +++ b/BlacksmithWorkshop/BlacksmithWorkshopContracts/SearchModels/ComponentSearchModel.cs @@ -13,7 +13,7 @@ namespace BlacksmithWorkshopContracts.SearchModels public int? Id { get; set; } //для поиска по названию - public string? ComponentName { get; set; } + public string? WorkPieceName { get; set; } } } diff --git a/BlacksmithWorkshop/BlacksmithWorkshopContracts/SearchModels/ProductSearchModel.cs b/BlacksmithWorkshop/BlacksmithWorkshopContracts/SearchModels/ProductSearchModel.cs index 647bb18..561f80b 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshopContracts/SearchModels/ProductSearchModel.cs +++ b/BlacksmithWorkshop/BlacksmithWorkshopContracts/SearchModels/ProductSearchModel.cs @@ -13,6 +13,6 @@ namespace BlacksmithWorkshopContracts.SearchModels public int? Id { get; set; } //для поиска по названию - public string? ProductName { get; set; } + public string? ArticleName { get; set; } } } diff --git a/BlacksmithWorkshop/BlacksmithWorkshopContracts/ViewModels/ComponentViewModel.cs b/BlacksmithWorkshop/BlacksmithWorkshopContracts/ViewModels/ComponentViewModel.cs index 39f6ebe..72e1ecd 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshopContracts/ViewModels/ComponentViewModel.cs +++ b/BlacksmithWorkshop/BlacksmithWorkshopContracts/ViewModels/ComponentViewModel.cs @@ -9,12 +9,12 @@ using System.Threading.Tasks; namespace BlacksmithWorkshopContracts.ViewModels { //класс для отображения пользователю данных о компонентах - public class ComponentViewModel : IComponentModel + public class ComponentViewModel : IWorkPieceModel { public int Id { get; set; } [DisplayName("Название компонента")] - public string ComponentName { get; set; } = string.Empty; + public string WorkPieceName { get; set; } = string.Empty; [DisplayName("Цена")] public double Cost { get; set; } diff --git a/BlacksmithWorkshop/BlacksmithWorkshopContracts/ViewModels/OrderViewModel.cs b/BlacksmithWorkshop/BlacksmithWorkshopContracts/ViewModels/OrderViewModel.cs index c964335..8fe2993 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshopContracts/ViewModels/OrderViewModel.cs +++ b/BlacksmithWorkshop/BlacksmithWorkshopContracts/ViewModels/OrderViewModel.cs @@ -15,10 +15,10 @@ namespace BlacksmithWorkshopContracts.ViewModels [DisplayName("Номер")] public int Id { get; set; } - public int ProductId { get; set; } + public int ArticleId { get; set; } [DisplayName("Изделие")] - public string ProductName { get; set; } = string.Empty; + public string ArticleName { get; set; } = string.Empty; [DisplayName("Количество")] public int Count { get; set; } diff --git a/BlacksmithWorkshop/BlacksmithWorkshopContracts/ViewModels/ProductViewModel.cs b/BlacksmithWorkshop/BlacksmithWorkshopContracts/ViewModels/ProductViewModel.cs index 9845e07..d400fca 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshopContracts/ViewModels/ProductViewModel.cs +++ b/BlacksmithWorkshop/BlacksmithWorkshopContracts/ViewModels/ProductViewModel.cs @@ -9,16 +9,16 @@ using System.Threading.Tasks; namespace BlacksmithWorkshopContracts.ViewModels { //класс для отображения пользователю информаци о продуктах - public class ProductViewModel : IProductModel + public class ProductViewModel : IArticleModel { public int Id { get; set; } [DisplayName("Навание изделия")] - public string ProductName { get; set; } = string.Empty; + public string ArticleName { get; set; } = string.Empty; [DisplayName("Цена")] public double Price { get; set; } - public Dictionary ProductComponents { get; set; } = new(); + public Dictionary ArticleWorkPiece { get; set; } = new(); } } diff --git a/BlacksmithWorkshop/BlacksmithWorkshopDataModels/Models/IProductModel.cs b/BlacksmithWorkshop/BlacksmithWorkshopDataModels/Models/IArticleModel.cs similarity index 75% rename from BlacksmithWorkshop/BlacksmithWorkshopDataModels/Models/IProductModel.cs rename to BlacksmithWorkshop/BlacksmithWorkshopDataModels/Models/IArticleModel.cs index f1d79df..b4437a5 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshopDataModels/Models/IProductModel.cs +++ b/BlacksmithWorkshop/BlacksmithWorkshopDataModels/Models/IArticleModel.cs @@ -7,15 +7,15 @@ using System.Threading.Tasks; namespace BlacksmithWorkshopDataModels.Models { //интерфейс, отвечающий за продукт - public interface IProductModel : IId + public interface IArticleModel : IId { //наименование изделия - string ProductName { get; } + string ArticleName { get; } //цена изделия double Price { get; } //словарь, хранящий пары кол-во + компонент и его цена - Dictionary ProductComponents { get; } + Dictionary ArticleWorkPiece { get; } } } diff --git a/BlacksmithWorkshop/BlacksmithWorkshopDataModels/Models/IOrderModel.cs b/BlacksmithWorkshop/BlacksmithWorkshopDataModels/Models/IOrderModel.cs index df8dd03..601726f 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshopDataModels/Models/IOrderModel.cs +++ b/BlacksmithWorkshop/BlacksmithWorkshopDataModels/Models/IOrderModel.cs @@ -7,11 +7,11 @@ using BlacksmithWorkshopDataModels.Enums; namespace BlacksmithWorkshopDataModels.Models { - //интерфейс, отвечающий за чек + //интерфейс, отвечающий за заказ public interface IOrderModel : IId { //id продукта - int ProductId { get; } + int ArticleId { get; } //кол-во продуктов int Count { get; } diff --git a/BlacksmithWorkshop/BlacksmithWorkshopDataModels/Models/IComponentModel.cs b/BlacksmithWorkshop/BlacksmithWorkshopDataModels/Models/IWorkPieceModel.cs similarity index 84% rename from BlacksmithWorkshop/BlacksmithWorkshopDataModels/Models/IComponentModel.cs rename to BlacksmithWorkshop/BlacksmithWorkshopDataModels/Models/IWorkPieceModel.cs index 01c03ce..18310ad 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshopDataModels/Models/IComponentModel.cs +++ b/BlacksmithWorkshop/BlacksmithWorkshopDataModels/Models/IWorkPieceModel.cs @@ -7,10 +7,10 @@ using System.Threading.Tasks; namespace BlacksmithWorkshopDataModels.Models { //интерфейс, отвечающий за компоненты - public interface IComponentModel : IId + public interface IWorkPieceModel : IId { //название составляющей (изделие состоит из составляющих) - string ComponentName { get; } + string WorkPieceName { get; } //цена составляющей double Cost { get; }