From c4c80696456dcb07b1380ae30565580162dcb58f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9D=D0=B8=D0=BA=D0=BE=D0=BB=D0=B0=D0=B9?= Date: Sun, 2 Apr 2023 14:53:07 +0400 Subject: [PATCH] =?UTF-8?q?=D0=BF=D0=B5=D1=80=D0=B5=D0=B4=D0=B5=D0=BB?= =?UTF-8?q?=D0=B0=D0=BD=D0=BD=D1=8B=D0=B9=20=D0=BC=D0=B0=D0=BA=D0=B5=D1=82?= =?UTF-8?q?=20=D1=80=D0=B0=D0=B1=D0=BE=D1=82=D0=BD=D0=B8=D0=BA=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BusinessLogics/Worker/BuildLogic.cs | 2 +- .../BusinessLogics/Worker/CommentLogic.cs | 6 +- .../BusinessLogics/Worker/PurchaseLogic.cs | 2 +- .../Controllers/WorkerController.cs | 8 +- .../Views/Worker/Build.cshtml | 7 +- .../Views/Worker/Builds.cshtml | 5 + .../Views/Worker/Comments.cshtml | 3 + .../Views/Worker/MainWorker.cshtml | 3 + .../Views/Worker/Purchase.cshtml | 3 + .../Views/Worker/Purchases.cshtml | 5 +- .../Views/Worker/WorkerReport.cshtml | 3 + .../Views/Worker/linkingBuild.cshtml | 116 ++++++++++++++++++ .../Views/Worker/listComponents.cshtml | 3 + .../ViewModels/BuildViewModel.cs | 2 +- .../ViewModels/CommentViewModel.cs | 2 +- .../ViewModels/PurchaseViewModel.cs | 2 +- .../Models/Worker/Build.cs | 6 +- 17 files changed, 165 insertions(+), 13 deletions(-) create mode 100644 HardwareShop/HardwareShopClientApp/Views/Worker/linkingBuild.cshtml diff --git a/HardwareShop/HardwareShopBusinessLogic/BusinessLogics/Worker/BuildLogic.cs b/HardwareShop/HardwareShopBusinessLogic/BusinessLogics/Worker/BuildLogic.cs index 49a2435..eb51e78 100644 --- a/HardwareShop/HardwareShopBusinessLogic/BusinessLogics/Worker/BuildLogic.cs +++ b/HardwareShop/HardwareShopBusinessLogic/BusinessLogics/Worker/BuildLogic.cs @@ -106,7 +106,7 @@ namespace HardwareShopContracts.BusinessLogicsContracts { throw new ArgumentNullException("Некорректный идентификатор у сборки", nameof(model.Id)); } - _logger.LogInformation("Build. BuildName:{BuildName}. Price:{Price}. Id:{Id}", model.BuildName, model.Price, model.Id); + _logger.LogInformation("Build. UserId:{UserId}. BuildName:{BuildName}. Price:{Price}. Id:{Id}", model.UserId, model.BuildName, model.Price, model.Id); var element = _buildStorage.GetElement(new BuildSearchModel { BuildName = model.BuildName diff --git a/HardwareShop/HardwareShopBusinessLogic/BusinessLogics/Worker/CommentLogic.cs b/HardwareShop/HardwareShopBusinessLogic/BusinessLogics/Worker/CommentLogic.cs index 4d4a130..23ef980 100644 --- a/HardwareShop/HardwareShopBusinessLogic/BusinessLogics/Worker/CommentLogic.cs +++ b/HardwareShop/HardwareShopBusinessLogic/BusinessLogics/Worker/CommentLogic.cs @@ -100,8 +100,12 @@ namespace HardwareShopContracts.BusinessLogicsContracts { throw new ArgumentNullException("Некорректный идентификатор у комментария", nameof(model.Id)); } + if (model.UserId < 0) + { + throw new ArgumentNullException("Некорректный идентификатор у клиента", nameof(model.UserId)); + } - _logger.LogInformation("Comment. BuildId:{BuildId}. Id:{Id}", model.BuildId, model.Id); + _logger.LogInformation("Comment. UserId:{UserId}. BuildId:{BuildId}. Id:{Id}", model.UserId, model.BuildId, model.Id); } } } \ No newline at end of file diff --git a/HardwareShop/HardwareShopBusinessLogic/BusinessLogics/Worker/PurchaseLogic.cs b/HardwareShop/HardwareShopBusinessLogic/BusinessLogics/Worker/PurchaseLogic.cs index 7aa764f..8563aac 100644 --- a/HardwareShop/HardwareShopBusinessLogic/BusinessLogics/Worker/PurchaseLogic.cs +++ b/HardwareShop/HardwareShopBusinessLogic/BusinessLogics/Worker/PurchaseLogic.cs @@ -121,7 +121,7 @@ namespace HardwareShopContracts.BusinessLogicsContracts { throw new ArgumentNullException("Сумма заказа должна быть больше 0", nameof(model.Sum)); } - _logger.LogInformation("Purchase. PurchaseID:{Id}. Sum:{ Sum}", model.Id, model.Sum); + _logger.LogInformation("Purchase. UserId:{UserId}. PurchaseID:{Id}. Sum:{ Sum}", model.UserId, model.Id, model.Sum); } } } diff --git a/HardwareShop/HardwareShopClientApp/Controllers/WorkerController.cs b/HardwareShop/HardwareShopClientApp/Controllers/WorkerController.cs index 9e4beac..9155dc8 100644 --- a/HardwareShop/HardwareShopClientApp/Controllers/WorkerController.cs +++ b/HardwareShop/HardwareShopClientApp/Controllers/WorkerController.cs @@ -74,5 +74,11 @@ namespace HardwareShopClientApp.Controllers return View(); } + [HttpGet] + public IActionResult linkingBuild() + { + return View(); + } + } -} \ No newline at end of file +} diff --git a/HardwareShop/HardwareShopClientApp/Views/Worker/Build.cshtml b/HardwareShop/HardwareShopClientApp/Views/Worker/Build.cshtml index 323d46c..107df0b 100644 --- a/HardwareShop/HardwareShopClientApp/Views/Worker/Build.cshtml +++ b/HardwareShop/HardwareShopClientApp/Views/Worker/Build.cshtml @@ -5,7 +5,7 @@ ViewData["Title"] = "Build"; } -@model List +@model List @section Header {
@@ -32,6 +32,9 @@ + @@ -41,7 +44,7 @@
-

Товар

+

Комплектующие

diff --git a/HardwareShop/HardwareShopClientApp/Views/Worker/Builds.cshtml b/HardwareShop/HardwareShopClientApp/Views/Worker/Builds.cshtml index cd83230..c32d47c 100644 --- a/HardwareShop/HardwareShopClientApp/Views/Worker/Builds.cshtml +++ b/HardwareShop/HardwareShopClientApp/Views/Worker/Builds.cshtml @@ -30,6 +30,9 @@ +
@@ -72,5 +75,7 @@ +
+ \ No newline at end of file diff --git a/HardwareShop/HardwareShopClientApp/Views/Worker/Comments.cshtml b/HardwareShop/HardwareShopClientApp/Views/Worker/Comments.cshtml index f09f392..bb67b2a 100644 --- a/HardwareShop/HardwareShopClientApp/Views/Worker/Comments.cshtml +++ b/HardwareShop/HardwareShopClientApp/Views/Worker/Comments.cshtml @@ -30,6 +30,9 @@ + diff --git a/HardwareShop/HardwareShopClientApp/Views/Worker/MainWorker.cshtml b/HardwareShop/HardwareShopClientApp/Views/Worker/MainWorker.cshtml index e60f995..a2643be 100644 --- a/HardwareShop/HardwareShopClientApp/Views/Worker/MainWorker.cshtml +++ b/HardwareShop/HardwareShopClientApp/Views/Worker/MainWorker.cshtml @@ -27,6 +27,9 @@ + diff --git a/HardwareShop/HardwareShopClientApp/Views/Worker/Purchase.cshtml b/HardwareShop/HardwareShopClientApp/Views/Worker/Purchase.cshtml index f1750e1..cb2f1e0 100644 --- a/HardwareShop/HardwareShopClientApp/Views/Worker/Purchase.cshtml +++ b/HardwareShop/HardwareShopClientApp/Views/Worker/Purchase.cshtml @@ -30,6 +30,9 @@ + diff --git a/HardwareShop/HardwareShopClientApp/Views/Worker/Purchases.cshtml b/HardwareShop/HardwareShopClientApp/Views/Worker/Purchases.cshtml index 9345ff0..00a5581 100644 --- a/HardwareShop/HardwareShopClientApp/Views/Worker/Purchases.cshtml +++ b/HardwareShop/HardwareShopClientApp/Views/Worker/Purchases.cshtml @@ -29,6 +29,9 @@ + @@ -37,7 +40,7 @@
}
-
+

