Реализован отчет изделий в формате таблицы

This commit is contained in:
Данияр Аглиуллов 2023-03-01 20:55:46 +04:00
parent f1359d2657
commit 68ce43d50a
17 changed files with 114 additions and 175 deletions

View File

@ -18,7 +18,7 @@ namespace ConfectioneryBusinessLogic.BusinessLogics
} }
public List<ComponentViewModel>? ReadList(ComponentSearchModel? model) public List<ComponentViewModel>? ReadList(ComponentSearchModel? model)
{ {
_logger.LogInformation("ReadList. ComponentName:{ComponentName}.Id:{ Id} ", _logger.LogInformation("ReadList. PastryName:{PastryName}.Id:{ Id} ",
model?.ComponentName, model?.Id); model?.ComponentName, model?.Id);
var list = (model == null) ? _componentStorage.GetFullList() : var list = (model == null) ? _componentStorage.GetFullList() :
_componentStorage.GetFilteredList(model); _componentStorage.GetFilteredList(model);
@ -36,7 +36,7 @@ namespace ConfectioneryBusinessLogic.BusinessLogics
{ {
throw new ArgumentNullException(nameof(model)); throw new ArgumentNullException(nameof(model));
} }
_logger.LogInformation("ReadElement. ComponentName:{ComponentName}.Id:{ Id}", _logger.LogInformation("ReadElement. PastryName:{PastryName}.Id:{ Id}",
model.ComponentName, model.Id); model.ComponentName, model.Id);
var element = _componentStorage.GetElement(model); var element = _componentStorage.GetElement(model);
if (element == null) if (element == null)
@ -98,7 +98,7 @@ namespace ConfectioneryBusinessLogic.BusinessLogics
{ {
throw new ArgumentNullException("Цена компонента должна быть больше 0", nameof(model.Cost)); throw new ArgumentNullException("Цена компонента должна быть больше 0", nameof(model.Cost));
} }
_logger.LogInformation("Component. ComponentName:{ComponentName}.Cost:{ Cost}. Id: { Id}", _logger.LogInformation("Components. PastryName:{PastryName}.Cost:{ Cost}. Id: { Id}",
model.ComponentName, model.Cost, model.Id); model.ComponentName, model.Cost, model.Id);
var element = _componentStorage.GetElement(new ComponentSearchModel var element = _componentStorage.GetElement(new ComponentSearchModel
{ {

View File

@ -39,12 +39,12 @@ namespace ConfectioneryBusinessLogic.OfficePackage
{ {
ColumnName = "A", ColumnName = "A",
RowIndex = rowIndex, RowIndex = rowIndex,
Text = pc.ComponentName, Text = pc.PastryName,
StyleInfo = ExcelStyleInfoType.Text StyleInfo = ExcelStyleInfoType.Text
}); });
rowIndex++; rowIndex++;
foreach (var (Pastry, Count) in pc.Pastries) foreach (var (Pastry, Count) in pc.Components)
{ {
InsertCellInWorksheet(new ExcelCellParameters InsertCellInWorksheet(new ExcelCellParameters
{ {

View File

@ -47,24 +47,24 @@ namespace ConfectioneryBusinessLogic
{ {
var components = _componentStorage.GetFullList(); var components = _componentStorage.GetFullList();
var Pastrys = _pastryStorage.GetFullList(); var pastries = _pastryStorage.GetFullList();
var list = new List<ReportPastryComponentViewModel>(); var list = new List<ReportPastryComponentViewModel>();
foreach (var component in components) foreach (var pastry in pastries)
{ {
var record = new ReportPastryComponentViewModel var record = new ReportPastryComponentViewModel
{ {
ComponentName = component.ComponentName, PastryName = pastry.PastryName,
Pastries = new List<Tuple<string, int>>(), Components = new List<Tuple<string, int>>(),
TotalCount = 0 TotalCount = 0
}; };
foreach (var Pastry in Pastrys) foreach (var component in components)
{ {
if (Pastry.PastryComponents.ContainsKey(component.Id)) if (pastry.PastryComponents.ContainsKey(component.Id))
{ {
record.Pastries.Add(new(Pastry.PastryName, Pastry.PastryComponents[component.Id].Item2)); record.Components.Add(new(component.ComponentName, pastry.PastryComponents[component.Id].Item2));
record.TotalCount += Pastry.PastryComponents[component.Id].Item2; record.TotalCount += pastry.PastryComponents[component.Id].Item2;
} }
} }
@ -93,7 +93,7 @@ namespace ConfectioneryBusinessLogic
} }
/// <summary> /// <summary>
/// Сохранение компонент в файл-Word /// Сохранение изделий в файл-Word
/// </summary> /// </summary>
/// <param name="model"></param> /// <param name="model"></param>
public void SavePastriesToWordFile(ReportBindingModel model) public void SavePastriesToWordFile(ReportBindingModel model)
@ -107,7 +107,7 @@ namespace ConfectioneryBusinessLogic
} }
/// <summary> /// <summary>
/// Сохранение компонент с указаеним продуктов в файл-Excel /// Сохранение изделий с указаеним продуктов в файл-Excel
/// </summary> /// </summary>
/// <param name="model"></param> /// <param name="model"></param>
public void SavePastryComponentToExcelFile(ReportBindingModel model) public void SavePastryComponentToExcelFile(ReportBindingModel model)
@ -115,7 +115,7 @@ namespace ConfectioneryBusinessLogic
_saveToExcel.CreateReport(new ExcelInfo _saveToExcel.CreateReport(new ExcelInfo
{ {
FileName = model.FileName, FileName = model.FileName,
Title = "Список компонент", Title = "Список изделий",
PastryComponents = GetPastryComponent() PastryComponents = GetPastryComponent()
}); });
} }

View File

@ -33,7 +33,7 @@ namespace ConfectioneryFileImplement.Models
return new Component() return new Component()
{ {
Id = Convert.ToInt32(element.Attribute("Id")!.Value), Id = Convert.ToInt32(element.Attribute("Id")!.Value),
ComponentName = element.Element("ComponentName")!.Value, ComponentName = element.Element("PastryName")!.Value,
Cost = Convert.ToDouble(element.Element("Cost")!.Value) Cost = Convert.ToDouble(element.Element("Cost")!.Value)
}; };
} }
@ -52,9 +52,9 @@ namespace ConfectioneryFileImplement.Models
ComponentName = ComponentName, ComponentName = ComponentName,
Cost = Cost Cost = Cost
}; };
public XElement GetXElement => new("Component", public XElement GetXElement => new("Components",
new XAttribute("Id", Id), new XAttribute("Id", Id),
new XElement("ComponentName", ComponentName), new XElement("PastryName", ComponentName),
new XElement("Cost", Cost.ToString())); new XElement("Cost", Cost.ToString()));
} }
} }

