diff --git a/Confectionery/ConfectioneryBusinessLogic/ConfectioneryBusinessLogic.csproj b/Confectionery/ConfectioneryBusinessLogic/ConfectioneryBusinessLogic.csproj index 06e699f..4ccd651 100644 --- a/Confectionery/ConfectioneryBusinessLogic/ConfectioneryBusinessLogic.csproj +++ b/Confectionery/ConfectioneryBusinessLogic/ConfectioneryBusinessLogic.csproj @@ -18,6 +18,7 @@ + diff --git a/Confectionery/ConfectioneryBusinessLogic/ImplementerLogic.cs b/Confectionery/ConfectioneryBusinessLogic/ImplementerLogic.cs index e4daea6..2670a0d 100644 --- a/Confectionery/ConfectioneryBusinessLogic/ImplementerLogic.cs +++ b/Confectionery/ConfectioneryBusinessLogic/ImplementerLogic.cs @@ -1,4 +1,9 @@ using Microsoft.Extensions.Logging; +using ConfectioneryContracts.BindingModels; +using ConfectioneryContracts.BusinessLogicsContracts; +using ConfectioneryContracts.SearchModels; +using ConfectioneryContracts.StoragesContracts; +using ConfectioneryContracts.ViewModels; using System; using System.Collections.Generic; using System.Linq; diff --git a/Confectionery/ConfectioneryBusinessLogic/OrderLogic.cs b/Confectionery/ConfectioneryBusinessLogic/OrderLogic.cs index 4146e4e..a1a194a 100644 --- a/Confectionery/ConfectioneryBusinessLogic/OrderLogic.cs +++ b/Confectionery/ConfectioneryBusinessLogic/OrderLogic.cs @@ -22,7 +22,24 @@ namespace ConfectioneryBusinessLogic _logger = logger; _orderStorage = orderStorage; } - public List? ReadList(OrderSearchModel? model) + public OrderViewModel? ReadElement(OrderSearchModel model) + { + if (model == null) + { + throw new ArgumentNullException(nameof(model)); + } + _logger.LogInformation("ReadElement. ClientId:{ClientId}.Status:{Status}.ImplementerId:{ImplementerId}.DateFrom:{DateFrom}.DateTo:{DateTo}OrderId:{Id}", + model.ClientId, model.Status, model.ImplementerId, model.DateFrom, model.DateTo, model.Id); + var element = _orderStorage.GetElement(model); + if (element == null) + { + _logger.LogWarning("ReadElement element not found"); + return null; + } + _logger.LogInformation("ReadElement find. Id:{Id}", element.Id); + return element; + } + public List? ReadList(OrderSearchModel? model) { _logger.LogInformation("ReadList. OrderId:{Id}", model?.Id); var list = model == null ? _orderStorage.GetFullList() : _orderStorage.GetFilteredList(model); diff --git a/Confectionery/ConfectioneryContracts/BindingModels/ImplementerBindingModel.cs b/Confectionery/ConfectioneryContracts/BindingModels/ImplementerBindingModel.cs index 497558f..cb176e6 100644 --- a/Confectionery/ConfectioneryContracts/BindingModels/ImplementerBindingModel.cs +++ b/Confectionery/ConfectioneryContracts/BindingModels/ImplementerBindingModel.cs @@ -1,4 +1,4 @@ -using ConfectioneryDataModels; +using ConfectioneryDataModels.Models; using System; using System.Collections.Generic; using System.Linq; diff --git a/Confectionery/ConfectioneryContracts/BindingModels/OrderBindingModel.cs b/Confectionery/ConfectioneryContracts/BindingModels/OrderBindingModel.cs index d51f207..8beb956 100644 --- a/Confectionery/ConfectioneryContracts/BindingModels/OrderBindingModel.cs +++ b/Confectionery/ConfectioneryContracts/BindingModels/OrderBindingModel.cs @@ -13,7 +13,8 @@ namespace ConfectioneryContracts.BindingModels public int Id { get; set; } public int PastryId { get; set; } public int ClientId { get; set; } - public int Count { get; set; } + public int? ImplementerId { 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; diff --git a/Confectionery/ConfectioneryContracts/ViewModels/ImplementerViewModel.cs b/Confectionery/ConfectioneryContracts/ViewModels/ImplementerViewModel.cs index 559f526..7427339 100644 --- a/Confectionery/ConfectioneryContracts/ViewModels/ImplementerViewModel.cs +++ b/Confectionery/ConfectioneryContracts/ViewModels/ImplementerViewModel.cs @@ -1,4 +1,4 @@ -using ConfectioneryDataModels; +using ConfectioneryDataModels.Models; using System; using System.Collections.Generic; using System.ComponentModel; diff --git a/Confectionery/ConfectioneryDatabaseImplement/Implementer.cs b/Confectionery/ConfectioneryDatabaseImplement/Implementer.cs index 6a59216..7282a3e 100644 --- a/Confectionery/ConfectioneryDatabaseImplement/Implementer.cs +++ b/Confectionery/ConfectioneryDatabaseImplement/Implementer.cs @@ -9,7 +9,7 @@ using ConfectioneryDataModels.Models; using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations; -namespace ConfectioneryDatabaseImplement +namespace ConfectioneryDatabaseImplement.Models { public class Implementer : IImplementerModel { diff --git a/Confectionery/ConfectioneryFileImplement/Implementer.cs b/Confectionery/ConfectioneryFileImplement/Implementer.cs index 9445b09..586579a 100644 --- a/Confectionery/ConfectioneryFileImplement/Implementer.cs +++ b/Confectionery/ConfectioneryFileImplement/Implementer.cs @@ -54,8 +54,6 @@ namespace ConfectioneryFileImplement.Models }; } - - public void Update(ImplementerBindingModel model) { if (model == null) diff --git a/Confectionery/ConfectioneryFileImplement/ImplementerStorage.cs b/Confectionery/ConfectioneryFileImplement/ImplementerStorage.cs index 6276d35..fdf3b61 100644 --- a/Confectionery/ConfectioneryFileImplement/ImplementerStorage.cs +++ b/Confectionery/ConfectioneryFileImplement/ImplementerStorage.cs @@ -2,7 +2,7 @@ using ConfectioneryContracts.SearchModels; using ConfectioneryContracts.StoragesContracts; using ConfectioneryContracts.ViewModels; -using ConfectioneryDatabaseImplement; +using ConfectioneryFileImplement.Models; using System; using System.Collections.Generic; using System.Linq; diff --git a/Confectionery/ConfectioneryListImplement/DataListSingleton.cs b/Confectionery/ConfectioneryListImplement/DataListSingleton.cs index 4229679..76d7b3c 100644 --- a/Confectionery/ConfectioneryListImplement/DataListSingleton.cs +++ b/Confectionery/ConfectioneryListImplement/DataListSingleton.cs @@ -14,13 +14,15 @@ namespace ConfectioneryListImplement public List Orders { get; set; } public List Pastrys { get; set; } public List Clients { get; set; } - private DataListSingleton() + public List Implementers { get; set; } + private DataListSingleton() { Components = new List(); Orders = new List(); Pastrys = new List(); Clients = new List(); - } + Implementers = new List(); + } public static DataListSingleton GetInstance() { if (_instance == null) diff --git a/Confectionery/ConfectioneryListImplement/ImplementerStorage.cs b/Confectionery/ConfectioneryListImplement/ImplementerStorage.cs index 1780b1b..f4896e5 100644 --- a/Confectionery/ConfectioneryListImplement/ImplementerStorage.cs +++ b/Confectionery/ConfectioneryListImplement/ImplementerStorage.cs @@ -2,6 +2,7 @@ using ConfectioneryContracts.SearchModels; using ConfectioneryContracts.StoragesContracts; using ConfectioneryContracts.ViewModels; +using ConfectioneryListImplement.Models; using System; using System.Collections.Generic; using System.Linq;