Покупки

diff --git a/HardwareShop/HardwareShopClientApp/Views/Worker/WorkerReport.cshtml b/HardwareShop/HardwareShopClientApp/Views/Worker/WorkerReport.cshtml index cfae243..97889f2 100644 --- a/HardwareShop/HardwareShopClientApp/Views/Worker/WorkerReport.cshtml +++ b/HardwareShop/HardwareShopClientApp/Views/Worker/WorkerReport.cshtml @@ -28,6 +28,9 @@ +
diff --git a/HardwareShop/HardwareShopClientApp/Views/Worker/linkingBuild.cshtml b/HardwareShop/HardwareShopClientApp/Views/Worker/linkingBuild.cshtml new file mode 100644 index 0000000..0ba6767 --- /dev/null +++ b/HardwareShop/HardwareShopClientApp/Views/Worker/linkingBuild.cshtml @@ -0,0 +1,116 @@ + + +@using HardwareShopContracts.ViewModels +@{ + ViewData["Title"] = "linkingBuild"; +} + +@model List + +@section Header { +
+ +
+} + +
+
+

Выбранные покупки

+
+
+ + +
+ +
+ + + + + + + + + + + +
+ Номер + + Комплектующее + + Цена + + Логин пользователя +
+
+
+
+ + + + + +
+ + + + \ No newline at end of file diff --git a/HardwareShop/HardwareShopClientApp/Views/Worker/listComponents.cshtml b/HardwareShop/HardwareShopClientApp/Views/Worker/listComponents.cshtml index c0f58c9..b1d46ff 100644 --- a/HardwareShop/HardwareShopClientApp/Views/Worker/listComponents.cshtml +++ b/HardwareShop/HardwareShopClientApp/Views/Worker/listComponents.cshtml @@ -31,6 +31,9 @@ + diff --git a/HardwareShop/HardwareShopContracts/ViewModels/BuildViewModel.cs b/HardwareShop/HardwareShopContracts/ViewModels/BuildViewModel.cs index 68f0c74..53011b5 100644 --- a/HardwareShop/HardwareShopContracts/ViewModels/BuildViewModel.cs +++ b/HardwareShop/HardwareShopContracts/ViewModels/BuildViewModel.cs @@ -12,7 +12,7 @@ namespace HardwareShopContracts.ViewModels [DisplayName("Название компонента")] public string BuildName { get; set; } = string.Empty; - [DisplayName("Логин работника")] + [DisplayName("Логин пользователя")] public string UserLogin { get; set; } = string.Empty; public int UserId { get; set; } diff --git a/HardwareShop/HardwareShopContracts/ViewModels/CommentViewModel.cs b/HardwareShop/HardwareShopContracts/ViewModels/CommentViewModel.cs index 15343a3..6620922 100644 --- a/HardwareShop/HardwareShopContracts/ViewModels/CommentViewModel.cs +++ b/HardwareShop/HardwareShopContracts/ViewModels/CommentViewModel.cs @@ -17,7 +17,7 @@ namespace HardwareShopContracts.ViewModels public int UserId { get; set; } - [DisplayName("Логин работника")] + [DisplayName("Логин пользователя")] public string UserLogin { get; set; } = string.Empty; } } diff --git a/HardwareShop/HardwareShopContracts/ViewModels/PurchaseViewModel.cs b/HardwareShop/HardwareShopContracts/ViewModels/PurchaseViewModel.cs index 2a6967a..bc96eb6 100644 --- a/HardwareShop/HardwareShopContracts/ViewModels/PurchaseViewModel.cs +++ b/HardwareShop/HardwareShopContracts/ViewModels/PurchaseViewModel.cs @@ -18,7 +18,7 @@ namespace HardwareShopContracts.ViewModels public int UserId { get; set; } - [DisplayName("Логин работника")] + [DisplayName("Логин пользователя")] public string UserLogin { get; set; } = string.Empty; public Dictionary? PurchaseBuilds { get; set; } diff --git a/HardwareShop/HardwareShopDatabaseImplement/Models/Worker/Build.cs b/HardwareShop/HardwareShopDatabaseImplement/Models/Worker/Build.cs index 9132609..9660312 100644 --- a/HardwareShop/HardwareShopDatabaseImplement/Models/Worker/Build.cs +++ b/HardwareShop/HardwareShopDatabaseImplement/Models/Worker/Build.cs @@ -23,14 +23,14 @@ namespace HardwareShopDatabaseImplement.Models.Worker public virtual User User { get; set; } [ForeignKey("BuildId")] - public virtual List? Comments { get; set; } + public virtual List Comments { get; set; } = new(); [ForeignKey("BuildId")] - public virtual List? Components { get; set; } + public virtual List Components { get; set; } = new(); [ForeignKey("BuildId")] - public virtual List? Purchases { get; set; } + public virtual List Purchases { get; set; } = new(); private Dictionary? _buildComponents = null;