View File

@ -6,7 +6,7 @@ namespace ConfectioneryFileImplement
public class DataFileSingleton public class DataFileSingleton
{ {
private static DataFileSingleton? instance; private static DataFileSingleton? instance;
private readonly string ComponentFileName = "Component.xml"; private readonly string ComponentFileName = "Components.xml";
private readonly string OrderFileName = "Order.xml"; private readonly string OrderFileName = "Order.xml";
private readonly string PastryFileName = "Pastry.xml"; private readonly string PastryFileName = "Pastry.xml";
public List<Component> Components { get; private set; } public List<Component> Components { get; private set; }
@ -22,12 +22,12 @@ namespace ConfectioneryFileImplement
return instance; return instance;
} }
public void SaveComponents() => SaveData(Components, ComponentFileName, "Components", x => x.GetXElement); public void SaveComponents() => SaveData(Components, ComponentFileName, "Components", x => x.GetXElement);
public void SavePastries() => SaveData(Pastries, PastryFileName, "Pastries", x => x.GetXElement); public void SavePastries() => SaveData(Pastries, PastryFileName, "Components", x => x.GetXElement);
public void SaveOrders() => SaveData(Orders, OrderFileName, "Orders", x => x.GetXElement); public void SaveOrders() => SaveData(Orders, OrderFileName, "Orders", x => x.GetXElement);
private DataFileSingleton() private DataFileSingleton()
{ {
Components = LoadData(ComponentFileName, "Component", x => Component.Create(x)!)!; Components = LoadData(ComponentFileName, "Components", x => Component.Create(x)!)!;
Pastries = LoadData(PastryFileName, "Pastry", x => Pastry.Create(x)!)!; Pastries = LoadData(PastryFileName, "Pastry", x => Pastry.Create(x)!)!;
Orders = LoadData(OrderFileName, "Order", x => Order.Create(x)!)!; Orders = LoadData(OrderFileName, "Order", x => Order.Create(x)!)!;
} }

