From 63ea657569dce1719cd5d65b1cbee41ee6221810 Mon Sep 17 00:00:00 2001 From: Programmist73 Date: Mon, 27 Mar 2023 11:55:41 +0400 Subject: [PATCH] =?UTF-8?q?Revert=20"=D0=9F=D1=80=D0=BE=D0=BC=D0=B5=D0=B6?= =?UTF-8?q?=D1=83=D1=82=D0=BE=D1=87=D0=BD=D0=BE=D0=B5=20=D1=81=D0=BE=D1=85?= =?UTF-8?q?=D1=80=D0=B0=D0=BD=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=BC=D0=B5=D0=BB?= =?UTF-8?q?=D0=BA=D0=B8=D1=85=20=D0=B8=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D0=B9.=20=D0=9D=D0=BE=20=D0=BE=D0=BD=D0=B8?= =?UTF-8?q?=20=D0=BA=D0=B0=D0=BF=D0=B5=D1=86=20=D0=B2=D1=8B=D0=B6=D0=BD?= =?UTF-8?q?=D1=8B=D0=B5"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 6f178a6f1c30407e64ddbe29e541ebb5f21cb17a. --- .../BlacksmithWorkshop/FormClients.cs | 1 + .../BlacksmithWorkshop/FormMain.Designer.cs | 18 ++++----- .../BlacksmithWorkshop/FormMain.cs | 2 - .../Controllers/HomeController.cs | 4 +- .../BlacksmithWorkshopClientApp/Program.cs | 4 -- .../Views/Home/Create.cshtml | 2 +- .../Implements/OrderStorage.cs | 37 +++++++++++++------ .../Models/Order.cs | 5 +-- 8 files changed, 41 insertions(+), 32 deletions(-) diff --git a/BlacksmithWorkshop/BlacksmithWorkshop/FormClients.cs b/BlacksmithWorkshop/BlacksmithWorkshop/FormClients.cs index 0ed15ea..70722c8 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshop/FormClients.cs +++ b/BlacksmithWorkshop/BlacksmithWorkshop/FormClients.cs @@ -45,6 +45,7 @@ namespace BlacksmithWorkshop if (list != null) { dataGridView.DataSource = list; + dataGridView.Columns["ClientId"].Visible = false; dataGridView.Columns["ClientFIO"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; } diff --git a/BlacksmithWorkshop/BlacksmithWorkshop/FormMain.Designer.cs b/BlacksmithWorkshop/BlacksmithWorkshop/FormMain.Designer.cs index 6783697..d1f91e1 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshop/FormMain.Designer.cs +++ b/BlacksmithWorkshop/BlacksmithWorkshop/FormMain.Designer.cs @@ -55,12 +55,12 @@ dataGridView.Name = "dataGridView"; dataGridView.RowHeadersWidth = 51; dataGridView.RowTemplate.Height = 29; - dataGridView.Size = new Size(1209, 402); + dataGridView.Size = new Size(937, 402); dataGridView.TabIndex = 0; // // buttonCreateOrder // - buttonCreateOrder.Location = new Point(1247, 70); + buttonCreateOrder.Location = new Point(1014, 66); buttonCreateOrder.Name = "buttonCreateOrder"; buttonCreateOrder.Size = new Size(235, 29); buttonCreateOrder.TabIndex = 1; @@ -70,7 +70,7 @@ // // buttonTakeOrderInWork // - buttonTakeOrderInWork.Location = new Point(1247, 147); + buttonTakeOrderInWork.Location = new Point(1014, 143); buttonTakeOrderInWork.Name = "buttonTakeOrderInWork"; buttonTakeOrderInWork.Size = new Size(235, 29); buttonTakeOrderInWork.TabIndex = 2; @@ -80,7 +80,7 @@ // // buttonOrderReady // - buttonOrderReady.Location = new Point(1247, 224); + buttonOrderReady.Location = new Point(1014, 220); buttonOrderReady.Name = "buttonOrderReady"; buttonOrderReady.Size = new Size(235, 29); buttonOrderReady.TabIndex = 3; @@ -90,7 +90,7 @@ // // buttonIssuedOrder // - buttonIssuedOrder.Location = new Point(1247, 300); + buttonIssuedOrder.Location = new Point(1014, 296); buttonIssuedOrder.Name = "buttonIssuedOrder"; buttonIssuedOrder.Size = new Size(235, 29); buttonIssuedOrder.TabIndex = 4; @@ -100,7 +100,7 @@ // // buttonRef // - buttonRef.Location = new Point(1247, 373); + buttonRef.Location = new Point(1014, 369); buttonRef.Name = "buttonRef"; buttonRef.Size = new Size(235, 29); buttonRef.TabIndex = 5; @@ -114,7 +114,7 @@ menuStrip.Items.AddRange(new ToolStripItem[] { toolStripMenuItem, reportsToolStripMenuItem, workWithClientsToolStripMenuItem }); menuStrip.Location = new Point(0, 0); menuStrip.Name = "menuStrip"; - menuStrip.Size = new Size(1506, 28); + menuStrip.Size = new Size(1297, 28); menuStrip.TabIndex = 6; menuStrip.Text = "menuStrip1"; // @@ -177,7 +177,7 @@ // clientsToolStripMenuItem // clientsToolStripMenuItem.Name = "clientsToolStripMenuItem"; - clientsToolStripMenuItem.Size = new Size(152, 26); + clientsToolStripMenuItem.Size = new Size(224, 26); clientsToolStripMenuItem.Text = "Клиенты"; clientsToolStripMenuItem.Click += ClientsToolStripMenuItem_Click; // @@ -185,7 +185,7 @@ // AutoScaleDimensions = new SizeF(8F, 20F); AutoScaleMode = AutoScaleMode.Font; - ClientSize = new Size(1506, 450); + ClientSize = new Size(1297, 450); Controls.Add(buttonRef); Controls.Add(buttonIssuedOrder); Controls.Add(buttonOrderReady); diff --git a/BlacksmithWorkshop/BlacksmithWorkshop/FormMain.cs b/BlacksmithWorkshop/BlacksmithWorkshop/FormMain.cs index e8058df..bd1ba9e 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshop/FormMain.cs +++ b/BlacksmithWorkshop/BlacksmithWorkshop/FormMain.cs @@ -49,9 +49,7 @@ namespace BlacksmithWorkshop { dataGridView.DataSource = list; dataGridView.Columns["ManufactureId"].Visible = false; - dataGridView.Columns["ClientId"].Visible = false; dataGridView.Columns["ManufactureName"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; - dataGridView.Columns["ClientFIO"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; } _logger.LogInformation("Загрузка заказов"); diff --git a/BlacksmithWorkshop/BlacksmithWorkshopClientApp/Controllers/HomeController.cs b/BlacksmithWorkshop/BlacksmithWorkshopClientApp/Controllers/HomeController.cs index e81cd6d..b45b481 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshopClientApp/Controllers/HomeController.cs +++ b/BlacksmithWorkshop/BlacksmithWorkshopClientApp/Controllers/HomeController.cs @@ -169,10 +169,10 @@ namespace BlacksmithWorkshopClientApp.Controllers [HttpPost] public double Calc(int count, int manufacture) { - var manuf =APIClient.GetRequest($"api/main/getmanufacture?manufactureId={manufacture}" + var prod =APIClient.GetRequest($"api/main/getmanufacture?manufactureId={manufacture}" ); - return count * (manuf?.Price ?? 1); + return count * (prod?.Price ?? 1); } } } \ No newline at end of file diff --git a/BlacksmithWorkshop/BlacksmithWorkshopClientApp/Program.cs b/BlacksmithWorkshop/BlacksmithWorkshopClientApp/Program.cs index 04eb63a..0727468 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshopClientApp/Program.cs +++ b/BlacksmithWorkshop/BlacksmithWorkshopClientApp/Program.cs @@ -1,5 +1,3 @@ -using BlacksmithWorkshopClientApp; - var builder = WebApplication.CreateBuilder(args); // Add services to the container. @@ -7,8 +5,6 @@ builder.Services.AddControllersWithViews(); var app = builder.Build(); -APIClient.Connect(builder.Configuration); - // Configure the HTTP request pipeline. if (!app.Environment.IsDevelopment()) { diff --git a/BlacksmithWorkshop/BlacksmithWorkshopClientApp/Views/Home/Create.cshtml b/BlacksmithWorkshop/BlacksmithWorkshopClientApp/Views/Home/Create.cshtml index 2d60b8f..5841849 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshopClientApp/Views/Home/Create.cshtml +++ b/BlacksmithWorkshop/BlacksmithWorkshopClientApp/Views/Home/Create.cshtml @@ -9,7 +9,7 @@
Изделие:
- +
diff --git a/BlacksmithWorkshop/BlacksmithWorkshopDatabaseImplement/Implements/OrderStorage.cs b/BlacksmithWorkshop/BlacksmithWorkshopDatabaseImplement/Implements/OrderStorage.cs index 3c1f16b..4cf0e4d 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshopDatabaseImplement/Implements/OrderStorage.cs +++ b/BlacksmithWorkshop/BlacksmithWorkshopDatabaseImplement/Implements/OrderStorage.cs @@ -19,6 +19,8 @@ namespace BlacksmithWorkshopDatabaseImplement.Implements using var context = new BlacksmithWorkshopDatabase(); var element = context.Orders + .Include(x => x.Manufacture) + .Include(x => x.Client) .FirstOrDefault(rec => rec.Id == model.Id); if (element != null) @@ -26,8 +28,8 @@ namespace BlacksmithWorkshopDatabaseImplement.Implements // для отображения КОРРЕКТНОЙ ViewModel-и var deletedElement = context.Orders .Include(x => x.Manufacture) - .Include(x => x.Client) - .FirstOrDefault(x => x.Id == model.Id) + .Include(x => x.Client) + .FirstOrDefault(x => x.Id == model.Id) ?.GetViewModel; context.Orders.Remove(element); @@ -73,13 +75,26 @@ namespace BlacksmithWorkshopDatabaseImplement.Implements .Select(x => x.GetViewModel) .ToList(); } + else if (model.Id.HasValue) + { + return context.Orders + .Include(x => x.Manufacture) + .Include(x => x.Client) + .Where(x => x.Id == model.Id) + .Select(x => x.GetViewModel) + .ToList(); + } + else if(model.ClientId.HasValue) + { + return context.Orders + .Include(x => x.Manufacture) + .Include(x => x.Client) + .Where(x => x.ClientId == model.ClientId) + .Select(x => x.GetViewModel) + .ToList(); + } - return context.Orders - .Include(x => x.Manufacture) - .Include(x => x.Client) - .Where(x => x.Id == model.Id) - .Select(x => x.GetViewModel) - .ToList(); + return new(); } public List GetFullList() @@ -88,8 +103,8 @@ namespace BlacksmithWorkshopDatabaseImplement.Implements return context.Orders .Include(x => x.Manufacture) - .Include(x => x.Client) - .Select(x => x.GetViewModel) + .Include(x => x.Client) + .Select(x => x.GetViewModel) .ToList(); } @@ -122,7 +137,7 @@ namespace BlacksmithWorkshopDatabaseImplement.Implements .Include(x => x.Client) .FirstOrDefault(x => x.Id == model.Id); - if (order == null) + if (order == null) { return null; } diff --git a/BlacksmithWorkshop/BlacksmithWorkshopDatabaseImplement/Models/Order.cs b/BlacksmithWorkshop/BlacksmithWorkshopDatabaseImplement/Models/Order.cs index a39b1ca..b61e409 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshopDatabaseImplement/Models/Order.cs +++ b/BlacksmithWorkshop/BlacksmithWorkshopDatabaseImplement/Models/Order.cs @@ -83,8 +83,7 @@ namespace BlacksmithWorkshopDatabaseImplement.Models Status = Status, DateCreate = DateCreate, DateImplement = DateImplement, - ManufactureName = Manufacture.ManufactureName, - ClientFIO = Client.ClientFIO - }; + ManufactureName = Manufacture.ManufactureName + }; } }