Revert "Промежуточное сохранение мелких исправлений. Но они капец выжные"

This reverts commit 6f178a6f1c.
This commit is contained in:
Programmist73 2023-03-27 11:55:41 +04:00
parent 6f178a6f1c
commit 63ea657569
8 changed files with 41 additions and 32 deletions

View File

@ -45,6 +45,7 @@ namespace BlacksmithWorkshop
if (list != null)
{
dataGridView.DataSource = list;
dataGridView.Columns["ClientId"].Visible = false;
dataGridView.Columns["ClientFIO"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
}

View File

@ -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);

View File

@ -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("Загрузка заказов");

View File

@ -169,10 +169,10 @@ namespace BlacksmithWorkshopClientApp.Controllers
[HttpPost]
public double Calc(int count, int manufacture)
{
var manuf =APIClient.GetRequest<ManufactureViewModel>($"api/main/getmanufacture?manufactureId={manufacture}"
var prod =APIClient.GetRequest<ManufactureViewModel>($"api/main/getmanufacture?manufactureId={manufacture}"
);
return count * (manuf?.Price ?? 1);
return count * (prod?.Price ?? 1);
}
}
}

View File

@ -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())
{

View File

@ -9,7 +9,7 @@
<div class="row">
<div class="col-4">Изделие:</div>
<div class="col-8">
<select id="manufacture" name="manufacture" class="form-control" asp-items="@(new SelectList(@ViewBag.Manufactures,"Id", "ManufactureName"))"></select>
<select id="manufacture" name="manufacture" class="form-control" aspitems="@(new SelectList(@ViewBag.Manufactures,"Id", "ManufactureName"))"></select>
</div>
</div>
<div class="row">

View File

@ -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<OrderViewModel> 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;
}

View File

@ -83,8 +83,7 @@ namespace BlacksmithWorkshopDatabaseImplement.Models
Status = Status,
DateCreate = DateCreate,
DateImplement = DateImplement,
ManufactureName = Manufacture.ManufactureName,
ClientFIO = Client.ClientFIO
};
ManufactureName = Manufacture.ManufactureName
};
}
}