View File

@ -27,7 +27,7 @@ namespace ConfectioneryView
{ {
dataGridView.DataSource = list; dataGridView.DataSource = list;
dataGridView.Columns["Id"].Visible = false; dataGridView.Columns["Id"].Visible = false;
dataGridView.Columns["ComponentName"].AutoSizeMode = dataGridView.Columns["PastryName"].AutoSizeMode =
DataGridViewAutoSizeColumnMode.Fill; DataGridViewAutoSizeColumnMode.Fill;
} }
_logger.LogInformation("Загрузка компонентов"); _logger.LogInformation("Загрузка компонентов");

View File

@ -86,21 +86,21 @@
// pastriesToolStripMenuItem // pastriesToolStripMenuItem
// //
pastriesToolStripMenuItem.Name = "pastriesToolStripMenuItem"; pastriesToolStripMenuItem.Name = "pastriesToolStripMenuItem";
pastriesToolStripMenuItem.Size = new Size(218, 22); pastriesToolStripMenuItem.Size = new Size(215, 22);
pastriesToolStripMenuItem.Text = "Список изделий"; pastriesToolStripMenuItem.Text = "Список изделий";
pastriesToolStripMenuItem.Click += PastriesToolStripMenuItem_Click_1; pastriesToolStripMenuItem.Click += PastriesToolStripMenuItem_Click_1;
// //
// pastryComponentsToolStripMenuItem // pastryComponentsToolStripMenuItem
// //
pastryComponentsToolStripMenuItem.Name = "pastryComponentsToolStripMenuItem"; pastryComponentsToolStripMenuItem.Name = "pastryComponentsToolStripMenuItem";
pastryComponentsToolStripMenuItem.Size = new Size(218, 22); pastryComponentsToolStripMenuItem.Size = new Size(215, 22);
pastryComponentsToolStripMenuItem.Text = "Компоненты по изделиям"; pastryComponentsToolStripMenuItem.Text = "Изделия с компонентами";
pastryComponentsToolStripMenuItem.Click += PastryComponentsToolStripMenuItem_Click; pastryComponentsToolStripMenuItem.Click += PastryComponentsToolStripMenuItem_Click;
// //
// ordersToolStripMenuItem // ordersToolStripMenuItem
// //
ordersToolStripMenuItem.Name = "ordersToolStripMenuItem"; ordersToolStripMenuItem.Name = "ordersToolStripMenuItem";
ordersToolStripMenuItem.Size = new Size(218, 22); ordersToolStripMenuItem.Size = new Size(215, 22);
ordersToolStripMenuItem.Text = "Список заказов"; ordersToolStripMenuItem.Text = "Список заказов";
ordersToolStripMenuItem.Click += OrdersToolStripMenuItem_Click; ordersToolStripMenuItem.Click += OrdersToolStripMenuItem_Click;
// //

View File

@ -144,12 +144,12 @@
this.id.Name = "id"; this.id.Name = "id";
this.id.Visible = false; this.id.Visible = false;
// //
// Component // Components
// //
this.Component.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; this.Component.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
this.Component.FillWeight = 1000F; this.Component.FillWeight = 1000F;
this.Component.HeaderText = "Компонент"; this.Component.HeaderText = "Компонент";
this.Component.Name = "Component"; this.Component.Name = "Components";
// //
// Count // Count
// //

