From c0a995386480435c247ff8523045ef63922217a7 Mon Sep 17 00:00:00 2001 From: Marselchi Date: Sun, 28 Apr 2024 13:50:33 +0400 Subject: [PATCH 1/6] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=BD=D1=8B=20=D0=BC=D0=BE=D0=B4=D0=B5=D0=BB=D0=B8=20?= =?UTF-8?q?=D0=B8=20=D0=BD=D0=B5=D1=81=D0=BA=D0=BE=D0=BB=D1=8C=D0=BA=D0=BE?= =?UTF-8?q?=20enum,=20=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5=D0=BD=20?= =?UTF-8?q?=D1=81=D1=82=D0=B0=D1=82=D1=83=D1=81=20=D0=9D=D0=B5=D0=B8=D0=B7?= =?UTF-8?q?=D0=B2=D0=B5=D1=81=D1=82=D0=BD=D0=BE=20=D0=B2=D0=BE=20=D0=B2?= =?UTF-8?q?=D1=81=D0=B5=20enum?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CarCenterDataModels/Enums/CarBrand.cs | 1 + .../CarCenterDataModels/Enums/CarClass.cs | 1 + .../CarCenterDataModels/Enums/DriveTypes.cs | 1 + .../Enums/EquipmentPackage.cs | 1 + .../CarCenterDataModels/Enums/HelpDevices.cs | 1 + .../Enums/PaymentStatus.cs | 15 ++++++++++++ .../CarCenterDataModels/Enums/PaymentType.cs | 15 ++++++++++++ .../Enums/PresaleStatus.cs | 15 ++++++++++++ .../CarCenterDataModels/Enums/RequestTypes.cs | 14 +++++++++++ .../CarCenterDataModels/Enums/TirePackage.cs | 1 + .../CarCenterDataModels/Enums/ToolKit.cs | 1 + .../CarCenterDataModels/Models/IOrderModel.cs | 23 +++++++++++++++++++ .../Models/IPresaleModel.cs | 21 +++++++++++++++++ .../Models/IRequestModel.cs | 16 +++++++++++++ .../Models/IWorkerModel.cs | 19 +++++++++++++++ 15 files changed, 145 insertions(+) create mode 100644 CarCenter/CarCenterDataModels/Enums/PaymentStatus.cs create mode 100644 CarCenter/CarCenterDataModels/Enums/PaymentType.cs create mode 100644 CarCenter/CarCenterDataModels/Enums/PresaleStatus.cs create mode 100644 CarCenter/CarCenterDataModels/Enums/RequestTypes.cs create mode 100644 CarCenter/CarCenterDataModels/Models/IOrderModel.cs create mode 100644 CarCenter/CarCenterDataModels/Models/IPresaleModel.cs create mode 100644 CarCenter/CarCenterDataModels/Models/IRequestModel.cs create mode 100644 CarCenter/CarCenterDataModels/Models/IWorkerModel.cs diff --git a/CarCenter/CarCenterDataModels/Enums/CarBrand.cs b/CarCenter/CarCenterDataModels/Enums/CarBrand.cs index 72f1daa..747d6f4 100644 --- a/CarCenter/CarCenterDataModels/Enums/CarBrand.cs +++ b/CarCenter/CarCenterDataModels/Enums/CarBrand.cs @@ -8,6 +8,7 @@ namespace CarCenterDataModels.Enums { public enum CarBrand { + Неизвестно = -1, Лада = 0, Тойота = 1, Опель = 2, diff --git a/CarCenter/CarCenterDataModels/Enums/CarClass.cs b/CarCenter/CarCenterDataModels/Enums/CarClass.cs index 26e0001..0c2bc88 100644 --- a/CarCenter/CarCenterDataModels/Enums/CarClass.cs +++ b/CarCenter/CarCenterDataModels/Enums/CarClass.cs @@ -8,6 +8,7 @@ namespace CarCenterDataModels.Enums { public enum CarClass { + Неизвестно = -1, Седан = 0, Хетчбек = 1, Универсал = 2, diff --git a/CarCenter/CarCenterDataModels/Enums/DriveTypes.cs b/CarCenter/CarCenterDataModels/Enums/DriveTypes.cs index 4cc547c..9947c64 100644 --- a/CarCenter/CarCenterDataModels/Enums/DriveTypes.cs +++ b/CarCenter/CarCenterDataModels/Enums/DriveTypes.cs @@ -8,6 +8,7 @@ namespace CarCenterDataModels.Enums { public enum DriveTypes { + Неизвестно = -1, Полный = 0, Передний = 1, Задний = 2, diff --git a/CarCenter/CarCenterDataModels/Enums/EquipmentPackage.cs b/CarCenter/CarCenterDataModels/Enums/EquipmentPackage.cs index 5a89855..37f619f 100644 --- a/CarCenter/CarCenterDataModels/Enums/EquipmentPackage.cs +++ b/CarCenter/CarCenterDataModels/Enums/EquipmentPackage.cs @@ -8,6 +8,7 @@ namespace CarCenterDataModels.Enums { public enum EquipmentPackage { + Неизвестно = -1, УлучшенныеТормоза = 0, ТурбоНабор = 1, Компрессор = 2, diff --git a/CarCenter/CarCenterDataModels/Enums/HelpDevices.cs b/CarCenter/CarCenterDataModels/Enums/HelpDevices.cs index da5ee1d..24ec88f 100644 --- a/CarCenter/CarCenterDataModels/Enums/HelpDevices.cs +++ b/CarCenter/CarCenterDataModels/Enums/HelpDevices.cs @@ -8,6 +8,7 @@ namespace CarCenterDataModels.Enums { public enum HelpDevices { + Неизвестно = -1, ABS = 0, ECS = 1, ПодушкиБезопасноти = 2, diff --git a/CarCenter/CarCenterDataModels/Enums/PaymentStatus.cs b/CarCenter/CarCenterDataModels/Enums/PaymentStatus.cs new file mode 100644 index 0000000..66f2409 --- /dev/null +++ b/CarCenter/CarCenterDataModels/Enums/PaymentStatus.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CarCenterDataModels.Enums +{ + public enum PaymentStatus + { + Неизвестно = -1, + ОжидаетОплаты = 0, + Оплачено = 1, + } +} diff --git a/CarCenter/CarCenterDataModels/Enums/PaymentType.cs b/CarCenter/CarCenterDataModels/Enums/PaymentType.cs new file mode 100644 index 0000000..eda9691 --- /dev/null +++ b/CarCenter/CarCenterDataModels/Enums/PaymentType.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CarCenterDataModels.Enums +{ + public enum PaymentType + { + Неизвестно = -1, + Безналичная = 0, + Наличные = 1, + } +} diff --git a/CarCenter/CarCenterDataModels/Enums/PresaleStatus.cs b/CarCenter/CarCenterDataModels/Enums/PresaleStatus.cs new file mode 100644 index 0000000..eef002e --- /dev/null +++ b/CarCenter/CarCenterDataModels/Enums/PresaleStatus.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CarCenterDataModels.Enums +{ + public enum PresaleStatus + { + Неизвестно = -1, + Выполняется = 0, + Выполнено = 1 + } +} diff --git a/CarCenter/CarCenterDataModels/Enums/RequestTypes.cs b/CarCenter/CarCenterDataModels/Enums/RequestTypes.cs new file mode 100644 index 0000000..59601c6 --- /dev/null +++ b/CarCenter/CarCenterDataModels/Enums/RequestTypes.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CarCenterDataModels.Enums +{ + public enum RequestTypes + { + Неизвестно = -1, + Интерьер = 0 + } +} diff --git a/CarCenter/CarCenterDataModels/Enums/TirePackage.cs b/CarCenter/CarCenterDataModels/Enums/TirePackage.cs index 377f7fb..bb36cf0 100644 --- a/CarCenter/CarCenterDataModels/Enums/TirePackage.cs +++ b/CarCenter/CarCenterDataModels/Enums/TirePackage.cs @@ -8,6 +8,7 @@ namespace CarCenterDataModels.Enums { public enum TirePackage { + Неизвестно = -1, ЗимнийШипы = 0, ЗимнийЛипучка = 1, Летний = 2, diff --git a/CarCenter/CarCenterDataModels/Enums/ToolKit.cs b/CarCenter/CarCenterDataModels/Enums/ToolKit.cs index 6bc1bb5..c908fda 100644 --- a/CarCenter/CarCenterDataModels/Enums/ToolKit.cs +++ b/CarCenter/CarCenterDataModels/Enums/ToolKit.cs @@ -8,6 +8,7 @@ namespace CarCenterDataModels.Enums { public enum ToolKit { + Неизвестно = -1, Чемоданчик = 0, ЧемоданчикПро = 1, Наборчик = 2, diff --git a/CarCenter/CarCenterDataModels/Models/IOrderModel.cs b/CarCenter/CarCenterDataModels/Models/IOrderModel.cs new file mode 100644 index 0000000..d759a28 --- /dev/null +++ b/CarCenter/CarCenterDataModels/Models/IOrderModel.cs @@ -0,0 +1,23 @@ +using CarCenterDataModels.Enums; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CarCenterDataModels.Models +{ + public interface IOrderModel : IId + { + PaymentType PaymentType { get; } + + PaymentStatus PaymentStatus { get; } + + string BuyerFCS { get; } + + DateTime PaymentDate { get; } + + double Sum { get; } + + } +} diff --git a/CarCenter/CarCenterDataModels/Models/IPresaleModel.cs b/CarCenter/CarCenterDataModels/Models/IPresaleModel.cs new file mode 100644 index 0000000..49d8b3a --- /dev/null +++ b/CarCenter/CarCenterDataModels/Models/IPresaleModel.cs @@ -0,0 +1,21 @@ +using CarCenterDataModels.Enums; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CarCenterDataModels.Models +{ + public interface IPresaleModel : IId + { + PresaleStatus PresaleStatus { get; } + + string Description { get; } + + DateTime DueTill { get; } + + double Price { get; } + + } +} diff --git a/CarCenter/CarCenterDataModels/Models/IRequestModel.cs b/CarCenter/CarCenterDataModels/Models/IRequestModel.cs new file mode 100644 index 0000000..94f4051 --- /dev/null +++ b/CarCenter/CarCenterDataModels/Models/IRequestModel.cs @@ -0,0 +1,16 @@ +using CarCenterDataModels.Enums; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CarCenterDataModels.Models +{ + public interface IRequestModel : IId + { + string Description { get; } + + RequestTypes RequestType { get; } + } +} diff --git a/CarCenter/CarCenterDataModels/Models/IWorkerModel.cs b/CarCenter/CarCenterDataModels/Models/IWorkerModel.cs new file mode 100644 index 0000000..d328cd5 --- /dev/null +++ b/CarCenter/CarCenterDataModels/Models/IWorkerModel.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CarCenterDataModels.Models +{ + public interface IWorkerModel : IId + { + string Name { get; } + string Surname { get; } + string? Patronymic { get; } + string Password { get; } + string Email { get; } + long PhoneNumber { get; } + + } +} From 44b852ca26545f79218e706f1096435dc1270dc4 Mon Sep 17 00:00:00 2001 From: Marselchi Date: Sun, 28 Apr 2024 13:58:15 +0400 Subject: [PATCH 2/6] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20BindingModels=20+=20=D0=B4=D0=BE=D0=B1?= =?UTF-8?q?=D0=B0=D0=B2=D0=BB=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=BD=D0=B0=D1=87?= =?UTF-8?q?=D0=B0=D0=BB=D1=8C=D0=BD=D1=8B=D1=85=20=D0=B7=D0=BD=D0=B0=D1=87?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D0=B9=20enum?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BindingModels/BundlingBindingModel.cs | 6 ++--- .../BindingModels/CarBindingModel.cs | 4 +-- .../BindingModels/FeatureBindingModel.cs | 4 +-- .../BindingModels/OrderBindingModel.cs | 26 +++++++++++++++++++ .../BindingModels/PresaleBindingModel.cs | 23 ++++++++++++++++ .../BindingModels/RequestBindingModel.cs | 18 +++++++++++++ .../BindingModels/WorkerBindingModel.cs | 20 ++++++++++++++ .../CarCenterDataModels/Enums/RequestTypes.cs | 4 ++- 8 files changed, 97 insertions(+), 8 deletions(-) create mode 100644 CarCenter/CarCenterContracts/BindingModels/OrderBindingModel.cs create mode 100644 CarCenter/CarCenterContracts/BindingModels/PresaleBindingModel.cs create mode 100644 CarCenter/CarCenterContracts/BindingModels/RequestBindingModel.cs create mode 100644 CarCenter/CarCenterContracts/BindingModels/WorkerBindingModel.cs diff --git a/CarCenter/CarCenterContracts/BindingModels/BundlingBindingModel.cs b/CarCenter/CarCenterContracts/BindingModels/BundlingBindingModel.cs index 56e6257..a52fe68 100644 --- a/CarCenter/CarCenterContracts/BindingModels/BundlingBindingModel.cs +++ b/CarCenter/CarCenterContracts/BindingModels/BundlingBindingModel.cs @@ -11,9 +11,9 @@ namespace CarCenterContracts.BindingModels public class BundlingBindingModel : IBundlingModel { public int Id { get; set; } - public EquipmentPackage EquipmentPackage { get; set; } - public TirePackage TirePackage { get; set; } - public ToolKit ToolKit { get; set; } + public EquipmentPackage EquipmentPackage { get; set; } = EquipmentPackage.Неизвестно; + public TirePackage TirePackage { get; set; } = TirePackage.Неизвестно; + public ToolKit ToolKit { get; set; } = ToolKit.Неизвестно; public double Price { get; set; } } } diff --git a/CarCenter/CarCenterContracts/BindingModels/CarBindingModel.cs b/CarCenter/CarCenterContracts/BindingModels/CarBindingModel.cs index af96b89..384066e 100644 --- a/CarCenter/CarCenterContracts/BindingModels/CarBindingModel.cs +++ b/CarCenter/CarCenterContracts/BindingModels/CarBindingModel.cs @@ -11,9 +11,9 @@ namespace CarCenterContracts.BindingModels public class CarBindingModel : ICarModel { public int Id { get; set; } - public CarBrand CarBrand { get; set; } + public CarBrand CarBrand { get; set; } = CarBrand.Неизвестно; public string Model { get; set; } = string.Empty; - public CarClass CarClass { get; set; } + public CarClass CarClass { get; set; } = CarClass.Неизвестно; public int Year { get; set; } public double Price { get; set; } public long VINnumber { get; set; } diff --git a/CarCenter/CarCenterContracts/BindingModels/FeatureBindingModel.cs b/CarCenter/CarCenterContracts/BindingModels/FeatureBindingModel.cs index f1b2a48..d3dbf25 100644 --- a/CarCenter/CarCenterContracts/BindingModels/FeatureBindingModel.cs +++ b/CarCenter/CarCenterContracts/BindingModels/FeatureBindingModel.cs @@ -11,9 +11,9 @@ namespace CarCenterContracts.BindingModels public class FeatureBindingModel : IFeatureModel { public int Id { get; set; } - public HelpDevices HelpDevice { get; set; } + public HelpDevices HelpDevice { get; set; } = HelpDevices.Неизвестно; public string CabinColor { get; set; } = string.Empty; - public DriveTypes DriveType { get; set; } + public DriveTypes DriveType { get; set; } = DriveTypes.Неизвестно; public double Price { get; set; } } } diff --git a/CarCenter/CarCenterContracts/BindingModels/OrderBindingModel.cs b/CarCenter/CarCenterContracts/BindingModels/OrderBindingModel.cs new file mode 100644 index 0000000..8b2bc0b --- /dev/null +++ b/CarCenter/CarCenterContracts/BindingModels/OrderBindingModel.cs @@ -0,0 +1,26 @@ +using CarCenterDataModels.Enums; +using CarCenterDataModels.Models; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CarCenterContracts.BindingModels +{ + public class OrderBindingModel : IOrderModel + { + public int Id { get; set; } + public PaymentType PaymentType { get; set; } = PaymentType.Неизвестно; + + public PaymentStatus PaymentStatus { get; set; } = PaymentStatus.Неизвестно; + + public string BuyerFCS { get; set; } = string.Empty; + + public DateTime PaymentDate { get; set; } + + public double Sum { get; set; } + + + } +} diff --git a/CarCenter/CarCenterContracts/BindingModels/PresaleBindingModel.cs b/CarCenter/CarCenterContracts/BindingModels/PresaleBindingModel.cs new file mode 100644 index 0000000..8797748 --- /dev/null +++ b/CarCenter/CarCenterContracts/BindingModels/PresaleBindingModel.cs @@ -0,0 +1,23 @@ +using CarCenterDataModels.Enums; +using CarCenterDataModels.Models; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CarCenterContracts.BindingModels +{ + public class PresaleBindingModel : IPresaleModel + { + public int Id { get; set; } + public PresaleStatus PresaleStatus { get; set; } = PresaleStatus.Неизвестно; + + public string Description { get; set; } = string.Empty; + + public DateTime DueTill { get; set; } + + public double Price { get; set; } + + } +} diff --git a/CarCenter/CarCenterContracts/BindingModels/RequestBindingModel.cs b/CarCenter/CarCenterContracts/BindingModels/RequestBindingModel.cs new file mode 100644 index 0000000..489770e --- /dev/null +++ b/CarCenter/CarCenterContracts/BindingModels/RequestBindingModel.cs @@ -0,0 +1,18 @@ +using CarCenterDataModels.Enums; +using CarCenterDataModels.Models; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CarCenterContracts.BindingModels +{ + public class RequestBindingModel : IRequestModel + { + public int Id { get; set; } + public string Description { get; set; } = string.Empty; + public RequestTypes RequestType { get; set; } = RequestTypes.Неизвестно; + + } +} diff --git a/CarCenter/CarCenterContracts/BindingModels/WorkerBindingModel.cs b/CarCenter/CarCenterContracts/BindingModels/WorkerBindingModel.cs new file mode 100644 index 0000000..c0fa9ef --- /dev/null +++ b/CarCenter/CarCenterContracts/BindingModels/WorkerBindingModel.cs @@ -0,0 +1,20 @@ +using CarCenterDataModels.Models; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CarCenterContracts.BindingModels +{ + public class WorkerBindingModel : IWorkerModel + { + public int Id { get; set; } + public string Name { get; set; } = string.Empty; + public string Surname { get; set; } = string.Empty; + public string? Patronymic { get; set; } + public string Password { get; set; } = string.Empty; + public string Email { get; set; } = string.Empty; + public long PhoneNumber { get; set; } + } +} diff --git a/CarCenter/CarCenterDataModels/Enums/RequestTypes.cs b/CarCenter/CarCenterDataModels/Enums/RequestTypes.cs index 59601c6..e0ef42c 100644 --- a/CarCenter/CarCenterDataModels/Enums/RequestTypes.cs +++ b/CarCenter/CarCenterDataModels/Enums/RequestTypes.cs @@ -9,6 +9,8 @@ namespace CarCenterDataModels.Enums public enum RequestTypes { Неизвестно = -1, - Интерьер = 0 + Интерьер = 0, + Детали = 1, + Сотрудники = 2 } } From 6b059f0df7aa87de981c3e004dbdc79c6dd83e7f Mon Sep 17 00:00:00 2001 From: Marselchi Date: Sun, 28 Apr 2024 14:01:21 +0400 Subject: [PATCH 3/6] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20SearchModels?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CarCenterContracts/CarCenterContracts.csproj | 1 - .../SearchModels/OrderSearchModel.cs | 15 +++++++++++++++ .../SearchModels/PresaleSearchModel.cs | 13 +++++++++++++ .../SearchModels/RequestSearchModel.cs | 13 +++++++++++++ .../SearchModels/WorkerSearchModel.cs | 13 +++++++++++++ 5 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 CarCenter/CarCenterContracts/SearchModels/OrderSearchModel.cs create mode 100644 CarCenter/CarCenterContracts/SearchModels/PresaleSearchModel.cs create mode 100644 CarCenter/CarCenterContracts/SearchModels/RequestSearchModel.cs create mode 100644 CarCenter/CarCenterContracts/SearchModels/WorkerSearchModel.cs diff --git a/CarCenter/CarCenterContracts/CarCenterContracts.csproj b/CarCenter/CarCenterContracts/CarCenterContracts.csproj index 8b0c520..47a90e7 100644 --- a/CarCenter/CarCenterContracts/CarCenterContracts.csproj +++ b/CarCenter/CarCenterContracts/CarCenterContracts.csproj @@ -7,7 +7,6 @@ - diff --git a/CarCenter/CarCenterContracts/SearchModels/OrderSearchModel.cs b/CarCenter/CarCenterContracts/SearchModels/OrderSearchModel.cs new file mode 100644 index 0000000..03f8ad2 --- /dev/null +++ b/CarCenter/CarCenterContracts/SearchModels/OrderSearchModel.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CarCenterContracts.SearchModels +{ + public class OrderSearchModel + { + public int? Id { get; set; } + + public string? BuyerFCS { get; set; } + } +} diff --git a/CarCenter/CarCenterContracts/SearchModels/PresaleSearchModel.cs b/CarCenter/CarCenterContracts/SearchModels/PresaleSearchModel.cs new file mode 100644 index 0000000..bc47e29 --- /dev/null +++ b/CarCenter/CarCenterContracts/SearchModels/PresaleSearchModel.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CarCenterContracts.SearchModels +{ + public class PresaleSearchModel + { + public int? Id { get; set; } + } +} diff --git a/CarCenter/CarCenterContracts/SearchModels/RequestSearchModel.cs b/CarCenter/CarCenterContracts/SearchModels/RequestSearchModel.cs new file mode 100644 index 0000000..b3acec1 --- /dev/null +++ b/CarCenter/CarCenterContracts/SearchModels/RequestSearchModel.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CarCenterContracts.SearchModels +{ + public class RequestSearchModel + { + public int? Id { get; set; } + } +} diff --git a/CarCenter/CarCenterContracts/SearchModels/WorkerSearchModel.cs b/CarCenter/CarCenterContracts/SearchModels/WorkerSearchModel.cs new file mode 100644 index 0000000..26abf9d --- /dev/null +++ b/CarCenter/CarCenterContracts/SearchModels/WorkerSearchModel.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CarCenterContracts.SearchModels +{ + public class WorkerSearchModel + { + public int? Id { get; set; } + } +} From 6653d056d3d8decb8a0747f8f362ca8722c2a28f Mon Sep 17 00:00:00 2001 From: Marselchi Date: Sun, 28 Apr 2024 14:12:42 +0400 Subject: [PATCH 4/6] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20=D0=BA=D0=BE=D0=BD=D1=82=D1=80=D0=B0=D0=BA?= =?UTF-8?q?=D1=82=D0=BE=D0=B2=20=D0=B1=D0=B8=D0=B7=D0=BD=D0=B5=D1=81=20?= =?UTF-8?q?=D0=BB=D0=BE=D0=B3=D0=B8=D0=BA=D0=B8=20+=20ViewModels?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BusinessLogicsContracts/IOrderLogic.cs | 20 ++++++++++++++ .../BusinessLogicsContracts/IPresaleLogic.cs | 20 ++++++++++++++ .../BusinessLogicsContracts/IRequestLogic.cs | 20 ++++++++++++++ .../BusinessLogicsContracts/IWorkerLogic.cs | 20 ++++++++++++++ .../CarCenterContracts.csproj | 4 --- .../ViewModels/OrderViewModel.cs | 26 ++++++++++++++++++ .../ViewModels/PresaleViewModel.cs | 24 +++++++++++++++++ .../ViewModels/RequestViewModel.cs | 20 ++++++++++++++ .../ViewModels/WorkerViewModel.cs | 27 +++++++++++++++++++ 9 files changed, 177 insertions(+), 4 deletions(-) create mode 100644 CarCenter/CarCenterContracts/BusinessLogicsContracts/IOrderLogic.cs create mode 100644 CarCenter/CarCenterContracts/BusinessLogicsContracts/IPresaleLogic.cs create mode 100644 CarCenter/CarCenterContracts/BusinessLogicsContracts/IRequestLogic.cs create mode 100644 CarCenter/CarCenterContracts/BusinessLogicsContracts/IWorkerLogic.cs create mode 100644 CarCenter/CarCenterContracts/ViewModels/OrderViewModel.cs create mode 100644 CarCenter/CarCenterContracts/ViewModels/PresaleViewModel.cs create mode 100644 CarCenter/CarCenterContracts/ViewModels/RequestViewModel.cs create mode 100644 CarCenter/CarCenterContracts/ViewModels/WorkerViewModel.cs diff --git a/CarCenter/CarCenterContracts/BusinessLogicsContracts/IOrderLogic.cs b/CarCenter/CarCenterContracts/BusinessLogicsContracts/IOrderLogic.cs new file mode 100644 index 0000000..9d6d904 --- /dev/null +++ b/CarCenter/CarCenterContracts/BusinessLogicsContracts/IOrderLogic.cs @@ -0,0 +1,20 @@ +using CarCenterContracts.BindingModels; +using CarCenterContracts.SearchModels; +using CarCenterContracts.ViewModels; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CarCenterContracts.BusinessLogicsContracts +{ + public interface IOrderLogic + { + List? ReadList(OrderSearchModel? model); + OrderViewModel? ReadElement(OrderSearchModel model); + bool Create(OrderBindingModel model); + bool Update(OrderBindingModel model); + bool Delete(OrderBindingModel model); + } +} diff --git a/CarCenter/CarCenterContracts/BusinessLogicsContracts/IPresaleLogic.cs b/CarCenter/CarCenterContracts/BusinessLogicsContracts/IPresaleLogic.cs new file mode 100644 index 0000000..d500ce0 --- /dev/null +++ b/CarCenter/CarCenterContracts/BusinessLogicsContracts/IPresaleLogic.cs @@ -0,0 +1,20 @@ +using CarCenterContracts.BindingModels; +using CarCenterContracts.SearchModels; +using CarCenterContracts.ViewModels; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CarCenterContracts.BusinessLogicsContracts +{ + public interface IPresaleLogic + { + List? ReadList(PresaleSearchModel? model); + PresaleViewModel? ReadElement(PresaleSearchModel model); + bool Create(PresaleBindingModel model); + bool Update(PresaleBindingModel model); + bool Delete(PresaleBindingModel model); + } +} diff --git a/CarCenter/CarCenterContracts/BusinessLogicsContracts/IRequestLogic.cs b/CarCenter/CarCenterContracts/BusinessLogicsContracts/IRequestLogic.cs new file mode 100644 index 0000000..aa598e6 --- /dev/null +++ b/CarCenter/CarCenterContracts/BusinessLogicsContracts/IRequestLogic.cs @@ -0,0 +1,20 @@ +using CarCenterContracts.BindingModels; +using CarCenterContracts.SearchModels; +using CarCenterContracts.ViewModels; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CarCenterContracts.BusinessLogicsContracts +{ + public interface IRequestLogic + { + List? ReadList(RequestSearchModel? model); + RequestViewModel? ReadElement(RequestSearchModel model); + bool Create(RequestBindingModel model); + bool Update(RequestBindingModel model); + bool Delete(RequestBindingModel model); + } +} diff --git a/CarCenter/CarCenterContracts/BusinessLogicsContracts/IWorkerLogic.cs b/CarCenter/CarCenterContracts/BusinessLogicsContracts/IWorkerLogic.cs new file mode 100644 index 0000000..4a5d9cc --- /dev/null +++ b/CarCenter/CarCenterContracts/BusinessLogicsContracts/IWorkerLogic.cs @@ -0,0 +1,20 @@ +using CarCenterContracts.BindingModels; +using CarCenterContracts.SearchModels; +using CarCenterContracts.ViewModels; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CarCenterContracts.BusinessLogicsContracts +{ + public interface IWorkerLogic + { + List? ReadList(WorkerSearchModel? model); + WorkerViewModel? ReadElement(WorkerSearchModel model); + bool Create(WorkerBindingModel model); + bool Update(WorkerBindingModel model); + bool Delete(WorkerBindingModel model); + } +} diff --git a/CarCenter/CarCenterContracts/CarCenterContracts.csproj b/CarCenter/CarCenterContracts/CarCenterContracts.csproj index 47a90e7..97673d7 100644 --- a/CarCenter/CarCenterContracts/CarCenterContracts.csproj +++ b/CarCenter/CarCenterContracts/CarCenterContracts.csproj @@ -6,10 +6,6 @@ enable - - - - diff --git a/CarCenter/CarCenterContracts/ViewModels/OrderViewModel.cs b/CarCenter/CarCenterContracts/ViewModels/OrderViewModel.cs new file mode 100644 index 0000000..19ba223 --- /dev/null +++ b/CarCenter/CarCenterContracts/ViewModels/OrderViewModel.cs @@ -0,0 +1,26 @@ +using CarCenterDataModels.Enums; +using CarCenterDataModels.Models; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CarCenterContracts.ViewModels +{ + public class OrderViewModel : IOrderModel + { + public int Id { get; set; } + [DisplayName("Тип оплаты")] + public PaymentType PaymentType { get; set; } = PaymentType.Неизвестно; + [DisplayName("Статус оплаты")] + public PaymentStatus PaymentStatus { get; set; } = PaymentStatus.Неизвестно; + [DisplayName("ФИО покупателя")] + public string BuyerFCS { get; set; } = string.Empty; + [DisplayName("Дата оплаты")] + public DateTime PaymentDate { get; set; } + [DisplayName("Сумма")] + public double Sum { get; set; } + } +} diff --git a/CarCenter/CarCenterContracts/ViewModels/PresaleViewModel.cs b/CarCenter/CarCenterContracts/ViewModels/PresaleViewModel.cs new file mode 100644 index 0000000..e9c7c56 --- /dev/null +++ b/CarCenter/CarCenterContracts/ViewModels/PresaleViewModel.cs @@ -0,0 +1,24 @@ +using CarCenterDataModels.Enums; +using CarCenterDataModels.Models; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CarCenterContracts.ViewModels +{ + public class PresaleViewModel : IPresaleModel + { + public int Id { get; set; } + [DisplayName("Статус работы")] + public PresaleStatus PresaleStatus { get; set; } = PresaleStatus.Неизвестно; + [DisplayName("Описание")] + public string Description { get; set; } = string.Empty; + [DisplayName("Выполнить до")] + public DateTime DueTill { get; set; } + [DisplayName("Цена")] + public double Price { get; set; } + } +} diff --git a/CarCenter/CarCenterContracts/ViewModels/RequestViewModel.cs b/CarCenter/CarCenterContracts/ViewModels/RequestViewModel.cs new file mode 100644 index 0000000..ed27dbb --- /dev/null +++ b/CarCenter/CarCenterContracts/ViewModels/RequestViewModel.cs @@ -0,0 +1,20 @@ +using CarCenterDataModels.Enums; +using CarCenterDataModels.Models; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CarCenterContracts.ViewModels +{ + public class RequestViewModel : IRequestModel + { + public int Id { get; set; } + [DisplayName("Описание")] + public string Description { get; set; } = string.Empty; + [DisplayName("Тип пожелания")] + public RequestTypes RequestType { get; set; } = RequestTypes.Неизвестно; + } +} diff --git a/CarCenter/CarCenterContracts/ViewModels/WorkerViewModel.cs b/CarCenter/CarCenterContracts/ViewModels/WorkerViewModel.cs new file mode 100644 index 0000000..287c858 --- /dev/null +++ b/CarCenter/CarCenterContracts/ViewModels/WorkerViewModel.cs @@ -0,0 +1,27 @@ +using CarCenterDataModels.Models; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CarCenterContracts.ViewModels +{ + public class WorkerViewModel : IWorkerModel + { + public int Id { get; set; } + [DisplayName("Имя")] + public string Name { get; set; } = string.Empty; + [DisplayName("Фамилия")] + public string Surname { get; set; } = string.Empty; + [DisplayName("Отчество")] + public string? Patronymic { get; set; } + [DisplayName("Пароль")] + public string Password { get; set; } = string.Empty; + [DisplayName("Почта")] + public string Email { get; set; } = string.Empty; + [DisplayName("Номер телефона")] + public long PhoneNumber { get; set; } + } +} From 929ebbc849aefd2f00f9c8106b13023896861f08 Mon Sep 17 00:00:00 2001 From: Marselchi Date: Sun, 28 Apr 2024 14:16:07 +0400 Subject: [PATCH 5/6] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D1=8B=20=D0=BA=D0=BE=D0=BD=D1=82=D1=80=D0=B0=D0=BA=D1=82?= =?UTF-8?q?=D1=8B=20=D1=85=D1=80=D0=B0=D0=BD=D0=B8=D0=BB=D0=B8=D1=89=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../StoragesContracts/IOrderStorage.cs | 21 +++++++++++++++++++ .../StoragesContracts/IPresaleStorage.cs | 21 +++++++++++++++++++ .../StoragesContracts/IRequestStorage.cs | 21 +++++++++++++++++++ .../StoragesContracts/IWorkerStorage.cs | 21 +++++++++++++++++++ 4 files changed, 84 insertions(+) create mode 100644 CarCenter/CarCenterContracts/StoragesContracts/IOrderStorage.cs create mode 100644 CarCenter/CarCenterContracts/StoragesContracts/IPresaleStorage.cs create mode 100644 CarCenter/CarCenterContracts/StoragesContracts/IRequestStorage.cs create mode 100644 CarCenter/CarCenterContracts/StoragesContracts/IWorkerStorage.cs diff --git a/CarCenter/CarCenterContracts/StoragesContracts/IOrderStorage.cs b/CarCenter/CarCenterContracts/StoragesContracts/IOrderStorage.cs new file mode 100644 index 0000000..d169e19 --- /dev/null +++ b/CarCenter/CarCenterContracts/StoragesContracts/IOrderStorage.cs @@ -0,0 +1,21 @@ +using CarCenterContracts.BindingModels; +using CarCenterContracts.SearchModels; +using CarCenterContracts.ViewModels; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CarCenterContracts.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/CarCenter/CarCenterContracts/StoragesContracts/IPresaleStorage.cs b/CarCenter/CarCenterContracts/StoragesContracts/IPresaleStorage.cs new file mode 100644 index 0000000..5ffe2f1 --- /dev/null +++ b/CarCenter/CarCenterContracts/StoragesContracts/IPresaleStorage.cs @@ -0,0 +1,21 @@ +using CarCenterContracts.BindingModels; +using CarCenterContracts.SearchModels; +using CarCenterContracts.ViewModels; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CarCenterContracts.StoragesContracts +{ + public interface IPresaleStorage + { + List GetFullList(); + List GetFilteredList(PresaleSearchModel model); + PresaleViewModel? GetElement(PresaleSearchModel model); + PresaleViewModel? Insert(PresaleBindingModel model); + PresaleViewModel? Update(PresaleBindingModel model); + PresaleViewModel? Delete(PresaleBindingModel model); + } +} diff --git a/CarCenter/CarCenterContracts/StoragesContracts/IRequestStorage.cs b/CarCenter/CarCenterContracts/StoragesContracts/IRequestStorage.cs new file mode 100644 index 0000000..c9e2f91 --- /dev/null +++ b/CarCenter/CarCenterContracts/StoragesContracts/IRequestStorage.cs @@ -0,0 +1,21 @@ +using CarCenterContracts.BindingModels; +using CarCenterContracts.SearchModels; +using CarCenterContracts.ViewModels; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CarCenterContracts.StoragesContracts +{ + public interface IRequestStorage + { + List GetFullList(); + List GetFilteredList(RequestSearchModel model); + RequestViewModel? GetElement(RequestSearchModel model); + RequestViewModel? Insert(RequestBindingModel model); + RequestViewModel? Update(RequestBindingModel model); + RequestViewModel? Delete(RequestBindingModel model); + } +} diff --git a/CarCenter/CarCenterContracts/StoragesContracts/IWorkerStorage.cs b/CarCenter/CarCenterContracts/StoragesContracts/IWorkerStorage.cs new file mode 100644 index 0000000..c09d6fd --- /dev/null +++ b/CarCenter/CarCenterContracts/StoragesContracts/IWorkerStorage.cs @@ -0,0 +1,21 @@ +using CarCenterContracts.BindingModels; +using CarCenterContracts.SearchModels; +using CarCenterContracts.ViewModels; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CarCenterContracts.StoragesContracts +{ + public interface IWorkerStorage + { + List GetFullList(); + List GetFilteredList(WorkerSearchModel model); + WorkerViewModel? GetElement(WorkerSearchModel model); + WorkerViewModel? Insert(WorkerBindingModel model); + WorkerViewModel? Update(WorkerBindingModel model); + WorkerViewModel? Delete(WorkerBindingModel model); + } +} From 2a7c592202d08793f55f703bed33c4f276286502 Mon Sep 17 00:00:00 2001 From: Marselchi Date: Sun, 28 Apr 2024 14:58:11 +0400 Subject: [PATCH 6/6] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20=D0=BB=D0=BE=D0=B3=D0=B8=D0=BA=D0=B8=20+?= =?UTF-8?q?=20=D0=B5=D1=91=20=D1=84=D0=B8=D0=BA=D1=81=20=D0=B8=20=D0=B8?= =?UTF-8?q?=D0=B7=D0=BC=D0=B5=D0=BD=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=BC=D0=BE?= =?UTF-8?q?=D0=B4=D0=B5=D0=BB=D0=B8=20=D0=BF=D0=BE=D0=B8=D1=81=D0=BA=D0=B0?= =?UTF-8?q?=20=D0=B7=D0=B0=D0=BA=D0=B0=D0=B7=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BusinessLogics/BundlingLogic.cs | 2 +- .../BusinessLogics/FeatureLogic.cs | 2 +- .../BusinessLogics/OrderLogic.cs | 110 ++++++++++++++++++ .../BusinessLogics/PresaleLogic.cs | 110 ++++++++++++++++++ .../BusinessLogics/RequestLogic.cs | 106 +++++++++++++++++ .../BusinessLogics/StorekeeperLogic.cs | 4 +- .../BusinessLogics/WorkerLogic.cs | 106 +++++++++++++++++ .../SearchModels/OrderSearchModel.cs | 2 - 8 files changed, 436 insertions(+), 6 deletions(-) create mode 100644 CarCenter/CarCenterBusinessLogic/BusinessLogics/OrderLogic.cs create mode 100644 CarCenter/CarCenterBusinessLogic/BusinessLogics/PresaleLogic.cs create mode 100644 CarCenter/CarCenterBusinessLogic/BusinessLogics/RequestLogic.cs create mode 100644 CarCenter/CarCenterBusinessLogic/BusinessLogics/WorkerLogic.cs diff --git a/CarCenter/CarCenterBusinessLogic/BusinessLogics/BundlingLogic.cs b/CarCenter/CarCenterBusinessLogic/BusinessLogics/BundlingLogic.cs index 02ec3d1..45e6334 100644 --- a/CarCenter/CarCenterBusinessLogic/BusinessLogics/BundlingLogic.cs +++ b/CarCenter/CarCenterBusinessLogic/BusinessLogics/BundlingLogic.cs @@ -41,7 +41,7 @@ namespace CarCenterBusinessLogic.BusinessLogics { throw new ArgumentNullException(nameof(model)); } - _logger.LogInformation("ReadElement. ComponentId:Id:{ Id}", model.Id); + _logger.LogInformation("ReadElement. BundlingId:Id:{ Id}", model.Id); var element = _bundlingStorage.GetElement(model); if (element == null) { diff --git a/CarCenter/CarCenterBusinessLogic/BusinessLogics/FeatureLogic.cs b/CarCenter/CarCenterBusinessLogic/BusinessLogics/FeatureLogic.cs index 245313c..b7ede06 100644 --- a/CarCenter/CarCenterBusinessLogic/BusinessLogics/FeatureLogic.cs +++ b/CarCenter/CarCenterBusinessLogic/BusinessLogics/FeatureLogic.cs @@ -41,7 +41,7 @@ namespace CarCenterBusinessLogic.BusinessLogics { throw new ArgumentNullException(nameof(model)); } - _logger.LogInformation("ReadElement. ComponentId:Id:{ Id}", model.Id); + _logger.LogInformation("ReadElement. FeatureId:Id:{ Id}", model.Id); var element = _fatureStorage.GetElement(model); if (element == null) { diff --git a/CarCenter/CarCenterBusinessLogic/BusinessLogics/OrderLogic.cs b/CarCenter/CarCenterBusinessLogic/BusinessLogics/OrderLogic.cs new file mode 100644 index 0000000..7fddbdd --- /dev/null +++ b/CarCenter/CarCenterBusinessLogic/BusinessLogics/OrderLogic.cs @@ -0,0 +1,110 @@ +using CarCenterContracts.BindingModels; +using CarCenterContracts.BusinessLogicsContracts; +using CarCenterContracts.SearchModels; +using CarCenterContracts.StoragesContracts; +using CarCenterContracts.ViewModels; +using Microsoft.Extensions.Logging; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CarCenterBusinessLogic.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:{ 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 OrderViewModel? ReadElement(OrderSearchModel model) + { + if (model == null) + { + throw new ArgumentNullException(nameof(model)); + } + _logger.LogInformation("ReadElement. OrderId:Id:{ Id}", 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 bool Create(OrderBindingModel model) + { + CheckModel(model); + if (_orderStorage.Insert(model) == null) + { + _logger.LogWarning("Insert operation failed"); + return false; + } + return true; + } + + public bool Update(OrderBindingModel model) + { + CheckModel(model); + if (_orderStorage.Update(model) == null) + { + _logger.LogWarning("Update operation failed"); + return false; + } + return true; + } + + public bool Delete(OrderBindingModel model) + { + CheckModel(model, false); + _logger.LogInformation("Delete. Id:{Id}", model.Id); + if (_orderStorage.Delete(model) == null) + { + _logger.LogWarning("Delete operation failed"); + return false; + } + return true; + } + + private void CheckModel(OrderBindingModel model, bool withParams = true) + { + if (model == null) + { + throw new ArgumentNullException(nameof(model)); + } + if (!withParams) + { + return; + } + if (model.BuyerFCS == string.Empty) + { + throw new ArgumentNullException("Нет покупателя", nameof(model.BuyerFCS)); + } + if(model.Sum < 0) + { + throw new ArgumentOutOfRangeException("Сумма меньше нуля",nameof(model.Sum)); + } + _logger.LogInformation("Order. Order:Id:{ Id}.Sum:{ Sum}", model.Id, model.Sum); + } + } +} diff --git a/CarCenter/CarCenterBusinessLogic/BusinessLogics/PresaleLogic.cs b/CarCenter/CarCenterBusinessLogic/BusinessLogics/PresaleLogic.cs new file mode 100644 index 0000000..651cfc0 --- /dev/null +++ b/CarCenter/CarCenterBusinessLogic/BusinessLogics/PresaleLogic.cs @@ -0,0 +1,110 @@ +using CarCenterContracts.BindingModels; +using CarCenterContracts.BusinessLogicsContracts; +using CarCenterContracts.SearchModels; +using CarCenterContracts.StoragesContracts; +using CarCenterContracts.ViewModels; +using Microsoft.Extensions.Logging; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CarCenterBusinessLogic.BusinessLogics +{ + public class PresaleLogic : IPresaleLogic + { + private readonly ILogger _logger; + private readonly IPresaleStorage _presaleStorage; + public PresaleLogic(ILogger logger, IPresaleStorage presaleStorage) + { + _logger = logger; + _presaleStorage = presaleStorage; + } + + public List? ReadList(PresaleSearchModel? model) + { + _logger.LogInformation("ReadList. PresaleId:Id:{ Id}", model?.Id); + var list = model == null ? _presaleStorage.GetFullList() : _presaleStorage.GetFilteredList(model); + if (list == null) + { + _logger.LogWarning("ReadList return null list"); + return null; + } + _logger.LogInformation("ReadList. Count:{Count}", list.Count); + return list; + } + + public PresaleViewModel? ReadElement(PresaleSearchModel model) + { + if (model == null) + { + throw new ArgumentNullException(nameof(model)); + } + _logger.LogInformation("ReadElement. PresaleId:Id:{ Id}", model.Id); + var element = _presaleStorage.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(PresaleBindingModel model) + { + CheckModel(model); + if (_presaleStorage.Insert(model) == null) + { + _logger.LogWarning("Insert operation failed"); + return false; + } + return true; + } + + public bool Update(PresaleBindingModel model) + { + CheckModel(model); + if (_presaleStorage.Update(model) == null) + { + _logger.LogWarning("Update operation failed"); + return false; + } + return true; + } + + public bool Delete(PresaleBindingModel model) + { + CheckModel(model, false); + _logger.LogInformation("Delete. Id:{Id}", model.Id); + if (_presaleStorage.Delete(model) == null) + { + _logger.LogWarning("Delete operation failed"); + return false; + } + return true; + } + + private void CheckModel(PresaleBindingModel model, bool withParams = true) + { + if (model == null) + { + throw new ArgumentNullException(nameof(model)); + } + if (!withParams) + { + return; + } + if (model.Description == string.Empty) + { + throw new ArgumentNullException("Нет описания", nameof(model.Description)); + } + if (model.DueTill < DateTime.Now) + { + throw new InvalidOperationException("Срок выполнения раньше текущего времени"); + } + _logger.LogInformation("Presale. Presale:Id:{ Id}.Price:{ Price}", model.Id, model.Description); + } + } +} diff --git a/CarCenter/CarCenterBusinessLogic/BusinessLogics/RequestLogic.cs b/CarCenter/CarCenterBusinessLogic/BusinessLogics/RequestLogic.cs new file mode 100644 index 0000000..ede807a --- /dev/null +++ b/CarCenter/CarCenterBusinessLogic/BusinessLogics/RequestLogic.cs @@ -0,0 +1,106 @@ +using CarCenterContracts.BindingModels; +using CarCenterContracts.BusinessLogicsContracts; +using CarCenterContracts.SearchModels; +using CarCenterContracts.StoragesContracts; +using CarCenterContracts.ViewModels; +using Microsoft.Extensions.Logging; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CarCenterBusinessLogic.BusinessLogics +{ + public class RequestLogic : IRequestLogic + { + private readonly ILogger _logger; + private readonly IRequestStorage _requestStorage; + public RequestLogic(ILogger logger, IRequestStorage requestStorage) + { + _logger = logger; + _requestStorage = requestStorage; + } + + public List? ReadList(RequestSearchModel? model) + { + _logger.LogInformation("ReadList. RequestId:Id:{ Id}", model?.Id); + var list = model == null ? _requestStorage.GetFullList() : _requestStorage.GetFilteredList(model); + if (list == null) + { + _logger.LogWarning("ReadList return null list"); + return null; + } + _logger.LogInformation("ReadList. Count:{Count}", list.Count); + return list; + } + + public RequestViewModel? ReadElement(RequestSearchModel model) + { + if (model == null) + { + throw new ArgumentNullException(nameof(model)); + } + _logger.LogInformation("ReadElement. RequestId:Id:{ Id}", model.Id); + var element = _requestStorage.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(RequestBindingModel model) + { + CheckModel(model); + if (_requestStorage.Insert(model) == null) + { + _logger.LogWarning("Insert operation failed"); + return false; + } + return true; + } + + public bool Update(RequestBindingModel model) + { + CheckModel(model); + if (_requestStorage.Update(model) == null) + { + _logger.LogWarning("Update operation failed"); + return false; + } + return true; + } + + public bool Delete(RequestBindingModel model) + { + CheckModel(model, false); + _logger.LogInformation("Delete. Id:{Id}", model.Id); + if (_requestStorage.Delete(model) == null) + { + _logger.LogWarning("Delete operation failed"); + return false; + } + return true; + } + + private void CheckModel(RequestBindingModel model, bool withParams = true) + { + if (model == null) + { + throw new ArgumentNullException(nameof(model)); + } + if (!withParams) + { + return; + } + if (model.Description == string.Empty) + { + throw new ArgumentNullException("Нет описания", nameof(model.Description)); + } + _logger.LogInformation("Request. Request:Id:{ Id}.Description:{ Description}", model.Id, model.Description); + } + } +} diff --git a/CarCenter/CarCenterBusinessLogic/BusinessLogics/StorekeeperLogic.cs b/CarCenter/CarCenterBusinessLogic/BusinessLogics/StorekeeperLogic.cs index a23e0e1..f56940a 100644 --- a/CarCenter/CarCenterBusinessLogic/BusinessLogics/StorekeeperLogic.cs +++ b/CarCenter/CarCenterBusinessLogic/BusinessLogics/StorekeeperLogic.cs @@ -41,7 +41,7 @@ namespace CarCenterBusinessLogic.BusinessLogics { throw new ArgumentNullException(nameof(model)); } - _logger.LogInformation("ReadElement. ComponentId:Id:{ Id}", model.Id); + _logger.LogInformation("ReadElement. StorekeeperId:Id:{ Id}", model.Id); var element = _storekeeperStorage.GetElement(model); if (element == null) { @@ -100,7 +100,7 @@ namespace CarCenterBusinessLogic.BusinessLogics { throw new ArgumentNullException("Нет телефона", nameof(model.PhoneNumber)); } - _logger.LogInformation("Storekeeper. Storekeeper:Id:{ Id}.Price:{ Price}", model.Id, model.PhoneNumber); + _logger.LogInformation("Storekeeper. Storekeeper:Id:{ Id}.PhoneNumber:{ PhoneNumber}", model.Id, model.PhoneNumber); } } } diff --git a/CarCenter/CarCenterBusinessLogic/BusinessLogics/WorkerLogic.cs b/CarCenter/CarCenterBusinessLogic/BusinessLogics/WorkerLogic.cs new file mode 100644 index 0000000..4e15bf1 --- /dev/null +++ b/CarCenter/CarCenterBusinessLogic/BusinessLogics/WorkerLogic.cs @@ -0,0 +1,106 @@ +using CarCenterContracts.BindingModels; +using CarCenterContracts.BusinessLogicsContracts; +using CarCenterContracts.SearchModels; +using CarCenterContracts.StoragesContracts; +using CarCenterContracts.ViewModels; +using Microsoft.Extensions.Logging; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CarCenterBusinessLogic.BusinessLogics +{ + public class WorkerLogic : IWorkerLogic + { + private readonly ILogger _logger; + private readonly IWorkerStorage _workerStorage; + public WorkerLogic(ILogger logger, IWorkerStorage workerStorage) + { + _logger = logger; + _workerStorage = workerStorage; + } + + public List? ReadList(WorkerSearchModel? model) + { + _logger.LogInformation("ReadList. WorkerId:Id:{ Id}", model?.Id); + var list = model == null ? _workerStorage.GetFullList() : _workerStorage.GetFilteredList(model); + if (list == null) + { + _logger.LogWarning("ReadList return null list"); + return null; + } + _logger.LogInformation("ReadList. Count:{Count}", list.Count); + return list; + } + + public WorkerViewModel? ReadElement(WorkerSearchModel model) + { + if (model == null) + { + throw new ArgumentNullException(nameof(model)); + } + _logger.LogInformation("ReadElement. ComponentId:Id:{ Id}", model.Id); + var element = _workerStorage.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(WorkerBindingModel model) + { + CheckModel(model); + if (_workerStorage.Insert(model) == null) + { + _logger.LogWarning("Insert operation failed"); + return false; + } + return true; + } + + public bool Update(WorkerBindingModel model) + { + CheckModel(model); + if (_workerStorage.Update(model) == null) + { + _logger.LogWarning("Update operation failed"); + return false; + } + return true; + } + + public bool Delete(WorkerBindingModel model) + { + CheckModel(model, false); + _logger.LogInformation("Delete. Id:{Id}", model.Id); + if (_workerStorage.Delete(model) == null) + { + _logger.LogWarning("Delete operation failed"); + return false; + } + return true; + } + + private void CheckModel(WorkerBindingModel model, bool withParams = true) + { + if (model == null) + { + throw new ArgumentNullException(nameof(model)); + } + if (!withParams) + { + return; + } + if (model.PhoneNumber <= 0) + { + throw new ArgumentNullException("Нет телефона", nameof(model.PhoneNumber)); + } + _logger.LogInformation("Worker. Worker:Id:{ Id}.PhoneNumber:{ PhoneNumber}", model.Id, model.PhoneNumber); + } + } +} diff --git a/CarCenter/CarCenterContracts/SearchModels/OrderSearchModel.cs b/CarCenter/CarCenterContracts/SearchModels/OrderSearchModel.cs index 03f8ad2..9087f3a 100644 --- a/CarCenter/CarCenterContracts/SearchModels/OrderSearchModel.cs +++ b/CarCenter/CarCenterContracts/SearchModels/OrderSearchModel.cs @@ -9,7 +9,5 @@ namespace CarCenterContracts.SearchModels public class OrderSearchModel { public int? Id { get; set; } - - public string? BuyerFCS { get; set; } } }