From 73518b39c8606b5fc8be7b4da098d0d524d0bfca Mon Sep 17 00:00:00 2001 From: "DozorovaA.A" Date: Sat, 20 May 2023 13:14:38 +0400 Subject: [PATCH] add graphics --- .../Controllers/HomeController.cs | 60 +++++++- .../Program.cs | 1 + .../GraphicOrdersByFurnitureAtDate.cshtml | 130 +++++++++++++++++ .../Views/Home/GraphicUsersFurnitures.cshtml | 130 +++++++++++++++++ .../Views/Home/GraphicUsersMaterials.cshtml | 131 ++++++++++++++++++ .../Views/Home/Graphics.cshtml | 20 +++ .../Views/Shared/_Layout.cshtml | 5 +- 7 files changed, 475 insertions(+), 2 deletions(-) create mode 100644 FurnitureAssembly/FurnitureAssemblyStoreKeeperClientApp/Views/Home/GraphicOrdersByFurnitureAtDate.cshtml create mode 100644 FurnitureAssembly/FurnitureAssemblyStoreKeeperClientApp/Views/Home/GraphicUsersFurnitures.cshtml create mode 100644 FurnitureAssembly/FurnitureAssemblyStoreKeeperClientApp/Views/Home/GraphicUsersMaterials.cshtml create mode 100644 FurnitureAssembly/FurnitureAssemblyStoreKeeperClientApp/Views/Home/Graphics.cshtml diff --git a/FurnitureAssembly/FurnitureAssemblyStoreKeeperClientApp/Controllers/HomeController.cs b/FurnitureAssembly/FurnitureAssemblyStoreKeeperClientApp/Controllers/HomeController.cs index ed4108d..4122aeb 100644 --- a/FurnitureAssembly/FurnitureAssemblyStoreKeeperClientApp/Controllers/HomeController.cs +++ b/FurnitureAssembly/FurnitureAssemblyStoreKeeperClientApp/Controllers/HomeController.cs @@ -14,12 +14,16 @@ namespace FurnitureAssemblyStoreKeeperClientApp.Controllers { private readonly ILogger _logger; private readonly IFurnitureStorage _furnitureStorage; + private readonly IMaterialStorage _materialStorage; private readonly IReportStorekeeperLogic _report; - public HomeController(ILogger logger, IFurnitureStorage furnitureStorage, IReportStorekeeperLogic report) + public HomeController(ILogger logger, + IFurnitureStorage furnitureStorage, IReportStorekeeperLogic report, + IMaterialStorage material) { _logger = logger; _furnitureStorage = furnitureStorage; _report = report; + _materialStorage = material; } public IActionResult Index() @@ -570,5 +574,59 @@ namespace FurnitureAssemblyStoreKeeperClientApp.Controllers return new PhysicalFileResult("C:\\temp\\pdf_storekeeper.pdf", "application/pdf"); } #endregion + [HttpGet] + public IActionResult Graphics() + { + if (APIClient.User == null) + { + return Redirect("~/Home/Enter"); + } + return View(); + } + + [HttpGet] + public IActionResult GraphicOrdersByFurnitureAtDate() + { + if (APIClient.User == null) + { + throw new Exception("Вы как суда попали? Суда вход только авторизованным"); + } + var data = new List>(); + _furnitureStorage.GetFullList().GroupBy(x => x.DateCreate.Date.Date).ToList().ForEach(x => + { + data.Add(new Tuple(x.Key.Date.ToString().Split(" ")[0], x.Count())); + }); + return View(data); + } + + [HttpGet] + public IActionResult GraphicUsersFurnitures() + { + if (APIClient.User == null) + { + throw new Exception("Вы как суда попали? Суда вход только авторизованным"); + } + var data = new List>(); + _furnitureStorage.GetFullList().GroupBy(x => x.UserName).ToList().ForEach(x => + { + data.Add(new Tuple(x.Key, x.Count())); + }); + return View(data); + } + + [HttpGet] + public IActionResult GraphicUsersMaterials() + { + if (APIClient.User == null) + { + throw new Exception("Вы как суда попали? Суда вход только авторизованным"); + } + var data = new List>(); + _materialStorage.GetFullList().GroupBy(x => x.UserName).ToList().ForEach(x => + { + data.Add(new Tuple(x.Key, x.Count())); + }); + return View(data); + } } } \ No newline at end of file diff --git a/FurnitureAssembly/FurnitureAssemblyStoreKeeperClientApp/Program.cs b/FurnitureAssembly/FurnitureAssemblyStoreKeeperClientApp/Program.cs index 72db3ad..f142633 100644 --- a/FurnitureAssembly/FurnitureAssemblyStoreKeeperClientApp/Program.cs +++ b/FurnitureAssembly/FurnitureAssemblyStoreKeeperClientApp/Program.cs @@ -11,6 +11,7 @@ var builder = WebApplication.CreateBuilder(args); builder.Services.AddControllersWithViews(); builder.Services.AddTransient (); +builder.Services.AddTransient (); builder.Services.AddTransient (); builder.Services.AddTransient(); diff --git a/FurnitureAssembly/FurnitureAssemblyStoreKeeperClientApp/Views/Home/GraphicOrdersByFurnitureAtDate.cshtml b/FurnitureAssembly/FurnitureAssemblyStoreKeeperClientApp/Views/Home/GraphicOrdersByFurnitureAtDate.cshtml new file mode 100644 index 0000000..5c51977 --- /dev/null +++ b/FurnitureAssembly/FurnitureAssemblyStoreKeeperClientApp/Views/Home/GraphicOrdersByFurnitureAtDate.cshtml @@ -0,0 +1,130 @@ +@using FurnitureAssemblyContracts.ViewModels + +@model List> + +@{ + ViewData["Title"] = "Количество заказов в день"; +} + +
+ @{ + if (Model == null) + { +

Количество заказов в день

+ return; + } + +
+
+ } +
+ +@section Scripts { + +} \ No newline at end of file diff --git a/FurnitureAssembly/FurnitureAssemblyStoreKeeperClientApp/Views/Home/GraphicUsersFurnitures.cshtml b/FurnitureAssembly/FurnitureAssemblyStoreKeeperClientApp/Views/Home/GraphicUsersFurnitures.cshtml new file mode 100644 index 0000000..5c51977 --- /dev/null +++ b/FurnitureAssembly/FurnitureAssemblyStoreKeeperClientApp/Views/Home/GraphicUsersFurnitures.cshtml @@ -0,0 +1,130 @@ +@using FurnitureAssemblyContracts.ViewModels + +@model List> + +@{ + ViewData["Title"] = "Количество заказов в день"; +} + +
+ @{ + if (Model == null) + { +

Количество заказов в день

+ return; + } + +
+
+ } +
+ +@section Scripts { + +} \ No newline at end of file diff --git a/FurnitureAssembly/FurnitureAssemblyStoreKeeperClientApp/Views/Home/GraphicUsersMaterials.cshtml b/FurnitureAssembly/FurnitureAssemblyStoreKeeperClientApp/Views/Home/GraphicUsersMaterials.cshtml new file mode 100644 index 0000000..07be022 --- /dev/null +++ b/FurnitureAssembly/FurnitureAssemblyStoreKeeperClientApp/Views/Home/GraphicUsersMaterials.cshtml @@ -0,0 +1,131 @@ +@using FurnitureAssemblyContracts.ViewModels + +@model List> + +@{ + ViewData["Title"] = "Количество заказов в день"; +} + +
+ @{ + if (Model == null) + { +

Количество заказов в день

+ return; + } + +
+
+ } +
+ +@section Scripts { + +} \ No newline at end of file diff --git a/FurnitureAssembly/FurnitureAssemblyStoreKeeperClientApp/Views/Home/Graphics.cshtml b/FurnitureAssembly/FurnitureAssemblyStoreKeeperClientApp/Views/Home/Graphics.cshtml new file mode 100644 index 0000000..67a4b47 --- /dev/null +++ b/FurnitureAssembly/FurnitureAssemblyStoreKeeperClientApp/Views/Home/Graphics.cshtml @@ -0,0 +1,20 @@ +@using FurnitureAssemblyContracts.ViewModels + + +@{ + ViewData["Title"] = "Графики"; +} + +
+

Графики

+
+ + \ No newline at end of file diff --git a/FurnitureAssembly/FurnitureAssemblyStoreKeeperClientApp/Views/Shared/_Layout.cshtml b/FurnitureAssembly/FurnitureAssemblyStoreKeeperClientApp/Views/Shared/_Layout.cshtml index b8fd386..101d5a3 100644 --- a/FurnitureAssembly/FurnitureAssemblyStoreKeeperClientApp/Views/Shared/_Layout.cshtml +++ b/FurnitureAssembly/FurnitureAssemblyStoreKeeperClientApp/Views/Shared/_Layout.cshtml @@ -7,6 +7,9 @@ + + +
@@ -46,7 +49,7 @@ Список материалов за период }