View File

@ -82,7 +82,7 @@ namespace ConfectioneryView
{ {
return; return;
} }
_logger.LogInformation("Добавление нового компонента: { ComponentName}- { Count}", _logger.LogInformation("Добавление нового компонента: { PastryName}- { Count}",
form.ComponentModel.ComponentName, form.Count); form.ComponentModel.ComponentName, form.Count);
if (_pastryComponents.ContainsKey(form.Id)) if (_pastryComponents.ContainsKey(form.Id))
{ {
@ -114,7 +114,7 @@ namespace ConfectioneryView
{ {
return; return;
} }
_logger.LogInformation("Изменение компонента: { ComponentName} - { Count} ", _logger.LogInformation("Изменение компонента: { PastryName} - { Count} ",
form.ComponentModel.ComponentName, form.Count); form.ComponentModel.ComponentName, form.Count);
_pastryComponents[id] = (form.ComponentModel, form.Count); _pastryComponents[id] = (form.ComponentModel, form.Count);
LoadData(); LoadData();
@ -131,7 +131,7 @@ namespace ConfectioneryView
{ {
try try
{ {
_logger.LogInformation("Удаление компонента: { ComponentName}- { Count}", _logger.LogInformation("Удаление компонента: { PastryName}- { Count}",
dataGridView.SelectedRows[0].Cells[1].Value); dataGridView.SelectedRows[0].Cells[1].Value);
_pastryComponents?.Remove(Convert.ToInt32(dataGridView.SelectedRows[0].Cells[0].Value)); _pastryComponents?.Remove(Convert.ToInt32(dataGridView.SelectedRows[0].Cells[0].Value));
} }

View File

@ -47,7 +47,7 @@ namespace ConfectioneryView
_list = logic.ReadList(null); _list = logic.ReadList(null);
if (_list != null) if (_list != null)
{ {
comboBoxComponent.DisplayMember = "ComponentName"; comboBoxComponent.DisplayMember = "PastryName";
comboBoxComponent.ValueMember = "Id"; comboBoxComponent.ValueMember = "Id";
comboBoxComponent.DataSource = _list; comboBoxComponent.DataSource = _list;
comboBoxComponent.SelectedItem = null; comboBoxComponent.SelectedItem = null;

View File

@ -28,87 +28,86 @@
/// </summary> /// </summary>
private void InitializeComponent() private void InitializeComponent()
{ {
this.dataGridView = new System.Windows.Forms.DataGridView(); dataGridView = new DataGridView();
this.buttonSaveToExcel = new System.Windows.Forms.Button(); buttonSaveToExcel = new Button();
this.ColumnComponent = new System.Windows.Forms.DataGridViewTextBoxColumn(); ColumnPastry = new DataGridViewTextBoxColumn();
this.ColumnPastry = new System.Windows.Forms.DataGridViewTextBoxColumn(); ColumnComponent = new DataGridViewTextBoxColumn();
this.ColumnCount = new System.Windows.Forms.DataGridViewTextBoxColumn(); ColumnCount = new DataGridViewTextBoxColumn();
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit(); ((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
this.SuspendLayout(); SuspendLayout();
// //
// dataGridView // dataGridView
// //
this.dataGridView.AllowUserToAddRows = false; dataGridView.AllowUserToAddRows = false;
this.dataGridView.AllowUserToDeleteRows = false; dataGridView.AllowUserToDeleteRows = false;
this.dataGridView.AllowUserToOrderColumns = true; dataGridView.AllowUserToOrderColumns = true;
this.dataGridView.AllowUserToResizeColumns = false; dataGridView.AllowUserToResizeColumns = false;
this.dataGridView.AllowUserToResizeRows = false; dataGridView.AllowUserToResizeRows = false;
this.dataGridView.BackgroundColor = System.Drawing.SystemColors.ControlLightLight; dataGridView.BackgroundColor = SystemColors.ControlLightLight;
this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dataGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { dataGridView.Columns.AddRange(new DataGridViewColumn[] { ColumnPastry, ColumnComponent, ColumnCount });
this.ColumnComponent, dataGridView.Dock = DockStyle.Bottom;
this.ColumnPastry, dataGridView.Location = new Point(0, 47);
this.ColumnCount}); dataGridView.Margin = new Padding(4, 3, 4, 3);
this.dataGridView.Dock = System.Windows.Forms.DockStyle.Bottom; dataGridView.MultiSelect = false;
this.dataGridView.Location = new System.Drawing.Point(0, 41); dataGridView.Name = "dataGridView";
this.dataGridView.MultiSelect = false; dataGridView.ReadOnly = true;
this.dataGridView.Name = "dataGridView"; dataGridView.RowHeadersVisible = false;
this.dataGridView.ReadOnly = true; dataGridView.Size = new Size(616, 510);
this.dataGridView.RowHeadersVisible = false; dataGridView.TabIndex = 0;
this.dataGridView.Size = new System.Drawing.Size(528, 442);
this.dataGridView.TabIndex = 0;
// //
// buttonSaveToExcel // buttonSaveToExcel
// //
this.buttonSaveToExcel.Location = new System.Drawing.Point(12, 12); buttonSaveToExcel.Location = new Point(14, 14);
this.buttonSaveToExcel.Name = "buttonSaveToExcel"; buttonSaveToExcel.Margin = new Padding(4, 3, 4, 3);
this.buttonSaveToExcel.Size = new System.Drawing.Size(159, 23); buttonSaveToExcel.Name = "buttonSaveToExcel";
this.buttonSaveToExcel.TabIndex = 1; buttonSaveToExcel.Size = new Size(186, 27);
this.buttonSaveToExcel.Text = "Сохранить в Excel"; buttonSaveToExcel.TabIndex = 1;
this.buttonSaveToExcel.UseVisualStyleBackColor = true; buttonSaveToExcel.Text = "Сохранить в Excel";
this.buttonSaveToExcel.Click += new System.EventHandler(this.ButtonSaveToExcel_Click); buttonSaveToExcel.UseVisualStyleBackColor = true;
// buttonSaveToExcel.Click += ButtonSaveToExcel_Click;
// ColumnComponent
//
this.ColumnComponent.HeaderText = "Компонент";
this.ColumnComponent.Name = "ColumnComponent";
this.ColumnComponent.ReadOnly = true;
this.ColumnComponent.Width = 200;
// //
// ColumnPastry // ColumnPastry
// //
this.ColumnPastry.HeaderText = "Изделие"; ColumnPastry.HeaderText = "Изделие";
this.ColumnPastry.Name = "ColumnPastry"; ColumnPastry.Name = "ColumnPastry";
this.ColumnPastry.ReadOnly = true; ColumnPastry.ReadOnly = true;
this.ColumnPastry.Width = 200; ColumnPastry.Width = 200;
//
// ColumnComponent
//
ColumnComponent.HeaderText = "Компонент";
ColumnComponent.Name = "ColumnComponent";
ColumnComponent.ReadOnly = true;
ColumnComponent.Width = 200;
// //
// ColumnCount // ColumnCount
// //
this.ColumnCount.HeaderText = "Количество"; ColumnCount.HeaderText = "Количество";
this.ColumnCount.Name = "ColumnCount"; ColumnCount.Name = "ColumnCount";
this.ColumnCount.ReadOnly = true; ColumnCount.ReadOnly = true;
// //
// FormReportPastryComponents // FormReportPastryComponents
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); AutoScaleDimensions = new SizeF(7F, 15F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; AutoScaleMode = AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(528, 483); ClientSize = new Size(616, 557);
this.Controls.Add(this.buttonSaveToExcel); Controls.Add(buttonSaveToExcel);
this.Controls.Add(this.dataGridView); Controls.Add(dataGridView);
this.Name = "FormReportPastryComponents"; Margin = new Padding(4, 3, 4, 3);
this.Text = "Компоненты по изделиям"; Name = "FormReportPastryComponents";
this.Load += new System.EventHandler(this.FormReportPastryComponents_Load); Text = "Изделия с компонентами";
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit(); Load += FormReportPastryComponents_Load;
this.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
ResumeLayout(false);
} }
#endregion #endregion
private System.Windows.Forms.DataGridView dataGridView; private System.Windows.Forms.DataGridView dataGridView;
private System.Windows.Forms.Button buttonSaveToExcel; private System.Windows.Forms.Button buttonSaveToExcel;
private System.Windows.Forms.DataGridViewTextBoxColumn ColumnComponent; private DataGridViewTextBoxColumn ColumnPastry;
private System.Windows.Forms.DataGridViewTextBoxColumn ColumnPastry; private DataGridViewTextBoxColumn ColumnComponent;
private System.Windows.Forms.DataGridViewTextBoxColumn ColumnCount; private DataGridViewTextBoxColumn ColumnCount;
} }
} }

View File

@ -36,8 +36,8 @@ namespace ConfectioneryView
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.PastryName, "", "" });
foreach (var listElem in elem.Pastries) foreach (var listElem in elem.Components)
{ {
dataGridView.Rows.Add(new object[] { "", listElem.Item1, listElem.Item2 }); dataGridView.Rows.Add(new object[] { "", listElem.Item1, listElem.Item2 });
} }

View File

@ -1,64 +1,4 @@
<?xml version="1.0" encoding="utf-8"?> <root>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" /> <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true"> <xsd:element name="root" msdata:IsDataSet="true">

View File

@ -8,8 +8,8 @@ namespace ConfectioneryContracts.ViewModels
{ {
public class ReportPastryComponentViewModel public class ReportPastryComponentViewModel
{ {
public string ComponentName { get; set; } = string.Empty; public string PastryName { get; set; } = string.Empty;
public int TotalCount { get; set; } public int TotalCount { get; set; }
public List<Tuple<string, int>> Pastries { get; set; } = new(); public List<Tuple<string, int>> Components { get; set; } = new();
} }
} }

View File

@ -25,7 +25,7 @@ namespace ConfectioneryDatabaseImplement.Migrations
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
modelBuilder.Entity("ConfectioneryDatabaseImplement.Models.Component", b => modelBuilder.Entity("ConfectioneryDatabaseImplement.Models.Components", b =>
{ {
b.Property<int>("Id") b.Property<int>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
@ -33,7 +33,7 @@ namespace ConfectioneryDatabaseImplement.Migrations
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id")); SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("ComponentName") b.Property<string>("PastryName")
.IsRequired() .IsRequired()
.HasColumnType("nvarchar(max)"); .HasColumnType("nvarchar(max)");
@ -95,7 +95,7 @@ namespace ConfectioneryDatabaseImplement.Migrations
b.HasKey("Id"); b.HasKey("Id");
b.ToTable("Pastries"); b.ToTable("Components");
}); });
modelBuilder.Entity("ConfectioneryDatabaseImplement.Models.PastryComponent", b => modelBuilder.Entity("ConfectioneryDatabaseImplement.Models.PastryComponent", b =>
@ -137,7 +137,7 @@ namespace ConfectioneryDatabaseImplement.Migrations
modelBuilder.Entity("ConfectioneryDatabaseImplement.Models.PastryComponent", b => modelBuilder.Entity("ConfectioneryDatabaseImplement.Models.PastryComponent", b =>
{ {
b.HasOne("ConfectioneryDatabaseImplement.Models.Component", "Component") b.HasOne("ConfectioneryDatabaseImplement.Models.Components", "Components")
.WithMany("PastryComponents") .WithMany("PastryComponents")
.HasForeignKey("ComponentId") .HasForeignKey("ComponentId")
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Cascade)
@ -149,12 +149,12 @@ namespace ConfectioneryDatabaseImplement.Migrations
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Cascade)
.IsRequired(); .IsRequired();
b.Navigation("Component"); b.Navigation("Components");
b.Navigation("Pastry"); b.Navigation("Pastry");
}); });
modelBuilder.Entity("ConfectioneryDatabaseImplement.Models.Component", b => modelBuilder.Entity("ConfectioneryDatabaseImplement.Models.Components", b =>
{ {
b.Navigation("PastryComponents"); b.Navigation("PastryComponents");
}); });

View File

@ -26,7 +26,7 @@ namespace ConfectioneryDatabaseImplement.Migrations
}); });
migrationBuilder.CreateTable( migrationBuilder.CreateTable(
name: "Pastries", name: "Components",
columns: table => new columns: table => new
{ {
Id = table.Column<int>(type: "int", nullable: false) Id = table.Column<int>(type: "int", nullable: false)
@ -58,7 +58,7 @@ namespace ConfectioneryDatabaseImplement.Migrations
table.ForeignKey( table.ForeignKey(
name: "FK_Orders_Pastries_PastryId", name: "FK_Orders_Pastries_PastryId",
column: x => x.PastryId, column: x => x.PastryId,
principalTable: "Pastries", principalTable: "Components",
principalColumn: "Id", principalColumn: "Id",
onDelete: ReferentialAction.Cascade); onDelete: ReferentialAction.Cascade);
}); });
@ -85,7 +85,7 @@ namespace ConfectioneryDatabaseImplement.Migrations
table.ForeignKey( table.ForeignKey(
name: "FK_PastryComponents_Pastries_PastryId", name: "FK_PastryComponents_Pastries_PastryId",
column: x => x.PastryId, column: x => x.PastryId,
principalTable: "Pastries", principalTable: "Components",
principalColumn: "Id", principalColumn: "Id",
onDelete: ReferentialAction.Cascade); onDelete: ReferentialAction.Cascade);
}); });
@ -119,7 +119,7 @@ namespace ConfectioneryDatabaseImplement.Migrations
name: "Components"); name: "Components");
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "Pastries"); name: "Components");
} }
} }
} }

