From c213555ba1ff04fcef18bc3ba44361b5d9936829 Mon Sep 17 00:00:00 2001 From: Programmist73 Date: Mon, 27 Mar 2023 11:56:52 +0400 Subject: [PATCH] =?UTF-8?q?Revert=20"Revert=20"=D0=9F=D1=80=D0=BE=D0=BC?= =?UTF-8?q?=D0=B5=D0=B6=D1=83=D1=82=D0=BE=D1=87=D0=BD=D0=BE=D0=B5=20=D1=81?= =?UTF-8?q?=D0=BE=D1=85=D1=80=D0=B0=D0=BD=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=BC?= =?UTF-8?q?=D0=B5=D0=BB=D0=BA=D0=B8=D1=85=20=D0=B8=D1=81=D0=BF=D1=80=D0=B0?= =?UTF-8?q?=D0=B2=D0=BB=D0=B5=D0=BD=D0=B8=D0=B9.=20=D0=9D=D0=BE=20=D0=BE?= =?UTF-8?q?=D0=BD=D0=B8=20=D0=BA=D0=B0=D0=BF=D0=B5=D1=86=20=D0=B2=D1=8B?= =?UTF-8?q?=D0=B6=D0=BD=D1=8B=D0=B5""?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 63ea657569dce1719cd5d65b1cbee41ee6221810. --- .../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, 32 insertions(+), 41 deletions(-) diff --git a/BlacksmithWorkshop/BlacksmithWorkshop/FormClients.cs b/BlacksmithWorkshop/BlacksmithWorkshop/FormClients.cs index 70722c8..0ed15ea 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshop/FormClients.cs +++ b/BlacksmithWorkshop/BlacksmithWorkshop/FormClients.cs @@ -45,7 +45,6 @@ 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 d1f91e1..6783697 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(937, 402); + dataGridView.Size = new Size(1209, 402); dataGridView.TabIndex = 0; // // buttonCreateOrder // - buttonCreateOrder.Location = new Point(1014, 66); + buttonCreateOrder.Location = new Point(1247, 70); buttonCreateOrder.Name = "buttonCreateOrder"; buttonCreateOrder.Size = new Size(235, 29); buttonCreateOrder.TabIndex = 1; @@ -70,7 +70,7 @@ // // buttonTakeOrderInWork // - buttonTakeOrderInWork.Location = new Point(1014, 143); + buttonTakeOrderInWork.Location = new Point(1247, 147); buttonTakeOrderInWork.Name = "buttonTakeOrderInWork"; buttonTakeOrderInWork.Size = new Size(235, 29); buttonTakeOrderInWork.TabIndex = 2; @@ -80,7 +80,7 @@ // // buttonOrderReady // - buttonOrderReady.Location = new Point(1014, 220); + buttonOrderReady.Location = new Point(1247, 224); buttonOrderReady.Name = "buttonOrderReady"; buttonOrderReady.Size = new Size(235, 29); buttonOrderReady.TabIndex = 3; @@ -90,7 +90,7 @@ // // buttonIssuedOrder // - buttonIssuedOrder.Location = new Point(1014, 296); + buttonIssuedOrder.Location = new Point(1247, 300); buttonIssuedOrder.Name = "buttonIssuedOrder"; buttonIssuedOrder.Size = new Size(235, 29); buttonIssuedOrder.TabIndex = 4; @@ -100,7 +100,7 @@ // // buttonRef // - buttonRef.Location = new Point(1014, 369); + buttonRef.Location = new Point(1247, 373); 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(1297, 28); + menuStrip.Size = new Size(1506, 28); menuStrip.TabIndex = 6; menuStrip.Text = "menuStrip1"; // @@ -177,7 +177,7 @@ // clientsToolStripMenuItem // clientsToolStripMenuItem.Name = "clientsToolStripMenuItem"; - clientsToolStripMenuItem.Size = new Size(224, 26); + clientsToolStripMenuItem.Size = new Size(152, 26); clientsToolStripMenuItem.Text = "Клиенты"; clientsToolStripMenuItem.Click += ClientsToolStripMenuItem_Click; // @@ -185,7 +185,7 @@ // AutoScaleDimensions = new SizeF(8F, 20F); AutoScaleMode = AutoScaleMode.Font; - ClientSize = new Size(1297, 450); + ClientSize = new Size(1506, 450); Controls.Add(buttonRef); Controls.Add(buttonIssuedOrder); Controls.Add(buttonOrderReady); diff --git a/BlacksmithWorkshop/BlacksmithWorkshop/FormMain.cs b/BlacksmithWorkshop/BlacksmithWorkshop/FormMain.cs index bd1ba9e..e8058df 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshop/FormMain.cs +++ b/BlacksmithWorkshop/BlacksmithWorkshop/FormMain.cs @@ -49,7 +49,9 @@ 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 b45b481..e81cd6d 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 prod =APIClient.GetRequest($"api/main/getmanufacture?manufactureId={manufacture}" + var manuf =APIClient.GetRequest($"api/main/getmanufacture?manufactureId={manufacture}" ); - return count * (prod?.Price ?? 1); + return count * (manuf?.Price ?? 1); } } } \ No newline at end of file diff --git a/BlacksmithWorkshop/BlacksmithWorkshopClientApp/Program.cs b/BlacksmithWorkshop/BlacksmithWorkshopClientApp/Program.cs index 0727468..04eb63a 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshopClientApp/Program.cs +++ b/BlacksmithWorkshop/BlacksmithWorkshopClientApp/Program.cs @@ -1,3 +1,5 @@ +using BlacksmithWorkshopClientApp; + var builder = WebApplication.CreateBuilder(args); // Add services to the container. @@ -5,6 +7,8 @@ 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 5841849..2d60b8f 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 4cf0e4d..3c1f16b 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshopDatabaseImplement/Implements/OrderStorage.cs +++ b/BlacksmithWorkshop/BlacksmithWorkshopDatabaseImplement/Implements/OrderStorage.cs @@ -19,8 +19,6 @@ 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) @@ -28,8 +26,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); @@ -75,26 +73,13 @@ 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 new(); + return context.Orders + .Include(x => x.Manufacture) + .Include(x => x.Client) + .Where(x => x.Id == model.Id) + .Select(x => x.GetViewModel) + .ToList(); } public List GetFullList() @@ -103,8 +88,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(); } @@ -137,7 +122,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 b61e409..a39b1ca 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshopDatabaseImplement/Models/Order.cs +++ b/BlacksmithWorkshop/BlacksmithWorkshopDatabaseImplement/Models/Order.cs @@ -83,7 +83,8 @@ namespace BlacksmithWorkshopDatabaseImplement.Models Status = Status, DateCreate = DateCreate, DateImplement = DateImplement, - ManufactureName = Manufacture.ManufactureName - }; + ManufactureName = Manufacture.ManufactureName, + ClientFIO = Client.ClientFIO + }; } }