Excel: список магазинов с изделиями
This commit is contained in:
parent
fe89fc9399
commit
3c02e6902a
@ -207,6 +207,7 @@
|
||||
this.ShopsFurnituresToolStripMenuItem.Name = "ShopsFurnituresToolStripMenuItem";
|
||||
this.ShopsFurnituresToolStripMenuItem.Size = new System.Drawing.Size(216, 22);
|
||||
this.ShopsFurnituresToolStripMenuItem.Text = "Изделия в магазинах";
|
||||
this.ShopsFurnituresToolStripMenuItem.Click += new System.EventHandler(this.ShopsFurnituresToolStripMenuItem_Click);
|
||||
//
|
||||
// OrderDateToolStripMenuItem
|
||||
//
|
||||
|
@ -234,5 +234,14 @@ namespace FurnitureAssembly
|
||||
MessageBoxIcon.Information);
|
||||
}
|
||||
}
|
||||
|
||||
private void ShopsFurnituresToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(FormReportShopFurnitures));
|
||||
if (service is FormReportShopFurnitures form)
|
||||
{
|
||||
form.ShowDialog();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
104
FurnitureAssembly/FurnitureAssembly/FormReportShopFurnitures.Designer.cs
generated
Normal file
104
FurnitureAssembly/FurnitureAssembly/FormReportShopFurnitures.Designer.cs
generated
Normal file
@ -0,0 +1,104 @@
|
||||
namespace FurnitureAssembly
|
||||
{
|
||||
partial class FormReportShopFurnitures
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.ButtonSaveToExcel = new System.Windows.Forms.Button();
|
||||
this.dataGridView = new System.Windows.Forms.DataGridView();
|
||||
this.Shop = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.Furniture = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.Count = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// ButtonSaveToExcel
|
||||
//
|
||||
this.ButtonSaveToExcel.Location = new System.Drawing.Point(12, 22);
|
||||
this.ButtonSaveToExcel.Name = "ButtonSaveToExcel";
|
||||
this.ButtonSaveToExcel.Size = new System.Drawing.Size(166, 27);
|
||||
this.ButtonSaveToExcel.TabIndex = 1;
|
||||
this.ButtonSaveToExcel.Text = "Сохранить в Excel";
|
||||
this.ButtonSaveToExcel.UseVisualStyleBackColor = true;
|
||||
this.ButtonSaveToExcel.Click += new System.EventHandler(this.ButtonSaveToExcel_Click);
|
||||
//
|
||||
// dataGridView
|
||||
//
|
||||
this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
this.dataGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
|
||||
this.Shop,
|
||||
this.Furniture,
|
||||
this.Count});
|
||||
this.dataGridView.Location = new System.Drawing.Point(12, 80);
|
||||
this.dataGridView.Name = "dataGridView";
|
||||
this.dataGridView.RowTemplate.Height = 25;
|
||||
this.dataGridView.Size = new System.Drawing.Size(600, 358);
|
||||
this.dataGridView.TabIndex = 2;
|
||||
//
|
||||
// Shop
|
||||
//
|
||||
this.Shop.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
|
||||
this.Shop.HeaderText = "Магазин";
|
||||
this.Shop.Name = "Shop";
|
||||
//
|
||||
// Furniture
|
||||
//
|
||||
this.Furniture.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
|
||||
this.Furniture.HeaderText = "Изделие";
|
||||
this.Furniture.Name = "Furniture";
|
||||
//
|
||||
// Count
|
||||
//
|
||||
this.Count.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.ColumnHeader;
|
||||
this.Count.HeaderText = "Количество";
|
||||
this.Count.Name = "Count";
|
||||
this.Count.Width = 97;
|
||||
//
|
||||
// FormReportShopFurnitures
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(627, 450);
|
||||
this.Controls.Add(this.dataGridView);
|
||||
this.Controls.Add(this.ButtonSaveToExcel);
|
||||
this.Name = "FormReportShopFurnitures";
|
||||
this.Text = "Магазины с изделиями";
|
||||
this.Load += new System.EventHandler(this.FormReportShopFurnitures_Load);
|
||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Button ButtonSaveToExcel;
|
||||
private DataGridView dataGridView;
|
||||
private DataGridViewTextBoxColumn Shop;
|
||||
private DataGridViewTextBoxColumn Furniture;
|
||||
private DataGridViewTextBoxColumn Count;
|
||||
}
|
||||
}
|
@ -0,0 +1,87 @@
|
||||
using FurnitureAssemblyContracts.BindingModels;
|
||||
using FurnitureAssemblyContracts.BusinessLogicsContarcts;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace FurnitureAssembly
|
||||
{
|
||||
public partial class FormReportShopFurnitures : Form
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
private readonly IReportLogic _logic;
|
||||
public FormReportShopFurnitures(ILogger<FormReportShopFurnitures> logger, IReportLogic reportLogic)
|
||||
{
|
||||
InitializeComponent();
|
||||
_logger = logger;
|
||||
_logic = reportLogic;
|
||||
}
|
||||
|
||||
private void ButtonSaveToExcel_Click(object sender, EventArgs e)
|
||||
{
|
||||
using var dialog = new SaveFileDialog
|
||||
{
|
||||
Filter = "xlsx|*.xlsx"
|
||||
};
|
||||
if (dialog.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
try
|
||||
{
|
||||
_logic.SaveShopFurnituresToExcelFile(new
|
||||
ReportBindingModel
|
||||
{
|
||||
FileName = dialog.FileName
|
||||
});
|
||||
_logger.LogInformation("Сохранение списка магазинов с изделиями в них");
|
||||
|
||||
MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK,
|
||||
MessageBoxIcon.Information);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка сохранения списка магазинов с изделиями в них");
|
||||
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
|
||||
MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void FormReportShopFurnitures_Load(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
var dict = _logic.GetShopFurnitures();
|
||||
if (dict != null)
|
||||
{
|
||||
dataGridView.Rows.Clear();
|
||||
foreach (var elem in dict)
|
||||
{
|
||||
dataGridView.Rows.Add(new object[] { elem.ShopName, "", "" });
|
||||
foreach (var listElem in elem.Furnitures)
|
||||
{
|
||||
dataGridView.Rows.Add(new object[] { "", listElem.Item1, listElem.Item2 });
|
||||
}
|
||||
dataGridView.Rows.Add(new object[] { "Итого", "", elem.TotalCount });
|
||||
dataGridView.Rows.Add(Array.Empty<object>());
|
||||
}
|
||||
}
|
||||
_logger.LogInformation("Загрузка списка магазинов с изделиями в них");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка загрузки списка магазинов с изделиями в них");
|
||||
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
|
||||
MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,78 @@
|
||||
<root>
|
||||
<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:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="Shop.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="Furniture.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="Count.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="Shop.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="Furniture.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="Count.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
</root>
|
@ -64,6 +64,7 @@ namespace FurnitureAssembly
|
||||
services.AddTransient<FormShops>();
|
||||
services.AddTransient<FormReplenishmentShop>();
|
||||
services.AddTransient<FormSell>();
|
||||
services.AddTransient<FormReportShopFurnitures>();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,4 +1,5 @@
|
||||
using FurnitureAssemblyBusinessLogic.OfficePackage.HelperEnums;
|
||||
using DocumentFormat.OpenXml.EMMA;
|
||||
using FurnitureAssemblyBusinessLogic.OfficePackage.HelperEnums;
|
||||
using FurnitureAssemblyBusinessLogic.OfficePackage.HelperModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@ -30,6 +31,64 @@ namespace FurnitureAssemblyBusinessLogic.OfficePackage
|
||||
CellToName = "C1"
|
||||
});
|
||||
uint rowIndex = 2;
|
||||
if (info is ExcelInfoFurnitures infoFurnitures)
|
||||
{
|
||||
CreateExcelCellsFurnitures(infoFurnitures, rowIndex);
|
||||
}
|
||||
else if (info is ExcelInfoShops infoShops)
|
||||
{
|
||||
CreateExcelCellsShops(infoShops, rowIndex);
|
||||
}
|
||||
/* foreach (var pc in info.FurnitureComponents)
|
||||
{
|
||||
InsertCellInWorksheet(new ExcelCellParameters
|
||||
{
|
||||
ColumnName = "A",
|
||||
RowIndex = rowIndex,
|
||||
Text = pc.FurnitureName,
|
||||
StyleInfo = ExcelStyleInfoType.Text
|
||||
});
|
||||
rowIndex++;
|
||||
foreach (var product in pc.Components)
|
||||
{
|
||||
InsertCellInWorksheet(new ExcelCellParameters
|
||||
{
|
||||
ColumnName = "B",
|
||||
RowIndex = rowIndex,
|
||||
Text = product.Item1,
|
||||
StyleInfo =
|
||||
ExcelStyleInfoType.TextWithBroder
|
||||
});
|
||||
InsertCellInWorksheet(new ExcelCellParameters
|
||||
{
|
||||
ColumnName = "C",
|
||||
RowIndex = rowIndex,
|
||||
Text = product.Item2.ToString(),
|
||||
StyleInfo =
|
||||
ExcelStyleInfoType.TextWithBroder
|
||||
});
|
||||
rowIndex++;
|
||||
}
|
||||
InsertCellInWorksheet(new ExcelCellParameters
|
||||
{
|
||||
ColumnName = "A",
|
||||
RowIndex = rowIndex,
|
||||
Text = "Итого",
|
||||
StyleInfo = ExcelStyleInfoType.Text
|
||||
});
|
||||
InsertCellInWorksheet(new ExcelCellParameters
|
||||
{
|
||||
ColumnName = "C",
|
||||
RowIndex = rowIndex,
|
||||
Text = pc.TotalCount.ToString(),
|
||||
StyleInfo = ExcelStyleInfoType.Text
|
||||
});
|
||||
rowIndex++;
|
||||
}*/
|
||||
SaveExcel(info);
|
||||
}
|
||||
private void CreateExcelCellsFurnitures(ExcelInfoFurnitures info, uint rowIndex)
|
||||
{
|
||||
foreach (var pc in info.FurnitureComponents)
|
||||
{
|
||||
InsertCellInWorksheet(new ExcelCellParameters
|
||||
@ -76,8 +135,58 @@ namespace FurnitureAssemblyBusinessLogic.OfficePackage
|
||||
});
|
||||
rowIndex++;
|
||||
}
|
||||
SaveExcel(info);
|
||||
}
|
||||
|
||||
private void CreateExcelCellsShops(ExcelInfoShops info, uint rowIndex)
|
||||
{
|
||||
foreach (var sF in info.ShopFurnitures)
|
||||
{
|
||||
InsertCellInWorksheet(new ExcelCellParameters
|
||||
{
|
||||
ColumnName = "A",
|
||||
RowIndex = rowIndex,
|
||||
Text = sF.ShopName,
|
||||
StyleInfo = ExcelStyleInfoType.Text
|
||||
});
|
||||
rowIndex++;
|
||||
foreach (var furniture in sF.Furnitures)
|
||||
{
|
||||
InsertCellInWorksheet(new ExcelCellParameters
|
||||
{
|
||||
ColumnName = "B",
|
||||
RowIndex = rowIndex,
|
||||
Text = furniture.Item1,
|
||||
StyleInfo =
|
||||
ExcelStyleInfoType.TextWithBroder
|
||||
});
|
||||
InsertCellInWorksheet(new ExcelCellParameters
|
||||
{
|
||||
ColumnName = "C",
|
||||
RowIndex = rowIndex,
|
||||
Text = furniture.Item2.ToString(),
|
||||
StyleInfo =
|
||||
ExcelStyleInfoType.TextWithBroder
|
||||
});
|
||||
rowIndex++;
|
||||
}
|
||||
InsertCellInWorksheet(new ExcelCellParameters
|
||||
{
|
||||
ColumnName = "A",
|
||||
RowIndex = rowIndex,
|
||||
Text = "Итого",
|
||||
StyleInfo = ExcelStyleInfoType.Text
|
||||
});
|
||||
InsertCellInWorksheet(new ExcelCellParameters
|
||||
{
|
||||
ColumnName = "C",
|
||||
RowIndex = rowIndex,
|
||||
Text = sF.TotalCount.ToString(),
|
||||
StyleInfo = ExcelStyleInfoType.Text
|
||||
});
|
||||
rowIndex++;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Создание excel-файла
|
||||
/// </summary>
|
||||
|
@ -5,11 +5,6 @@ namespace FurnitureAssemblyBusinessLogic.OfficePackage.HelperModels
|
||||
public class ExcelInfo
|
||||
{
|
||||
public string FileName { get; set; } = string.Empty;
|
||||
public string Title { get; set; } = string.Empty;
|
||||
public List<ReportFurnitureComponentViewModel> FurnitureComponents
|
||||
{
|
||||
get;
|
||||
set;
|
||||
} = new();
|
||||
public string Title { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,18 @@
|
||||
using FurnitureAssemblyContracts.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace FurnitureAssemblyBusinessLogic.OfficePackage.HelperModels
|
||||
{
|
||||
public class ExcelInfoFurnitures : ExcelInfo
|
||||
{
|
||||
public List<ReportFurnitureComponentViewModel> FurnitureComponents
|
||||
{
|
||||
get;
|
||||
set;
|
||||
} = new();
|
||||
}
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
using FurnitureAssemblyContracts.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace FurnitureAssemblyBusinessLogic.OfficePackage.HelperModels
|
||||
{
|
||||
public class ExcelInfoShops : ExcelInfo
|
||||
{
|
||||
public List<ReportShopFurnituresViewModel> ShopFurnitures
|
||||
{
|
||||
get;
|
||||
set;
|
||||
} = new();
|
||||
}
|
||||
}
|
@ -84,7 +84,7 @@ namespace FurnitureAssemblyBusinessLogic
|
||||
/// <param name="model"></param>
|
||||
public void SaveFurnituresToWordFile(ReportBindingModel model)
|
||||
{
|
||||
_saveToWord.CreateDoc(new WordInfo
|
||||
_saveToWord.CreateDoc(new WordInfoFurnitures
|
||||
{
|
||||
FileName = model.FileName,
|
||||
Title = "Список изделий",
|
||||
@ -97,7 +97,7 @@ namespace FurnitureAssemblyBusinessLogic
|
||||
/// <param name="model"></param>
|
||||
public void SaveFurnitureComponentToExcelFile(ReportBindingModel model)
|
||||
{
|
||||
_saveToExcel.CreateReport(new ExcelInfo
|
||||
_saveToExcel.CreateReport(new ExcelInfoFurnitures
|
||||
{
|
||||
FileName = model.FileName,
|
||||
Title = "Список изделий",
|
||||
@ -125,12 +125,44 @@ namespace FurnitureAssemblyBusinessLogic
|
||||
/// <param name="model"></param>
|
||||
public void SaveShopsToWordFile(ReportBindingModel model)
|
||||
{
|
||||
_saveToWord.CreateTableDoc(new WordInfo
|
||||
_saveToWord.CreateTableDoc(new WordInfoShops
|
||||
{
|
||||
FileName = model.FileName,
|
||||
Title = "Список магазинов",
|
||||
Shops = _shopStorage.GetFullList()
|
||||
});
|
||||
}
|
||||
|
||||
public void SaveShopFurnituresToExcelFile(ReportBindingModel model)
|
||||
{
|
||||
_saveToExcel.CreateReport(new ExcelInfoShops
|
||||
{
|
||||
FileName = model.FileName,
|
||||
Title = "Список магазинов с изделиями",
|
||||
ShopFurnitures = GetShopFurnitures()
|
||||
});
|
||||
}
|
||||
|
||||
public List<ReportShopFurnituresViewModel> GetShopFurnitures()
|
||||
{
|
||||
var shops = _shopStorage.GetFullList();
|
||||
var list = new List<ReportShopFurnituresViewModel>();
|
||||
foreach (var shop in shops)
|
||||
{
|
||||
var record = new ReportShopFurnituresViewModel
|
||||
{
|
||||
ShopName = shop.ShopName,
|
||||
Furnitures = new List<Tuple<string, int>>(),
|
||||
TotalCount = 0
|
||||
};
|
||||
foreach (var furnitureCount in shop.Furnitures.Values)
|
||||
{
|
||||
record.Furnitures.Add(new Tuple<string, int>(furnitureCount.Item1.FurnitureName, furnitureCount.Item2));
|
||||
record.TotalCount += furnitureCount.Item2;
|
||||
}
|
||||
list.Add(record);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -32,5 +32,8 @@ namespace FurnitureAssemblyContracts.BusinessLogicsContarcts
|
||||
/// <param name="model"></param>
|
||||
void SaveOrdersToPdfFile(ReportBindingModel model);
|
||||
void SaveShopsToWordFile(ReportBindingModel model);
|
||||
void SaveShopFurnituresToExcelFile(ReportBindingModel model);
|
||||
|
||||
List<ReportShopFurnituresViewModel> GetShopFurnitures();
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace FurnitureAssemblyContracts.ViewModels
|
||||
{
|
||||
public class ReportShopFurnituresViewModel
|
||||
{
|
||||
public string ShopName { get; set; } = string.Empty;
|
||||
public int TotalCount { get; set; }
|
||||
public List<Tuple<string, int>> Furnitures { get; set; } = new();
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user