Не работает вывод данных о заказе у клиента в вебе

This commit is contained in:
Игорь Гордеев 2024-05-01 14:03:19 +04:00
parent f8b0a536ea
commit 939cba359a
11 changed files with 39 additions and 30 deletions

View File

@ -36,13 +36,13 @@
списокСушиToolStripMenuItem = new ToolStripMenuItem();
сушиСИнгредиентамиToolStripMenuItem = new ToolStripMenuItem();
списокЗаказовToolStripMenuItem = new ToolStripMenuItem();
клиентыToolStripMenuItem = new ToolStripMenuItem();
buttonUpdate = new Button();
buttonSetToFinish = new Button();
buttonSetToDone = new Button();
buttonSetToWork = new Button();
buttonCreateOrder = new Button();
dataGridView = new DataGridView();
клиентыToolStripMenuItem = new ToolStripMenuItem();
menuStrip.SuspendLayout();
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
SuspendLayout();
@ -52,7 +52,7 @@
menuStrip.Items.AddRange(new ToolStripItem[] { справочникиToolStripMenuItem, отчетыToolStripMenuItem, клиентыToolStripMenuItem });
menuStrip.Location = new Point(0, 0);
menuStrip.Name = "menuStrip";
menuStrip.Size = new Size(975, 24);
menuStrip.Size = new Size(1112, 24);
menuStrip.TabIndex = 0;
menuStrip.Text = "menuStrip1";
//
@ -105,9 +105,17 @@
списокЗаказовToolStripMenuItem.Text = "Список заказов";
списокЗаказовToolStripMenuItem.Click += OrdersToolStripMenuItem_Click;
//
// клиентыToolStripMenuItem
//
клиентыToolStripMenuItem.Name = "клиентыToolStripMenuItem";
клиентыToolStripMenuItem.Size = new Size(67, 20);
клиентыToolStripMenuItem.Text = "Клиенты";
клиентыToolStripMenuItem.Click += клиентыToolStripMenuItem_Click;
//
// buttonUpdate
//
buttonUpdate.Location = new Point(780, 314);
buttonUpdate.Anchor = AnchorStyles.Top | AnchorStyles.Right;
buttonUpdate.Location = new Point(930, 307);
buttonUpdate.Margin = new Padding(3, 2, 3, 2);
buttonUpdate.Name = "buttonUpdate";
buttonUpdate.Size = new Size(170, 58);
@ -118,7 +126,8 @@
//
// buttonSetToFinish
//
buttonSetToFinish.Location = new Point(780, 252);
buttonSetToFinish.Anchor = AnchorStyles.Top | AnchorStyles.Right;
buttonSetToFinish.Location = new Point(930, 245);
buttonSetToFinish.Margin = new Padding(3, 2, 3, 2);
buttonSetToFinish.Name = "buttonSetToFinish";
buttonSetToFinish.Size = new Size(170, 58);
@ -129,7 +138,8 @@
//
// buttonSetToDone
//
buttonSetToDone.Location = new Point(780, 190);
buttonSetToDone.Anchor = AnchorStyles.Top | AnchorStyles.Right;
buttonSetToDone.Location = new Point(930, 183);
buttonSetToDone.Margin = new Padding(3, 2, 3, 2);
buttonSetToDone.Name = "buttonSetToDone";
buttonSetToDone.Size = new Size(170, 58);
@ -140,7 +150,8 @@
//
// buttonSetToWork
//
buttonSetToWork.Location = new Point(780, 128);
buttonSetToWork.Anchor = AnchorStyles.Top | AnchorStyles.Right;
buttonSetToWork.Location = new Point(930, 121);
buttonSetToWork.Margin = new Padding(3, 2, 3, 2);
buttonSetToWork.Name = "buttonSetToWork";
buttonSetToWork.Size = new Size(170, 58);
@ -151,7 +162,8 @@
//
// buttonCreateOrder
//
buttonCreateOrder.Location = new Point(780, 66);
buttonCreateOrder.Anchor = AnchorStyles.Top | AnchorStyles.Right;
buttonCreateOrder.Location = new Point(930, 59);
buttonCreateOrder.Margin = new Padding(3, 2, 3, 2);
buttonCreateOrder.Name = "buttonCreateOrder";
buttonCreateOrder.Size = new Size(170, 58);
@ -169,21 +181,14 @@
dataGridView.Name = "dataGridView";
dataGridView.RowHeadersWidth = 51;
dataGridView.RowTemplate.Height = 29;
dataGridView.Size = new Size(755, 426);
dataGridView.Size = new Size(919, 426);
dataGridView.TabIndex = 7;
//
// клиентыToolStripMenuItem
//
клиентыToolStripMenuItem.Name = "клиентыToolStripMenuItem";
клиентыToolStripMenuItem.Size = new Size(67, 20);
клиентыToolStripMenuItem.Text = "Клиенты";
клиентыToolStripMenuItem.Click += клиентыToolStripMenuItem_Click;
//
// FormMain
//
AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(975, 450);
ClientSize = new Size(1112, 450);
Controls.Add(buttonUpdate);
Controls.Add(buttonSetToFinish);
Controls.Add(buttonSetToDone);