View File

@ -22,7 +22,7 @@ namespace ConfectioneryDatabaseImplement.Migrations
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
modelBuilder.Entity("ConfectioneryDatabaseImplement.Models.Component", b => modelBuilder.Entity("ConfectioneryDatabaseImplement.Models.Components", b =>
{ {
b.Property<int>("Id") b.Property<int>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
@ -30,7 +30,7 @@ namespace ConfectioneryDatabaseImplement.Migrations
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id")); SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("ComponentName") b.Property<string>("PastryName")
.IsRequired() .IsRequired()
.HasColumnType("nvarchar(max)"); .HasColumnType("nvarchar(max)");
@ -92,7 +92,7 @@ namespace ConfectioneryDatabaseImplement.Migrations
b.HasKey("Id"); b.HasKey("Id");
b.ToTable("Pastries"); b.ToTable("Components");
}); });
modelBuilder.Entity("ConfectioneryDatabaseImplement.Models.PastryComponent", b => modelBuilder.Entity("ConfectioneryDatabaseImplement.Models.PastryComponent", b =>
@ -134,7 +134,7 @@ namespace ConfectioneryDatabaseImplement.Migrations
modelBuilder.Entity("ConfectioneryDatabaseImplement.Models.PastryComponent", b => modelBuilder.Entity("ConfectioneryDatabaseImplement.Models.PastryComponent", b =>
{ {
b.HasOne("ConfectioneryDatabaseImplement.Models.Component", "Component") b.HasOne("ConfectioneryDatabaseImplement.Models.Components", "Components")
.WithMany("PastryComponents") .WithMany("PastryComponents")
.HasForeignKey("ComponentId") .HasForeignKey("ComponentId")
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Cascade)
@ -146,12 +146,12 @@ namespace ConfectioneryDatabaseImplement.Migrations
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Cascade)
.IsRequired(); .IsRequired();
b.Navigation("Component"); b.Navigation("Components");
b.Navigation("Pastry"); b.Navigation("Pastry");
}); });
modelBuilder.Entity("ConfectioneryDatabaseImplement.Models.Component", b => modelBuilder.Entity("ConfectioneryDatabaseImplement.Models.Components", b =>
{ {
b.Navigation("PastryComponents"); b.Navigation("PastryComponents");
}); });