ISEbd-21.Fedotov.I.A.LabWork04 #4
@ -31,8 +31,8 @@ namespace DinerContracts.ViewModels
|
|||||||
[DisplayName("Номер")]
|
[DisplayName("Номер")]
|
||||||
public int ID { get; set; }
|
public int ID { get; set; }
|
||||||
|
|
||||||
[DisplayName("Снэк")]
|
|
||||||
// какой снэк изготавливается в рамках заказа
|
// какой снэк изготавливается в рамках заказа
|
||||||
|
[DisplayName("Снэк")]
|
||||||
public string ProductName { get; set; } = string.Empty;
|
public string ProductName { get; set; } = string.Empty;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
using System;
|
using DinerDataModels.Enums;
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
@ -12,5 +13,6 @@ namespace DinerContracts.ViewModels
|
|||||||
public DateTime DateCreate { get; set; }
|
public DateTime DateCreate { get; set; }
|
||||||
public string ProductName { get; set; } = string.Empty;
|
public string ProductName { get; set; } = string.Empty;
|
||||||
public double Sum { get; set; }
|
public double Sum { get; set; }
|
||||||
|
public string OrderStatus { get; set; } = string.Empty;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,8 +8,8 @@ namespace DinerContracts.ViewModels
|
|||||||
{
|
{
|
||||||
public class ReportSnackFoodsViewModel
|
public class ReportSnackFoodsViewModel
|
||||||
{
|
{
|
||||||
public string ComponentName { get; set; } = string.Empty;
|
public string ProductName { get; set; } = string.Empty;
|
||||||
public int TotalCount { get; set; }
|
public int TotalCount { get; set; }
|
||||||
public List<(string Product, int count)> Products { get; set; } = new();
|
public List<(string Product, int count)> Components { get; set; } = new();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -47,7 +47,7 @@ namespace DinerDataBaseImplement.Implements
|
|||||||
return context.Orders
|
return context.Orders
|
||||||
.Include(x => x.Snack)
|
.Include(x => x.Snack)
|
||||||
.Where(x => x.DateCreate >= model.DateFrom && x.DateCreate <= model.DateTo)
|
.Where(x => x.DateCreate >= model.DateFrom && x.DateCreate <= model.DateTo)
|
||||||
.Select(x => x.GetViewModel)
|
.Select(GetViewModel)
|
||||||
.ToList();
|
.ToList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,7 @@ namespace DinerDataBaseImplement.Migrations
|
|||||||
|
|
||||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ID"));
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ID"));
|
||||||
|
|
||||||
b.Property<string>("ComponentName")
|
b.Property<string>("ProductName")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasColumnType("nvarchar(max)");
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
@ -94,7 +94,7 @@ namespace DinerDataBaseImplement.Migrations
|
|||||||
|
|
||||||
b.HasKey("ID");
|
b.HasKey("ID");
|
||||||
|
|
||||||
b.ToTable("Products");
|
b.ToTable("Components");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("DinerDataBaseImplement.Models.SnackFood", b =>
|
modelBuilder.Entity("DinerDataBaseImplement.Models.SnackFood", b =>
|
||||||
|
@ -44,7 +44,7 @@ namespace DinerDataBaseImplement.Migrations
|
|||||||
});
|
});
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
migrationBuilder.CreateTable(
|
||||||
name: "Products",
|
name: "Components",
|
||||||
columns: table => new
|
columns: table => new
|
||||||
{
|
{
|
||||||
ID = table.Column<int>(type: "int", nullable: false)
|
ID = table.Column<int>(type: "int", nullable: false)
|
||||||
@ -79,7 +79,7 @@ namespace DinerDataBaseImplement.Migrations
|
|||||||
table.ForeignKey(
|
table.ForeignKey(
|
||||||
name: "FK_ProductComponents_Products_ProductID",
|
name: "FK_ProductComponents_Products_ProductID",
|
||||||
column: x => x.ProductID,
|
column: x => x.ProductID,
|
||||||
principalTable: "Products",
|
principalTable: "Components",
|
||||||
principalColumn: "ID",
|
principalColumn: "ID",
|
||||||
onDelete: ReferentialAction.Cascade);
|
onDelete: ReferentialAction.Cascade);
|
||||||
});
|
});
|
||||||
@ -108,7 +108,7 @@ namespace DinerDataBaseImplement.Migrations
|
|||||||
name: "Components");
|
name: "Components");
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
migrationBuilder.DropTable(
|
||||||
name: "Products");
|
name: "Components");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,7 @@ namespace DinerDataBaseImplement.Migrations
|
|||||||
|
|
||||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ID"));
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ID"));
|
||||||
|
|
||||||
b.Property<string>("ComponentName")
|
b.Property<string>("ProductName")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasColumnType("nvarchar(max)");
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
@ -93,7 +93,7 @@ namespace DinerDataBaseImplement.Migrations
|
|||||||
|
|
||||||
b.HasKey("ID");
|
b.HasKey("ID");
|
||||||
|
|
||||||
b.ToTable("Products");
|
b.ToTable("Components");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("DinerDataBaseImplement.Models.SnackFood", b =>
|
modelBuilder.Entity("DinerDataBaseImplement.Models.SnackFood", b =>
|
||||||
|
@ -33,7 +33,7 @@ namespace DinerDataBaseImplement.Migrations
|
|||||||
|
|
||||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ID"));
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ID"));
|
||||||
|
|
||||||
b.Property<string>("ComponentName")
|
b.Property<string>("ProductName")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasColumnType("nvarchar(max)");
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
@ -98,7 +98,7 @@ namespace DinerDataBaseImplement.Migrations
|
|||||||
|
|
||||||
b.HasKey("ID");
|
b.HasKey("ID");
|
||||||
|
|
||||||
b.ToTable("Products");
|
b.ToTable("Components");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("DinerDataBaseImplement.Models.SnackFood", b =>
|
modelBuilder.Entity("DinerDataBaseImplement.Models.SnackFood", b =>
|
||||||
|
@ -25,7 +25,7 @@ namespace DinerDataBaseImplement.Migrations
|
|||||||
name: "FK_Orders_Products_SnackID",
|
name: "FK_Orders_Products_SnackID",
|
||||||
table: "Orders",
|
table: "Orders",
|
||||||
column: "SnackID",
|
column: "SnackID",
|
||||||
principalTable: "Products",
|
principalTable: "Components",
|
||||||
principalColumn: "ID");
|
principalColumn: "ID");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ namespace DinerDataBaseImplement.Migrations
|
|||||||
|
|
||||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ID"));
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ID"));
|
||||||
|
|
||||||
b.Property<string>("ComponentName")
|
b.Property<string>("ProductName")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasColumnType("nvarchar(max)");
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
@ -95,7 +95,7 @@ namespace DinerDataBaseImplement.Migrations
|
|||||||
|
|
||||||
b.HasKey("ID");
|
b.HasKey("ID");
|
||||||
|
|
||||||
b.ToTable("Products", (string)null);
|
b.ToTable("Components", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("DinerDataBaseImplement.Models.SnackFood", b =>
|
modelBuilder.Entity("DinerDataBaseImplement.Models.SnackFood", b =>
|
||||||
|
@ -59,7 +59,7 @@ namespace DinerDataBaseImplement.Models
|
|||||||
Sum = Sum,
|
Sum = Sum,
|
||||||
Status = Status,
|
Status = Status,
|
||||||
DateCreate = DateCreate,
|
DateCreate = DateCreate,
|
||||||
DateImplement = DateImplement
|
DateImplement = DateImplement,
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,7 @@ namespace DinerFileImplement.Models
|
|||||||
return new Food()
|
return new Food()
|
||||||
{
|
{
|
||||||
ID = Convert.ToInt32(element.Attribute("ID")!.Value),
|
ID = Convert.ToInt32(element.Attribute("ID")!.Value),
|
||||||
ComponentName = element.Element("ComponentName")!.Value,
|
ComponentName = element.Element("ProductName")!.Value,
|
||||||
Price = Convert.ToDouble(element.Element("Price")!.Value)
|
Price = Convert.ToDouble(element.Element("Price")!.Value)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -51,7 +51,7 @@ namespace DinerFileImplement.Models
|
|||||||
};
|
};
|
||||||
|
|
||||||
public XElement GetXElement => new("Food", new XAttribute("ID", ID),
|
public XElement GetXElement => new("Food", new XAttribute("ID", ID),
|
||||||
new XElement("ComponentName", ComponentName),
|
new XElement("ProductName", ComponentName),
|
||||||
new XElement("Price", Price.ToString()));
|
new XElement("Price", Price.ToString()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,7 @@ namespace DinerView
|
|||||||
{
|
{
|
||||||
dataGridView.DataSource = list;
|
dataGridView.DataSource = list;
|
||||||
dataGridView.Columns["ID"].Visible = false;
|
dataGridView.Columns["ID"].Visible = false;
|
||||||
dataGridView.Columns["ComponentName"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
dataGridView.Columns["ProductName"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
||||||
}
|
}
|
||||||
_logger.LogInformation("Загрузка продуктов");
|
_logger.LogInformation("Загрузка продуктов");
|
||||||
}
|
}
|
||||||
|
@ -181,7 +181,8 @@ namespace DinerView
|
|||||||
private void ordersToolStripMenuItem_Click(object sender, EventArgs e)
|
private void ordersToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var service = Program.ServiceProvider?.GetService(typeof(FormReportOrders));
|
var service = Program.ServiceProvider?.GetService(typeof(FormReportOrders));
|
||||||
if (service is FormReportOrders form) {
|
if (service is FormReportOrders form)
|
||||||
|
{
|
||||||
form.ShowDialog();
|
form.ShowDialog();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -34,8 +34,8 @@ namespace DinerView
|
|||||||
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[] { elem.ProductName, "", "" });
|
||||||
foreach (var listElem in elem.Products)
|
foreach (var listElem in elem.Components)
|
||||||
{
|
{
|
||||||
dataGridView.Rows.Add(new object[] { " ", listElem.Item1, listElem.Item2 });
|
dataGridView.Rows.Add(new object[] { " ", listElem.Item1, listElem.Item2 });
|
||||||
}
|
}
|
||||||
|
@ -93,7 +93,7 @@ namespace DinerView
|
|||||||
if (form.ShowDialog() == DialogResult.OK)
|
if (form.ShowDialog() == DialogResult.OK)
|
||||||
{
|
{
|
||||||
if (form.foodModel == null) return;
|
if (form.foodModel == null) return;
|
||||||
_logger.LogInformation("Добавление нового снэка: {ComponentName} - {Count}", form.foodModel.ComponentName, form.Count);
|
_logger.LogInformation("Добавление нового снэка: {ProductName} - {Count}", form.foodModel.ComponentName, form.Count);
|
||||||
if (_productComponents.ContainsKey(form.ID))
|
if (_productComponents.ContainsKey(form.ID))
|
||||||
{
|
{
|
||||||
_productComponents[form.ID] = (form.foodModel, form.Count);
|
_productComponents[form.ID] = (form.foodModel, form.Count);
|
||||||
@ -120,7 +120,7 @@ namespace DinerView
|
|||||||
if (form.ShowDialog() == DialogResult.OK)
|
if (form.ShowDialog() == DialogResult.OK)
|
||||||
{
|
{
|
||||||
if (form.foodModel == null) return;
|
if (form.foodModel == null) return;
|
||||||
_logger.LogInformation("Изменение снэка: {ComponentName} - {Count}", form.foodModel.ComponentName, form.Count);
|
_logger.LogInformation("Изменение снэка: {ProductName} - {Count}", form.foodModel.ComponentName, form.Count);
|
||||||
_productComponents[form.ID] = (form.foodModel, form.Count);
|
_productComponents[form.ID] = (form.foodModel, form.Count);
|
||||||
LoadData();
|
LoadData();
|
||||||
}
|
}
|
||||||
@ -136,7 +136,7 @@ namespace DinerView
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
_logger.LogInformation("Удаление снэка: {ComponentName}", dataGridView.SelectedRows[0].Cells[1].Value);
|
_logger.LogInformation("Удаление снэка: {ProductName}", dataGridView.SelectedRows[0].Cells[1].Value);
|
||||||
_productComponents?.Remove(Convert.ToInt32(dataGridView.SelectedRows[0].Cells[0].Value));
|
_productComponents?.Remove(Convert.ToInt32(dataGridView.SelectedRows[0].Cells[0].Value));
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
@ -57,7 +57,7 @@ namespace DinerView
|
|||||||
_list = logic.ReadList(null);
|
_list = logic.ReadList(null);
|
||||||
if (_list != null)
|
if (_list != null)
|
||||||
{
|
{
|
||||||
comboBoxComponent.DisplayMember = "ComponentName";
|
comboBoxComponent.DisplayMember = "ProductName";
|
||||||
comboBoxComponent.ValueMember = "ID";
|
comboBoxComponent.ValueMember = "ID";
|
||||||
comboBoxComponent.DataSource = _list;
|
comboBoxComponent.DataSource = _list;
|
||||||
comboBoxComponent.SelectedItem = null;
|
comboBoxComponent.SelectedItem = null;
|
||||||
|
@ -17,8 +17,8 @@
|
|||||||
<CommandText>/* Local Query */</CommandText>
|
<CommandText>/* Local Query */</CommandText>
|
||||||
</Query>
|
</Query>
|
||||||
<Fields>
|
<Fields>
|
||||||
<Field Name="Id">
|
<Field Name="ID">
|
||||||
<DataField>Id</DataField>
|
<DataField>ID</DataField>
|
||||||
<rd:TypeName>System.Int32</rd:TypeName>
|
<rd:TypeName>System.Int32</rd:TypeName>
|
||||||
</Field>
|
</Field>
|
||||||
<Field Name="DateCreate">
|
<Field Name="DateCreate">
|
||||||
@ -33,6 +33,10 @@
|
|||||||
<DataField>Sum</DataField>
|
<DataField>Sum</DataField>
|
||||||
<rd:TypeName>System.Decimal</rd:TypeName>
|
<rd:TypeName>System.Decimal</rd:TypeName>
|
||||||
</Field>
|
</Field>
|
||||||
|
<Field Name="Status">
|
||||||
|
<DataField>OrderStatus</DataField>
|
||||||
|
<rd:TypeName>System.Decimal</rd:TypeName>
|
||||||
|
</Field>
|
||||||
</Fields>
|
</Fields>
|
||||||
<rd:DataSetInfo>
|
<rd:DataSetInfo>
|
||||||
<rd:DataSetName>DinerContracts.ViewModels</rd:DataSetName>
|
<rd:DataSetName>DinerContracts.ViewModels</rd:DataSetName>
|
||||||
@ -127,6 +131,9 @@
|
|||||||
<TablixColumn>
|
<TablixColumn>
|
||||||
<Width>2.5cm</Width>
|
<Width>2.5cm</Width>
|
||||||
</TablixColumn>
|
</TablixColumn>
|
||||||
|
<TablixColumn>
|
||||||
|
<Width>2.5cm</Width>
|
||||||
|
</TablixColumn>
|
||||||
</TablixColumns>
|
</TablixColumns>
|
||||||
<TablixRows>
|
<TablixRows>
|
||||||
<TablixRow>
|
<TablixRow>
|
||||||
@ -205,7 +212,7 @@
|
|||||||
<Paragraph>
|
<Paragraph>
|
||||||
<TextRuns>
|
<TextRuns>
|
||||||
<TextRun>
|
<TextRun>
|
||||||
<Value>Изделие</Value>
|
<Value>Снэк</Value>
|
||||||
<Style>
|
<Style>
|
||||||
<FontWeight>Bold</FontWeight>
|
<FontWeight>Bold</FontWeight>
|
||||||
</Style>
|
</Style>
|
||||||
@ -260,6 +267,38 @@
|
|||||||
</Textbox>
|
</Textbox>
|
||||||
</CellContents>
|
</CellContents>
|
||||||
</TablixCell>
|
</TablixCell>
|
||||||
|
<TablixCell>
|
||||||
|
<CellContents>
|
||||||
|
<Textbox Name="Textbox2">
|
||||||
|
<CanGrow>true</CanGrow>
|
||||||
|
<KeepTogether>true</KeepTogether>
|
||||||
|
<Paragraphs>
|
||||||
|
<Paragraph>
|
||||||
|
<TextRuns>
|
||||||
|
<TextRun>
|
||||||
|
<Value>Status</Value>
|
||||||
|
<Style>
|
||||||
|
<FontWeight>Bold</FontWeight>
|
||||||
|
</Style>
|
||||||
|
</TextRun>
|
||||||
|
</TextRuns>
|
||||||
|
<Style />
|
||||||
|
</Paragraph>
|
||||||
|
</Paragraphs>
|
||||||
|
<rd:DefaultName>Textbox2</rd:DefaultName>
|
||||||
|
<Style>
|
||||||
|
<Border>
|
||||||
|
<Color>LightGrey</Color>
|
||||||
|
<Style>Solid</Style>
|
||||||
|
</Border>
|
||||||
|
<PaddingLeft>2pt</PaddingLeft>
|
||||||
|
<PaddingRight>2pt</PaddingRight>
|
||||||
|
<PaddingTop>2pt</PaddingTop>
|
||||||
|
<PaddingBottom>2pt</PaddingBottom>
|
||||||
|
</Style>
|
||||||
|
</Textbox>
|
||||||
|
</CellContents>
|
||||||
|
</TablixCell>
|
||||||
</TablixCells>
|
</TablixCells>
|
||||||
</TablixRow>
|
</TablixRow>
|
||||||
<TablixRow>
|
<TablixRow>
|
||||||
@ -267,21 +306,21 @@
|
|||||||
<TablixCells>
|
<TablixCells>
|
||||||
<TablixCell>
|
<TablixCell>
|
||||||
<CellContents>
|
<CellContents>
|
||||||
<Textbox Name="Id">
|
<Textbox Name="ID">
|
||||||
<CanGrow>true</CanGrow>
|
<CanGrow>true</CanGrow>
|
||||||
<KeepTogether>true</KeepTogether>
|
<KeepTogether>true</KeepTogether>
|
||||||
<Paragraphs>
|
<Paragraphs>
|
||||||
<Paragraph>
|
<Paragraph>
|
||||||
<TextRuns>
|
<TextRuns>
|
||||||
<TextRun>
|
<TextRun>
|
||||||
<Value>=Fields!Id.Value</Value>
|
<Value>=Fields!ID.Value</Value>
|
||||||
<Style />
|
<Style />
|
||||||
</TextRun>
|
</TextRun>
|
||||||
</TextRuns>
|
</TextRuns>
|
||||||
<Style />
|
<Style />
|
||||||
</Paragraph>
|
</Paragraph>
|
||||||
</Paragraphs>
|
</Paragraphs>
|
||||||
<rd:DefaultName>Id</rd:DefaultName>
|
<rd:DefaultName>ID</rd:DefaultName>
|
||||||
<Style>
|
<Style>
|
||||||
<Border>
|
<Border>
|
||||||
<Color>LightGrey</Color>
|
<Color>LightGrey</Color>
|
||||||
@ -387,6 +426,36 @@
|
|||||||
</Textbox>
|
</Textbox>
|
||||||
</CellContents>
|
</CellContents>
|
||||||
</TablixCell>
|
</TablixCell>
|
||||||
|
<TablixCell>
|
||||||
|
<CellContents>
|
||||||
|
<Textbox Name="Status">
|
||||||
|
<CanGrow>true</CanGrow>
|
||||||
|
<KeepTogether>true</KeepTogether>
|
||||||
|
<Paragraphs>
|
||||||
|
<Paragraph>
|
||||||
|
<TextRuns>
|
||||||
|
<TextRun>
|
||||||
|
<Value>=Fields!Status.Value</Value>
|
||||||
|
<Style />
|
||||||
|
</TextRun>
|
||||||
|
</TextRuns>
|
||||||
|
<Style />
|
||||||
|
</Paragraph>
|
||||||
|
</Paragraphs>
|
||||||
|
<rd:DefaultName>Status</rd:DefaultName>
|
||||||
|
<Style>
|
||||||
|
<Border>
|
||||||
|
<Color>LightGrey</Color>
|
||||||
|
<Style>Solid</Style>
|
||||||
|
</Border>
|
||||||
|
<PaddingLeft>2pt</PaddingLeft>
|
||||||
|
<PaddingRight>2pt</PaddingRight>
|
||||||
|
<PaddingTop>2pt</PaddingTop>
|
||||||
|
<PaddingBottom>2pt</PaddingBottom>
|
||||||
|
</Style>
|
||||||
|
</Textbox>
|
||||||
|
</CellContents>
|
||||||
|
</TablixCell>
|
||||||
</TablixCells>
|
</TablixCells>
|
||||||
</TablixRow>
|
</TablixRow>
|
||||||
</TablixRows>
|
</TablixRows>
|
||||||
@ -397,6 +466,7 @@
|
|||||||
<TablixMember />
|
<TablixMember />
|
||||||
<TablixMember />
|
<TablixMember />
|
||||||
<TablixMember />
|
<TablixMember />
|
||||||
|
<TablixMember />
|
||||||
</TablixMembers>
|
</TablixMembers>
|
||||||
</TablixColumnHierarchy>
|
</TablixColumnHierarchy>
|
||||||
<TablixRowHierarchy>
|
<TablixRowHierarchy>
|
||||||
@ -413,7 +483,7 @@
|
|||||||
<Top>2.48391cm</Top>
|
<Top>2.48391cm</Top>
|
||||||
<Left>0.55245cm</Left>
|
<Left>0.55245cm</Left>
|
||||||
<Height>1.2cm</Height>
|
<Height>1.2cm</Height>
|
||||||
<Width>16.44755cm</Width>
|
<Width>18.94755cm</Width>
|
||||||
<ZIndex>2</ZIndex>
|
<ZIndex>2</ZIndex>
|
||||||
<Style>
|
<Style>
|
||||||
<Border>
|
<Border>
|
||||||
@ -491,7 +561,7 @@
|
|||||||
<Height>5.72875cm</Height>
|
<Height>5.72875cm</Height>
|
||||||
<Style />
|
<Style />
|
||||||
</Body>
|
</Body>
|
||||||
<Width>21cm</Width>
|
<Width>25.43558cm</Width>
|
||||||
<Page>
|
<Page>
|
||||||
<PageHeight>29.7cm</PageHeight>
|
<PageHeight>29.7cm</PageHeight>
|
||||||
<PageWidth>21cm</PageWidth>
|
<PageWidth>21cm</PageWidth>
|
||||||
|
@ -47,7 +47,7 @@ namespace DineryBusinessLogic.BusinessLogic
|
|||||||
public FoodViewModel? ReadElement(FoodSearchModel model)
|
public FoodViewModel? ReadElement(FoodSearchModel model)
|
||||||
{
|
{
|
||||||
if (model == null) throw new ArgumentNullException(nameof(model));
|
if (model == null) throw new ArgumentNullException(nameof(model));
|
||||||
_logger.LogInformation("ReadElement. ComponentName:{ComponentName}. ID:{ID}", model.ComponentName, model.ID);
|
_logger.LogInformation("ReadElement. ProductName:{ProductName}. ID:{ID}", model.ComponentName, model.ID);
|
||||||
var element = _componentStorage.GetElement(model);
|
var element = _componentStorage.GetElement(model);
|
||||||
if (element == null) {
|
if (element == null) {
|
||||||
_logger.LogWarning("ReadElement. element not found");
|
_logger.LogWarning("ReadElement. element not found");
|
||||||
@ -59,7 +59,7 @@ namespace DineryBusinessLogic.BusinessLogic
|
|||||||
|
|
||||||
public List<FoodViewModel>? ReadList(FoodSearchModel? model)
|
public List<FoodViewModel>? ReadList(FoodSearchModel? model)
|
||||||
{
|
{
|
||||||
_logger.LogInformation("ReadList. ComponentName:{ComponentName}. ID:{ID}", model?.ComponentName, model?.ID);
|
_logger.LogInformation("ReadList. ProductName:{ProductName}. ID:{ID}", model?.ComponentName, model?.ID);
|
||||||
var list = model == null ? _componentStorage.GetFullList() : _componentStorage.GetFilteredList(model);
|
var list = model == null ? _componentStorage.GetFullList() : _componentStorage.GetFilteredList(model);
|
||||||
if (list == null) {
|
if (list == null) {
|
||||||
_logger.LogWarning("ReadList return null list");
|
_logger.LogWarning("ReadList return null list");
|
||||||
@ -86,7 +86,7 @@ namespace DineryBusinessLogic.BusinessLogic
|
|||||||
throw new ArgumentNullException("Нет названия компонента", nameof(model.ComponentName));
|
throw new ArgumentNullException("Нет названия компонента", nameof(model.ComponentName));
|
||||||
if (model.Price <= 0)
|
if (model.Price <= 0)
|
||||||
throw new ArgumentNullException("Цена компонента должна быть больше 0", nameof(model.Price));
|
throw new ArgumentNullException("Цена компонента должна быть больше 0", nameof(model.Price));
|
||||||
_logger.LogInformation("Component. ComponentName:{ComponentName}. Price:{Price}. ID:{ID}",
|
_logger.LogInformation("Component. ProductName:{ProductName}. Price:{Price}. ID:{ID}",
|
||||||
model.ComponentName, model.Price, model.ID);
|
model.ComponentName, model.Price, model.ID);
|
||||||
var element = _componentStorage.GetElement(new FoodSearchModel { ComponentName = model.ComponentName });
|
var element = _componentStorage.GetElement(new FoodSearchModel { ComponentName = model.ComponentName });
|
||||||
if (element != null && element.ID != model.ID)
|
if (element != null && element.ID != model.ID)
|
||||||
|
@ -44,6 +44,7 @@ namespace DineryBusinessLogic.BusinessLogic
|
|||||||
DateCreate = x.DateCreate,
|
DateCreate = x.DateCreate,
|
||||||
ProductName = x.ProductName,
|
ProductName = x.ProductName,
|
||||||
Sum = x.Sum,
|
Sum = x.Sum,
|
||||||
|
OrderStatus = x.Status.ToString(),
|
||||||
})
|
})
|
||||||
.ToList();
|
.ToList();
|
||||||
}
|
}
|
||||||
@ -53,17 +54,17 @@ namespace DineryBusinessLogic.BusinessLogic
|
|||||||
var components = _componentStorage.GetFullList();
|
var components = _componentStorage.GetFullList();
|
||||||
|
|||||||
var products = _productStorage.GetFullList();
|
var products = _productStorage.GetFullList();
|
||||||
var list = new List<ReportSnackFoodsViewModel>();
|
var list = new List<ReportSnackFoodsViewModel>();
|
||||||
foreach (var component in components) {
|
foreach (var pr in products) {
|
||||||
var record = new ReportSnackFoodsViewModel
|
var record = new ReportSnackFoodsViewModel
|
||||||
{
|
{
|
||||||
ComponentName = component.ComponentName,
|
ProductName = pr.ProductName,
|
||||||
Products = new List<(string, int)>(),
|
Components = new(),
|
||||||
TotalCount = 0
|
TotalCount = 0
|
||||||
};
|
};
|
||||||
foreach (var product in products) {
|
foreach (var cp in components) {
|
||||||
if (product.ProductComponents.ContainsKey(component.ID)) {
|
if (pr.ProductComponents.ContainsKey(cp.ID)) {
|
||||||
record.Products.Add(new(product.ProductName, product.ProductComponents[component.ID].Item2));
|
record.Components.Add(new(cp.ComponentName, pr.ProductComponents[cp.ID].Item2));
|
||||||
record.TotalCount += product.ProductComponents[component.ID].Item2;
|
record.TotalCount += pr.ProductComponents[cp.ID].Item2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
list.Add(record);
|
list.Add(record);
|
||||||
@ -77,7 +78,7 @@ namespace DineryBusinessLogic.BusinessLogic
|
|||||||
{
|
{
|
||||||
FileName = model.FileName,
|
FileName = model.FileName,
|
||||||
Title = "Список еды",
|
Title = "Список еды",
|
||||||
Components = _componentStorage.GetFullList()
|
Products = _productStorage.GetFullList(),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,11 +32,11 @@ namespace DineryBusinessLogic.OfficePackage
|
|||||||
{
|
{
|
||||||
ColumnName = "A",
|
ColumnName = "A",
|
||||||
RowIndex = rowIndex,
|
RowIndex = rowIndex,
|
||||||
Text = pc.ComponentName,
|
Text = pc.ProductName,
|
||||||
StyleInfo = ExcelStyleInfoType.Title
|
StyleInfo = ExcelStyleInfoType.Title
|
||||||
});
|
});
|
||||||
rowIndex++;
|
rowIndex++;
|
||||||
foreach (var (Product, Count) in pc.Products) {
|
foreach (var (Product, Count) in pc.Components) {
|
||||||
InsertCellInWorksheet(new ExcelCellParameters
|
InsertCellInWorksheet(new ExcelCellParameters
|
||||||
{
|
{
|
||||||
ColumnName = "B",
|
ColumnName = "B",
|
||||||
|
@ -25,10 +25,10 @@ namespace DineryBusinessLogic.OfficePackage
|
|||||||
Style = "Normal",
|
Style = "Normal",
|
||||||
ParagraphAlignment = PdfParagraphAlignmentType.Right
|
ParagraphAlignment = PdfParagraphAlignmentType.Right
|
||||||
});
|
});
|
||||||
CreateTable(new List<string> { "2cm", "3cm", "6cm", "3cm" });
|
CreateTable(new List<string> { "2cm", "3cm", "6cm", "3cm", "3cm" });
|
||||||
CreateRow(new PdfRowParameters
|
CreateRow(new PdfRowParameters
|
||||||
{
|
{
|
||||||
Text = new List<string> { "Номер", "Дата заказа", "Изделие", "Сумма" },
|
Text = new List<string> { "Номер", "Дата заказа", "Изделие", "Сумма", "Статус" },
|
||||||
Style = "NormalTittle",
|
Style = "NormalTittle",
|
||||||
ParagraphAlignment = PdfParagraphAlignmentType.Center
|
ParagraphAlignment = PdfParagraphAlignmentType.Center
|
||||||
});
|
});
|
||||||
@ -37,7 +37,7 @@ namespace DineryBusinessLogic.OfficePackage
|
|||||||
CreateRow(new PdfRowParameters
|
CreateRow(new PdfRowParameters
|
||||||
{
|
{
|
||||||
Text = new List<string> { order.ID.ToString(), order.DateCreate.ToShortTimeString(),
|
Text = new List<string> { order.ID.ToString(), order.DateCreate.ToShortTimeString(),
|
||||||
order.ProductName, order.Sum.ToString() },
|
order.ProductName, order.Sum.ToString(), order.OrderStatus.ToString() },
|
||||||
Style = "Normal",
|
Style = "Normal",
|
||||||
ParagraphAlignment = PdfParagraphAlignmentType.Left
|
ParagraphAlignment = PdfParagraphAlignmentType.Left
|
||||||
});
|
});
|
||||||
|
@ -21,15 +21,15 @@ namespace DineryBusinessLogic.OfficePackage
|
|||||||
JustificationType = WordJustificationType.Center
|
JustificationType = WordJustificationType.Center
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
foreach (var component in info.Components) {
|
foreach (var pr in info.Products)
|
||||||
|
{
|
||||||
CreateParagraph(new WordParagraph
|
CreateParagraph(new WordParagraph
|
||||||
{
|
{
|
||||||
Texts = new List<(string, WordTextProperties)> { (component.ComponentName, new WordTextProperties { Size = "24", }) },
|
Texts = new List<(string, WordTextProperties)> {
|
||||||
TextProperties = new WordTextProperties
|
(pr.ProductName+' ', new WordTextProperties { Size = "24", Bold = true }),
|
||||||
{
|
(pr.Price.ToString(), new WordTextProperties { Size = "24" })
|
||||||
Size = "24",
|
},
|
||||||
JustificationType = WordJustificationType.both
|
TextProperties = new WordTextProperties { Size = "24", Bold = true}
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
SaveWord(info);
|
SaveWord(info);
|
||||||
|
@ -11,6 +11,6 @@ namespace DineryBusinessLogic.OfficePackage.HelperModels
|
|||||||
{
|
{
|
||||||
public string FileName { get; set; } = string.Empty;
|
public string FileName { get; set; } = string.Empty;
|
||||||
public string Title { get; set; } = string.Empty;
|
public string Title { get; set; } = string.Empty;
|
||||||
public List<FoodViewModel> Components { get; set; } = new();
|
public List<SnackViewModel> Products { get; set; } = new();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user
При получении изделий, у них уже есть список компонент, отдельно его получать не требуется
Так мы же в логике проходимся по всем созданным компонентам, смотрим есть ли такое в словаре компонет изделия, если есть, то уже в созданном объекте record дополняем список и добавляем 1 к totalcount. У нас же может быть создан компонент, который в изделиях не использован. Поэтому у нас будет recoed {ComponentName = "",Products = [], totalCount = 0};