View File

@ -31,7 +31,6 @@ namespace SushiBarView
{
dataGridView.DataSource = list;
dataGridView.Columns["SushiId"].Visible = false;
}
_logger.LogInformation("Загрузка заказов");
}

View File

@ -32,7 +32,8 @@ namespace SushiBarClientApp
public static void PostRequest<T>(string requestUrl, T model)
{
var json = JsonConvert.SerializeObject(model);
var data = new StringContent(json, Encoding.UTF8, "application/json");
var data = new StringContent(json, Encoding.UTF8,
"application/json");
var response = _client.PostAsync(requestUrl, data);
var result = response.Result.Content.ReadAsStringAsync().Result;
if (!response.Result.IsSuccessStatusCode)

View File

@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
@ -10,7 +10,7 @@
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="8.0.4" />
<PackageReference Include="Microsoft.CodeAnalysis.Common" Version="4.9.2" />
<PackageReference Include="Microsoft.CodeAnalysis.Common" Version="4.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup>

View File

@ -10,10 +10,6 @@ namespace SushiBarContracts.ViewModels
public string SushiName { get; set; } = string.Empty;
[DisplayName("Цена")]
public double Price { get; set; }
public Dictionary<int, (IIngredientModel, int)> SushiIngredients
{
get;
set;
} = new();
public Dictionary<int, (IIngredientModel, int)> SushiIngredients{ get; set; } = new();
}
}

View File

@ -59,6 +59,7 @@ namespace SushiBarDatabaseImplement.Implements
using var context = new SushiBarDatabase();
return context.Orders
.Include(x => x.Sushi)
.Include(x => x.Client)
.Select(x => x.GetViewModel)
.ToList();
}

View File

@ -3,7 +3,6 @@ using SushiBarContracts.ViewModels;
using SushiBarDataModels.Enums;
using SushiBarDataModels.Models;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace SushiBarDatabaseImplement.Models
{
@ -56,16 +55,16 @@ namespace SushiBarDatabaseImplement.Models
public OrderViewModel GetViewModel => new()
{
Id = Id,
SushiId = SushiId,
SushiName=Sushi.SushiName,
Count = Count,
Sum = Sum,
Status = Status,
DateCreate = DateCreate,
DateImplement = DateImplement,
Id = Id,
Status = Status,
SushiName = Sushi.SushiName,
ClientId = ClientId,
ClientFIO = Client.ClientFIO
ClientFIO = Client.ClientFIO,
};
}
}

View File

@ -26,6 +26,7 @@ builder.Services.AddSwaggerGen(c =>
Version = "v1"
});
});
builder.Services.AddApplicationInsightsTelemetry();
var app = builder.Build();
// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())

View File

@ -0,0 +1,3 @@
{
"dependencies": {}
}

View File

@ -0,0 +1,3 @@
{
"dependencies": {}
}

View File

@ -7,6 +7,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.21.0" />
<PackageReference Include="Microsoft.CodeAnalysis.Common" Version="4.9.2" />
<PackageReference Include="Microsoft.Extensions.Logging.Log4Net.AspNetCore" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.0" />