Compare commits
9 Commits
bca38819f6
...
081175a002
Author | SHA1 | Date | |
---|---|---|---|
|
081175a002 | ||
|
e140add5e6 | ||
|
b47fccbd24 | ||
|
6c3ef830b4 | ||
|
da49454a80 | ||
|
f351af3745 | ||
|
4cbaec2b57 | ||
|
c69a473c11 | ||
|
46439ae569 |
2
.gitignore
vendored
2
.gitignore
vendored
@ -397,5 +397,3 @@ FodyWeavers.xsd
|
|||||||
|
|
||||||
# JetBrains Rider
|
# JetBrains Rider
|
||||||
*.sln.iml
|
*.sln.iml
|
||||||
|
|
||||||
*.csproj
|
|
||||||
|
10
SushiBar/SushiBar/Forms/FormReportOrders.Designer.cs
generated
10
SushiBar/SushiBar/Forms/FormReportOrders.Designer.cs
generated
@ -35,6 +35,7 @@
|
|||||||
dateTimePickerFrom = new DateTimePicker();
|
dateTimePickerFrom = new DateTimePicker();
|
||||||
buttonToPdf = new Button();
|
buttonToPdf = new Button();
|
||||||
buttonMake = new Button();
|
buttonMake = new Button();
|
||||||
|
panelBody = new Panel();
|
||||||
panel.SuspendLayout();
|
panel.SuspendLayout();
|
||||||
SuspendLayout();
|
SuspendLayout();
|
||||||
//
|
//
|
||||||
@ -104,11 +105,19 @@
|
|||||||
buttonMake.UseVisualStyleBackColor = true;
|
buttonMake.UseVisualStyleBackColor = true;
|
||||||
buttonMake.Click += buttonMake_Click;
|
buttonMake.Click += buttonMake_Click;
|
||||||
//
|
//
|
||||||
|
// panelBody
|
||||||
|
//
|
||||||
|
panelBody.Location = new Point(0, 57);
|
||||||
|
panelBody.Name = "panelBody";
|
||||||
|
panelBody.Size = new Size(800, 393);
|
||||||
|
panelBody.TabIndex = 1;
|
||||||
|
//
|
||||||
// FormReportOrders
|
// FormReportOrders
|
||||||
//
|
//
|
||||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
ClientSize = new Size(800, 450);
|
ClientSize = new Size(800, 450);
|
||||||
|
Controls.Add(panelBody);
|
||||||
Controls.Add(panel);
|
Controls.Add(panel);
|
||||||
Name = "FormReportOrders";
|
Name = "FormReportOrders";
|
||||||
Text = "FormReportOrders";
|
Text = "FormReportOrders";
|
||||||
@ -126,5 +135,6 @@
|
|||||||
private DateTimePicker dateTimePickerFrom;
|
private DateTimePicker dateTimePickerFrom;
|
||||||
private Label label1;
|
private Label label1;
|
||||||
private Label label2;
|
private Label label2;
|
||||||
|
private Panel panelBody;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -20,10 +20,9 @@ namespace SushiBar.Forms
|
|||||||
{
|
{
|
||||||
Dock = DockStyle.Fill
|
Dock = DockStyle.Fill
|
||||||
};
|
};
|
||||||
reportViewer.LocalReport.LoadReportDefinition(new FileStream("ReportOrders.rdlc", FileMode.Open));
|
reportViewer.LocalReport.LoadReportDefinition(
|
||||||
Controls.Clear();
|
new FileStream("Report/ReportOrders.rdlc", FileMode.Open));
|
||||||
Controls.Add(reportViewer);
|
panelBody.Controls.Add(reportViewer);
|
||||||
Controls.Add(panel);
|
|
||||||
}
|
}
|
||||||
private void ButtonMake_Click(object sender, EventArgs e)
|
private void ButtonMake_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
@ -43,10 +42,15 @@ namespace SushiBar.Forms
|
|||||||
var source = new ReportDataSource("DataSetOrders", dataSource);
|
var source = new ReportDataSource("DataSetOrders", dataSource);
|
||||||
reportViewer.LocalReport.DataSources.Clear();
|
reportViewer.LocalReport.DataSources.Clear();
|
||||||
reportViewer.LocalReport.DataSources.Add(source);
|
reportViewer.LocalReport.DataSources.Add(source);
|
||||||
var parameters = new[] { new ReportParameter("ReportParameterPeriod", $"c{dateTimePickerFrom.Value.ToShortDateString()} по {dateTimePickerTo.Value.ToShortDateString()}") };
|
var parameters = new[] {
|
||||||
|
new ReportParameter("ReportParameterPeriod",
|
||||||
|
$"c{dateTimePickerFrom.Value.ToShortDateString()} по" +
|
||||||
|
$" {dateTimePickerTo.Value.ToShortDateString()}") };
|
||||||
reportViewer.LocalReport.SetParameters(parameters);
|
reportViewer.LocalReport.SetParameters(parameters);
|
||||||
reportViewer.RefreshReport();
|
reportViewer.RefreshReport();
|
||||||
_logger.LogInformation("Загрузка списка заказов на период {From}-{ To}", dateTimePickerFrom.Value.ToShortDateString(), dateTimePickerTo.Value.ToShortDateString());
|
_logger.LogInformation("Загрузка списка заказов на период {From}-{ To}",
|
||||||
|
dateTimePickerFrom.Value.ToShortDateString(),
|
||||||
|
dateTimePickerTo.Value.ToShortDateString());
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@ -69,6 +73,7 @@ namespace SushiBar.Forms
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
System.Text.Encoding.RegisterProvider(System.Text.CodePagesEncodingProvider.Instance);
|
||||||
_logic.SaveOrdersToPdfFile(new ReportBindingModel
|
_logic.SaveOrdersToPdfFile(new ReportBindingModel
|
||||||
{
|
{
|
||||||
FileName = dialog.FileName,
|
FileName = dialog.FileName,
|
||||||
|
@ -26,16 +26,22 @@ namespace SushiBar.Forms
|
|||||||
dataGridView.Rows.Clear();
|
dataGridView.Rows.Clear();
|
||||||
foreach (var elem in dict)
|
foreach (var elem in dict)
|
||||||
{
|
{
|
||||||
dataGridView.Rows.Add(new object[] { elem.ComponentName, "", "" });
|
dataGridView.Rows.Add(new object[] {
|
||||||
foreach (var listElem in elem.Sushis)
|
elem.SushiName, "", ""
|
||||||
|
});
|
||||||
|
foreach (var listElem in elem.Components)
|
||||||
{
|
{
|
||||||
dataGridView.Rows.Add(new object[] { "", listElem.Item1, listElem.Item2 });
|
dataGridView.Rows.Add(new object[] {
|
||||||
|
"", listElem.Item1, listElem.Item2
|
||||||
|
});
|
||||||
}
|
}
|
||||||
dataGridView.Rows.Add(new object[] { "Итого", "", elem.TotalCount });
|
dataGridView.Rows.Add(new object[] {
|
||||||
|
"Итого", "", elem.TotalCount
|
||||||
|
});
|
||||||
dataGridView.Rows.Add(Array.Empty<object>());
|
dataGridView.Rows.Add(Array.Empty<object>());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_logger.LogInformation("Загрузка списка изделий по компонентам");
|
_logger.LogInformation("Загрузка списка суши по компонентам");
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
<Report xmlns="http://schemas.microsoft.com/sqlserver/reporting/2016/01/reportdefinition" xmlns:rd="http://schemas.microsoft.com/SQLServer/reporting/reportdesigner">
|
<Report xmlns="http://schemas.microsoft.com/sqlserver/reporting/2016/01/reportdefinition" xmlns:rd="http://schemas.microsoft.com/SQLServer/reporting/reportdesigner">
|
||||||
<AutoRefresh>0</AutoRefresh>
|
<AutoRefresh>0</AutoRefresh>
|
||||||
<DataSources>
|
<DataSources>
|
||||||
<DataSource Name="FishFactoryContractsViewModels">
|
<DataSource Name="SushiBarContractsViewModels">
|
||||||
<ConnectionProperties>
|
<ConnectionProperties>
|
||||||
<DataProvider>System.Data.DataSet</DataProvider>
|
<DataProvider>System.Data.DataSet</DataProvider>
|
||||||
<ConnectString>/* Local Connection */</ConnectString>
|
<ConnectString>/* Local Connection */</ConnectString>
|
||||||
@ -13,7 +13,7 @@
|
|||||||
<DataSets>
|
<DataSets>
|
||||||
<DataSet Name="DataSetOrders">
|
<DataSet Name="DataSetOrders">
|
||||||
<Query>
|
<Query>
|
||||||
<DataSourceName>FishFactoryContractsViewModels</DataSourceName>
|
<DataSourceName>SushiBarContractsViewModels</DataSourceName>
|
||||||
<CommandText>/* Local Query */</CommandText>
|
<CommandText>/* Local Query */</CommandText>
|
||||||
</Query>
|
</Query>
|
||||||
<Fields>
|
<Fields>
|
||||||
@ -25,8 +25,8 @@
|
|||||||
<DataField>DateCreate</DataField>
|
<DataField>DateCreate</DataField>
|
||||||
<rd:TypeName>System.DateTime</rd:TypeName>
|
<rd:TypeName>System.DateTime</rd:TypeName>
|
||||||
</Field>
|
</Field>
|
||||||
<Field Name="CannedName">
|
<Field Name="SushiName">
|
||||||
<DataField>CannedName</DataField>
|
<DataField>SushiName</DataField>
|
||||||
<rd:TypeName>System.String</rd:TypeName>
|
<rd:TypeName>System.String</rd:TypeName>
|
||||||
</Field>
|
</Field>
|
||||||
<Field Name="Sum">
|
<Field Name="Sum">
|
||||||
@ -35,13 +35,13 @@
|
|||||||
</Field>
|
</Field>
|
||||||
<Field Name="OrderStatus">
|
<Field Name="OrderStatus">
|
||||||
<DataField>OrderStatus</DataField>
|
<DataField>OrderStatus</DataField>
|
||||||
<rd:TypeName>FishFactoryDataModels.OrderStatus</rd:TypeName>
|
<rd:TypeName>SushiBarDataModels.OrderStatus</rd:TypeName>
|
||||||
</Field>
|
</Field>
|
||||||
</Fields>
|
</Fields>
|
||||||
<rd:DataSetInfo>
|
<rd:DataSetInfo>
|
||||||
<rd:DataSetName>FishFactoryContracts.ViewModels</rd:DataSetName>
|
<rd:DataSetName>SushiBarContracts.ViewModels</rd:DataSetName>
|
||||||
<rd:TableName>ReportOrderViewModel</rd:TableName>
|
<rd:TableName>ReportOrderViewModel</rd:TableName>
|
||||||
<rd:ObjectDataSourceType>FishFactoryContracts.ViewModels.ReportOrderViewModel, FishFactoryContracts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</rd:ObjectDataSourceType>
|
<rd:ObjectDataSourceType>SushiBarContracts.ViewModels.ReportOrderViewModel, SushiBarContracts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</rd:ObjectDataSourceType>
|
||||||
</rd:DataSetInfo>
|
</rd:DataSetInfo>
|
||||||
</DataSet>
|
</DataSet>
|
||||||
</DataSets>
|
</DataSets>
|
||||||
@ -368,7 +368,7 @@
|
|||||||
</TablixCell>
|
</TablixCell>
|
||||||
<TablixCell>
|
<TablixCell>
|
||||||
<CellContents>
|
<CellContents>
|
||||||
<Textbox Name="CannedName">
|
<Textbox Name="SushiName">
|
||||||
<CanGrow>true</CanGrow>
|
<CanGrow>true</CanGrow>
|
||||||
<KeepTogether>true</KeepTogether>
|
<KeepTogether>true</KeepTogether>
|
||||||
<Paragraphs>
|
<Paragraphs>
|
||||||
@ -382,7 +382,7 @@
|
|||||||
<Style />
|
<Style />
|
||||||
</Paragraph>
|
</Paragraph>
|
||||||
</Paragraphs>
|
</Paragraphs>
|
||||||
<rd:DefaultName>CannedName</rd:DefaultName>
|
<rd:DefaultName>SushiName</rd:DefaultName>
|
||||||
<Style>
|
<Style>
|
||||||
<Border>
|
<Border>
|
||||||
<Color>LightGrey</Color>
|
<Color>LightGrey</Color>
|
||||||
|
40
SushiBar/SushiBar/SushiBar.csproj
Normal file
40
SushiBar/SushiBar/SushiBar.csproj
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<OutputType>WinExe</OutputType>
|
||||||
|
<TargetFramework>net6.0-windows</TargetFramework>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
<UseWindowsForms>true</UseWindowsForms>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.16">
|
||||||
|
<PrivateAssets>all</PrivateAssets>
|
||||||
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
|
</PackageReference>
|
||||||
|
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.0" />
|
||||||
|
<PackageReference Include="NLog" Version="5.2.8" />
|
||||||
|
<PackageReference Include="NLog.Config" Version="4.7.15" />
|
||||||
|
<PackageReference Include="NLog.Extensions.Logging" Version="5.3.8" />
|
||||||
|
<PackageReference Include="ReportViewerCore.WinForms" Version="15.1.19" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\SushiBarBusinessLogic\SushiBarBusinessLogic.csproj" />
|
||||||
|
<ProjectReference Include="..\SushiBarDatabaseImplement\SushiBarDatabaseImplement.csproj" />
|
||||||
|
<ProjectReference Include="..\SushiBarFileImplement\SushiBarFileImplement.csproj" />
|
||||||
|
<ProjectReference Include="..\SushiBarListImplement\SushiBarListImplement.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<None Update="nlog.config">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Update="Report\ReportOrders.rdlc">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
19
SushiBar/SushiBarBusinessLogic/SushiBarBusinessLogic.csproj
Normal file
19
SushiBar/SushiBarBusinessLogic/SushiBarBusinessLogic.csproj
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="DocumentFormat.OpenXml" Version="3.0.2" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.0" />
|
||||||
|
<PackageReference Include="MigraDoc.Rendering.Standard" Version="1.0.10" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\SushiBarContracts\SushiBarContracts.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
13
SushiBar/SushiBarContracts/SushiBarContracts.csproj
Normal file
13
SushiBar/SushiBarContracts/SushiBarContracts.csproj
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\SushiBarDataModels\SushiBarDataModels.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
9
SushiBar/SushiBarDataModels/SushiBarDataModels.csproj
Normal file
9
SushiBar/SushiBarDataModels/SushiBarDataModels.csproj
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
</Project>
|
@ -14,19 +14,20 @@ namespace SushiBarDatabaseImplement.Implements
|
|||||||
{
|
{
|
||||||
using var context = new SushiBarDatabase();
|
using var context = new SushiBarDatabase();
|
||||||
return context.Orders
|
return context.Orders
|
||||||
.ToList()
|
.Include(o => o.Sushi)
|
||||||
.Select(x => x.GetViewModel(context))
|
.Select(o => o.GetViewModel)
|
||||||
.ToList();
|
.ToList();
|
||||||
}
|
}
|
||||||
public List<OrderViewModel> GetFilteredList(OrderSearchModel model)
|
public List<OrderViewModel> GetFilteredList(OrderSearchModel model)
|
||||||
{
|
{
|
||||||
var result = new List<OrderViewModel>();
|
using var context = new SushiBarDatabase();
|
||||||
var element = GetElement(model);
|
return context.Orders
|
||||||
if (element != null)
|
.Include(o => o.Sushi)
|
||||||
{
|
.Where(o =>
|
||||||
result.Add(element);
|
(model.Id.HasValue && o.Id == model.Id) ||
|
||||||
}
|
(model.DateFrom.HasValue && model.DateTo.HasValue && model.DateFrom < o.DateCreate && o.DateCreate < model.DateTo))
|
||||||
return new();
|
.Select(o => o.GetViewModel)
|
||||||
|
.ToList();
|
||||||
}
|
}
|
||||||
public OrderViewModel? GetElement(OrderSearchModel model)
|
public OrderViewModel? GetElement(OrderSearchModel model)
|
||||||
{
|
{
|
||||||
@ -36,7 +37,8 @@ namespace SushiBarDatabaseImplement.Implements
|
|||||||
}
|
}
|
||||||
using var context = new SushiBarDatabase();
|
using var context = new SushiBarDatabase();
|
||||||
return context.Orders
|
return context.Orders
|
||||||
.FirstOrDefault(x => x.Id == model.Id)?.GetViewModel(context);
|
.Include (o => o.Sushi)
|
||||||
|
.FirstOrDefault(o => o.Id == model.Id)?.GetViewModel;
|
||||||
}
|
}
|
||||||
public OrderViewModel? Insert(OrderBindingModel model)
|
public OrderViewModel? Insert(OrderBindingModel model)
|
||||||
{
|
{
|
||||||
@ -48,7 +50,7 @@ namespace SushiBarDatabaseImplement.Implements
|
|||||||
}
|
}
|
||||||
context.Orders.Add(newOrder);
|
context.Orders.Add(newOrder);
|
||||||
context.SaveChanges();
|
context.SaveChanges();
|
||||||
return newOrder.GetViewModel(context);
|
return newOrder.GetViewModel;
|
||||||
}
|
}
|
||||||
public OrderViewModel? Update(OrderBindingModel model)
|
public OrderViewModel? Update(OrderBindingModel model)
|
||||||
{
|
{
|
||||||
@ -56,7 +58,7 @@ namespace SushiBarDatabaseImplement.Implements
|
|||||||
using var transaction = context.Database.BeginTransaction();
|
using var transaction = context.Database.BeginTransaction();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var order = context.Orders.FirstOrDefault(rec =>
|
var order = context.Orders.Include(o => o.Sushi).FirstOrDefault(rec =>
|
||||||
rec.Id == model.Id);
|
rec.Id == model.Id);
|
||||||
if (order == null)
|
if (order == null)
|
||||||
{
|
{
|
||||||
@ -65,7 +67,7 @@ namespace SushiBarDatabaseImplement.Implements
|
|||||||
order.Update(model);
|
order.Update(model);
|
||||||
context.SaveChanges();
|
context.SaveChanges();
|
||||||
transaction.Commit();
|
transaction.Commit();
|
||||||
return order.GetViewModel(context);
|
return order.GetViewModel;
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
@ -77,12 +79,13 @@ namespace SushiBarDatabaseImplement.Implements
|
|||||||
{
|
{
|
||||||
using var context = new SushiBarDatabase();
|
using var context = new SushiBarDatabase();
|
||||||
var element = context.Orders
|
var element = context.Orders
|
||||||
.FirstOrDefault(x => x.Id == model.Id);
|
.Include(o => o.Sushi)
|
||||||
|
.FirstOrDefault(o => o.Id == model.Id);
|
||||||
if (element != null)
|
if (element != null)
|
||||||
{
|
{
|
||||||
context.Orders.Remove(element);
|
context.Orders.Remove(element);
|
||||||
context.SaveChanges();
|
context.SaveChanges();
|
||||||
return element.GetViewModel(context);
|
return element.GetViewModel;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -1,169 +0,0 @@
|
|||||||
// <auto-generated />
|
|
||||||
using System;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
|
||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
|
||||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
|
||||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
|
||||||
using SushiBarDatabaseImplement;
|
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
namespace SushiBarDatabaseImplement.Migrations
|
|
||||||
{
|
|
||||||
[DbContext(typeof(SushiBarDatabase))]
|
|
||||||
[Migration("20240313064708_InitialCreate3")]
|
|
||||||
partial class InitialCreate3
|
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
|
||||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
|
||||||
{
|
|
||||||
#pragma warning disable 612, 618
|
|
||||||
modelBuilder
|
|
||||||
.HasAnnotation("ProductVersion", "7.0.16")
|
|
||||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
|
||||||
|
|
||||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
|
||||||
|
|
||||||
modelBuilder.Entity("SushiBarDatabaseImplement.Models.Component", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("integer");
|
|
||||||
|
|
||||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
|
||||||
|
|
||||||
b.Property<string>("ComponentName")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<double>("Cost")
|
|
||||||
.HasColumnType("double precision");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.ToTable("Components");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("SushiBarDatabaseImplement.Models.Order", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("integer");
|
|
||||||
|
|
||||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
|
||||||
|
|
||||||
b.Property<int>("Count")
|
|
||||||
.HasColumnType("integer");
|
|
||||||
|
|
||||||
b.Property<DateTime>("DateCreate")
|
|
||||||
.HasColumnType("timestamp with time zone");
|
|
||||||
|
|
||||||
b.Property<DateTime?>("DateImplement")
|
|
||||||
.HasColumnType("timestamp with time zone");
|
|
||||||
|
|
||||||
b.Property<int>("Status")
|
|
||||||
.HasColumnType("integer");
|
|
||||||
|
|
||||||
b.Property<double>("Sum")
|
|
||||||
.HasColumnType("double precision");
|
|
||||||
|
|
||||||
b.Property<int>("SushiId")
|
|
||||||
.HasColumnType("integer");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.HasIndex("SushiId");
|
|
||||||
|
|
||||||
b.ToTable("Orders");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("SushiBarDatabaseImplement.Models.Sushi", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("integer");
|
|
||||||
|
|
||||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
|
||||||
|
|
||||||
b.Property<double>("Price")
|
|
||||||
.HasColumnType("double precision");
|
|
||||||
|
|
||||||
b.Property<string>("SushiName")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.ToTable("Sushis");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("SushiBarDatabaseImplement.Models.SushiComponent", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("integer");
|
|
||||||
|
|
||||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
|
||||||
|
|
||||||
b.Property<int>("ComponentId")
|
|
||||||
.HasColumnType("integer");
|
|
||||||
|
|
||||||
b.Property<int>("Count")
|
|
||||||
.HasColumnType("integer");
|
|
||||||
|
|
||||||
b.Property<int>("SushiId")
|
|
||||||
.HasColumnType("integer");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.HasIndex("ComponentId");
|
|
||||||
|
|
||||||
b.HasIndex("SushiId");
|
|
||||||
|
|
||||||
b.ToTable("SushiComponents");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("SushiBarDatabaseImplement.Models.Order", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("SushiBarDatabaseImplement.Models.Sushi", null)
|
|
||||||
.WithMany("Orders")
|
|
||||||
.HasForeignKey("SushiId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("SushiBarDatabaseImplement.Models.SushiComponent", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("SushiBarDatabaseImplement.Models.Component", "Component")
|
|
||||||
.WithMany("SushiComponents")
|
|
||||||
.HasForeignKey("ComponentId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.HasOne("SushiBarDatabaseImplement.Models.Sushi", "Sushi")
|
|
||||||
.WithMany("Components")
|
|
||||||
.HasForeignKey("SushiId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.Navigation("Component");
|
|
||||||
|
|
||||||
b.Navigation("Sushi");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("SushiBarDatabaseImplement.Models.Component", b =>
|
|
||||||
{
|
|
||||||
b.Navigation("SushiComponents");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("SushiBarDatabaseImplement.Models.Sushi", b =>
|
|
||||||
{
|
|
||||||
b.Navigation("Components");
|
|
||||||
|
|
||||||
b.Navigation("Orders");
|
|
||||||
});
|
|
||||||
#pragma warning restore 612, 618
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,22 +0,0 @@
|
|||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
namespace SushiBarDatabaseImplement.Migrations
|
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
|
||||||
public partial class InitialCreate3 : Migration
|
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
|
||||||
protected override void Up(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
|
||||||
protected override void Down(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -12,8 +12,8 @@ using SushiBarDatabaseImplement;
|
|||||||
namespace SushiBarDatabaseImplement.Migrations
|
namespace SushiBarDatabaseImplement.Migrations
|
||||||
{
|
{
|
||||||
[DbContext(typeof(SushiBarDatabase))]
|
[DbContext(typeof(SushiBarDatabase))]
|
||||||
[Migration("20240313061851_InitialCreate2")]
|
[Migration("20240424132544_InitialCreate")]
|
||||||
partial class InitialCreate2
|
partial class InitialCreate
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||||
@ -57,10 +57,10 @@ namespace SushiBarDatabaseImplement.Migrations
|
|||||||
.HasColumnType("integer");
|
.HasColumnType("integer");
|
||||||
|
|
||||||
b.Property<DateTime>("DateCreate")
|
b.Property<DateTime>("DateCreate")
|
||||||
.HasColumnType("timestamp with time zone");
|
.HasColumnType("timestamp without time zone");
|
||||||
|
|
||||||
b.Property<DateTime?>("DateImplement")
|
b.Property<DateTime?>("DateImplement")
|
||||||
.HasColumnType("timestamp with time zone");
|
.HasColumnType("timestamp without time zone");
|
||||||
|
|
||||||
b.Property<int>("Status")
|
b.Property<int>("Status")
|
||||||
.HasColumnType("integer");
|
.HasColumnType("integer");
|
||||||
@ -126,11 +126,13 @@ namespace SushiBarDatabaseImplement.Migrations
|
|||||||
|
|
||||||
modelBuilder.Entity("SushiBarDatabaseImplement.Models.Order", b =>
|
modelBuilder.Entity("SushiBarDatabaseImplement.Models.Order", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("SushiBarDatabaseImplement.Models.Sushi", null)
|
b.HasOne("SushiBarDatabaseImplement.Models.Sushi", "Sushi")
|
||||||
.WithMany("Orders")
|
.WithMany("Orders")
|
||||||
.HasForeignKey("SushiId")
|
.HasForeignKey("SushiId")
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
.IsRequired();
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Sushi");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("SushiBarDatabaseImplement.Models.SushiComponent", b =>
|
modelBuilder.Entity("SushiBarDatabaseImplement.Models.SushiComponent", b =>
|
@ -7,7 +7,7 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
|||||||
namespace SushiBarDatabaseImplement.Migrations
|
namespace SushiBarDatabaseImplement.Migrations
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public partial class InitialCreate2 : Migration
|
public partial class InitialCreate : Migration
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
protected override void Up(MigrationBuilder migrationBuilder)
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
@ -46,12 +46,12 @@ namespace SushiBarDatabaseImplement.Migrations
|
|||||||
{
|
{
|
||||||
Id = table.Column<int>(type: "integer", nullable: false)
|
Id = table.Column<int>(type: "integer", nullable: false)
|
||||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||||
SushiId = table.Column<int>(type: "integer", nullable: false),
|
|
||||||
Count = table.Column<int>(type: "integer", nullable: false),
|
Count = table.Column<int>(type: "integer", nullable: false),
|
||||||
Sum = table.Column<double>(type: "double precision", nullable: false),
|
Sum = table.Column<double>(type: "double precision", nullable: false),
|
||||||
Status = table.Column<int>(type: "integer", nullable: false),
|
Status = table.Column<int>(type: "integer", nullable: false),
|
||||||
DateCreate = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
DateCreate = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
|
||||||
DateImplement = table.Column<DateTime>(type: "timestamp with time zone", nullable: true)
|
DateImplement = table.Column<DateTime>(type: "timestamp without time zone", nullable: true),
|
||||||
|
SushiId = table.Column<int>(type: "integer", nullable: false)
|
||||||
},
|
},
|
||||||
constraints: table =>
|
constraints: table =>
|
||||||
{
|
{
|
@ -54,10 +54,10 @@ namespace SushiBarDatabaseImplement.Migrations
|
|||||||
.HasColumnType("integer");
|
.HasColumnType("integer");
|
||||||
|
|
||||||
b.Property<DateTime>("DateCreate")
|
b.Property<DateTime>("DateCreate")
|
||||||
.HasColumnType("timestamp with time zone");
|
.HasColumnType("timestamp without time zone");
|
||||||
|
|
||||||
b.Property<DateTime?>("DateImplement")
|
b.Property<DateTime?>("DateImplement")
|
||||||
.HasColumnType("timestamp with time zone");
|
.HasColumnType("timestamp without time zone");
|
||||||
|
|
||||||
b.Property<int>("Status")
|
b.Property<int>("Status")
|
||||||
.HasColumnType("integer");
|
.HasColumnType("integer");
|
||||||
@ -123,11 +123,13 @@ namespace SushiBarDatabaseImplement.Migrations
|
|||||||
|
|
||||||
modelBuilder.Entity("SushiBarDatabaseImplement.Models.Order", b =>
|
modelBuilder.Entity("SushiBarDatabaseImplement.Models.Order", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("SushiBarDatabaseImplement.Models.Sushi", null)
|
b.HasOne("SushiBarDatabaseImplement.Models.Sushi", "Sushi")
|
||||||
.WithMany("Orders")
|
.WithMany("Orders")
|
||||||
.HasForeignKey("SushiId")
|
.HasForeignKey("SushiId")
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
.IsRequired();
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Sushi");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("SushiBarDatabaseImplement.Models.SushiComponent", b =>
|
modelBuilder.Entity("SushiBarDatabaseImplement.Models.SushiComponent", b =>
|
||||||
|
@ -10,8 +10,6 @@ namespace SushiBarDatabaseImplement.Models
|
|||||||
{
|
{
|
||||||
public int Id { get; private set; }
|
public int Id { get; private set; }
|
||||||
[Required]
|
[Required]
|
||||||
public int SushiId { get; set; }
|
|
||||||
[Required]
|
|
||||||
public int Count { get; set; }
|
public int Count { get; set; }
|
||||||
[Required]
|
[Required]
|
||||||
public double Sum { get; set; }
|
public double Sum { get; set; }
|
||||||
@ -20,31 +18,37 @@ namespace SushiBarDatabaseImplement.Models
|
|||||||
[Required]
|
[Required]
|
||||||
public DateTime DateCreate { get; set; } = DateTime.Now;
|
public DateTime DateCreate { get; set; } = DateTime.Now;
|
||||||
public DateTime? DateImplement { get; set; }
|
public DateTime? DateImplement { get; set; }
|
||||||
|
[Required]
|
||||||
|
public int SushiId { get; private set; }
|
||||||
|
public virtual Sushi Sushi { get; set; }
|
||||||
public static Order Create(SushiBarDatabase context, OrderBindingModel model)
|
public static Order Create(SushiBarDatabase context, OrderBindingModel model)
|
||||||
{
|
{
|
||||||
|
if (model == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
return new Order()
|
return new Order()
|
||||||
{
|
{
|
||||||
Id = model.Id,
|
Id = model.Id,
|
||||||
SushiId = model.SushiId,
|
|
||||||
Count = model.Count,
|
Count = model.Count,
|
||||||
Sum = model.Sum,
|
Sum = model.Sum,
|
||||||
Status = model.Status,
|
Status = model.Status,
|
||||||
DateCreate = model.DateCreate,
|
DateCreate = model.DateCreate,
|
||||||
DateImplement = model.DateImplement,
|
DateImplement = model.DateImplement,
|
||||||
|
SushiId = model.SushiId,
|
||||||
|
Sushi = context.Sushis.First(x => x.Id == model.SushiId)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
public void Update(OrderBindingModel model)
|
public void Update(OrderBindingModel model)
|
||||||
{
|
{
|
||||||
Id = model.Id;
|
if (model == null)
|
||||||
SushiId = model.SushiId;
|
{
|
||||||
Sum = model.Sum;
|
return;
|
||||||
|
}
|
||||||
Status = model.Status;
|
Status = model.Status;
|
||||||
DateCreate = model.DateCreate;
|
|
||||||
DateImplement = model.DateImplement;
|
DateImplement = model.DateImplement;
|
||||||
}
|
}
|
||||||
public OrderViewModel GetViewModel(SushiBarDatabase context)
|
public OrderViewModel GetViewModel => new()
|
||||||
{
|
|
||||||
return new()
|
|
||||||
{
|
{
|
||||||
Id = Id,
|
Id = Id,
|
||||||
SushiId = SushiId,
|
SushiId = SushiId,
|
||||||
@ -53,11 +57,7 @@ namespace SushiBarDatabaseImplement.Models
|
|||||||
Status = Status,
|
Status = Status,
|
||||||
DateCreate = DateCreate,
|
DateCreate = DateCreate,
|
||||||
DateImplement = DateImplement,
|
DateImplement = DateImplement,
|
||||||
SushiName = context.Sushis
|
SushiName = Sushi.SushiName
|
||||||
.Where(s => s.Id == SushiId)
|
|
||||||
.Select(s => s.SushiName)
|
|
||||||
.First(),
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@ -0,0 +1,29 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Remove="Migrations - Копировать\**" />
|
||||||
|
<EmbeddedResource Remove="Migrations - Копировать\**" />
|
||||||
|
<None Remove="Migrations - Копировать\**" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.16" />
|
||||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.16">
|
||||||
|
<PrivateAssets>all</PrivateAssets>
|
||||||
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
|
</PackageReference>
|
||||||
|
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="7.0.11" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\SushiBarContracts\SushiBarContracts.csproj" />
|
||||||
|
<ProjectReference Include="..\SushiBarDataModels\SushiBarDataModels.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
14
SushiBar/SushiBarFileImplement/SushiBarFileImplement.csproj
Normal file
14
SushiBar/SushiBarFileImplement/SushiBarFileImplement.csproj
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\SushiBarContracts\SushiBarContracts.csproj" />
|
||||||
|
<ProjectReference Include="..\SushiBarDataModels\SushiBarDataModels.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
14
SushiBar/SushiBarListImplement/SushiBarListImplement.csproj
Normal file
14
SushiBar/SushiBarListImplement/SushiBarListImplement.csproj
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\SushiBarContracts\SushiBarContracts.csproj" />
|
||||||
|
<ProjectReference Include="..\SushiBarDataModels\SushiBarDataModels.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
22
SushiBar/SushiBarView/SushiBarView.csproj
Normal file
22
SushiBar/SushiBarView/SushiBarView.csproj
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<OutputType>WinExe</OutputType>
|
||||||
|
<TargetFramework>net6.0-windows</TargetFramework>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
<UseWindowsForms>true</UseWindowsForms>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.0" />
|
||||||
|
<PackageReference Include="NLog.Extensions.Logging" Version="5.3.8" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\SushiBarBusinessLogic\SushiBarBusinessLogic.csproj" />
|
||||||
|
<ProjectReference Include="..\SushiBarContracts\SushiBarContracts.csproj" />
|
||||||
|
<ProjectReference Include="..\SushiBarListImplement\SushiBarListImplement.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
Loading…
Reference in New Issue
Block a user