Eliseev E.E. LabWork05 #6

Closed
ElEgEv wants to merge 21 commits from LabWork05 into LabWork04
8 changed files with 32 additions and 41 deletions
Showing only changes of commit c213555ba1 - Show all commits

View File

@ -45,7 +45,6 @@ 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(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);

View File

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

View File

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

View File

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

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" aspitems="@(new SelectList(@ViewBag.Manufactures,"Id", "ManufactureName"))"></select>
<select id="manufacture" name="manufacture" class="form-control" asp-items="@(new SelectList(@ViewBag.Manufactures,"Id", "ManufactureName"))"></select>
</div>
</div>
<div class="row">

View File

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

View File

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