Borschevskaya A.A. Lab work 4 #6
@ -29,8 +29,8 @@ namespace FurnitureAssembly
|
||||
dataGridView.Rows.Clear();
|
||||
foreach (var elem in dict)
|
||||
{
|
||||
dataGridView.Rows.Add(new object[] { elem.ComponentName, "", "" });
|
||||
foreach (var listElem in elem.Furnitures)
|
||||
dataGridView.Rows.Add(new object[] { elem.FurnitureName, "", "" });
|
||||
foreach (var listElem in elem.Components)
|
||||
{
|
||||
dataGridView.Rows.Add(new object[] { "", listElem.Item1, listElem.Item2 });
|
||||
}
|
||||
|
@ -36,11 +36,11 @@ namespace FurnitureAssemblyBusinessLogic.OfficePackage
|
||||
{
|
||||
ColumnName = "A",
|
||||
RowIndex = rowIndex,
|
||||
Text = pc.ComponentName,
|
||||
Text = pc.FurnitureName,
|
||||
StyleInfo = ExcelStyleInfoType.Text
|
||||
});
|
||||
rowIndex++;
|
||||
foreach (var product in pc.Furnitures)
|
||||
foreach (var product in pc.Components)
|
||||
{
|
||||
InsertCellInWorksheet(new ExcelCellParameters
|
||||
{
|
||||
|
@ -37,23 +37,23 @@ namespace FurnitureAssemblyBusinessLogic
|
||||
/// <returns></returns>
|
||||
public List<ReportFurnitureComponentViewModel> GetFurnitureComponent()
|
||||
{
|
||||
var furnitures = _furnitureStorage.GetFullList();
|
||||
var components = _componentStorage.GetFullList();
|
||||
var products = _furnitureStorage.GetFullList();
|
||||
var list = new List<ReportFurnitureComponentViewModel>();
|
||||
foreach (var component in components)
|
||||
foreach (var furniture in furnitures)
|
||||
{
|
||||
var record = new ReportFurnitureComponentViewModel
|
||||
{
|
||||
ComponentName = component.ComponentName,
|
||||
Furnitures = new List<Tuple<string, int>>(),
|
||||
FurnitureName = furniture.FurnitureName,
|
||||
Components = new List<Tuple<string, int>>(),
|
||||
TotalCount = 0
|
||||
};
|
||||
foreach (var product in products)
|
||||
foreach (var component in components)
|
||||
{
|
||||
if (product.FurnitureComponents.ContainsKey(component.Id))
|
||||
if (furniture.FurnitureComponents.ContainsKey(component.Id))
|
||||
{
|
||||
record.Furnitures.Add(new Tuple<string, int>(product.FurnitureName, product.FurnitureComponents[component.Id].Item2));
|
||||
record.TotalCount += product.FurnitureComponents[component.Id].Item2;
|
||||
record.Components.Add(new Tuple<string, int>(component.ComponentName, furniture.FurnitureComponents[component.Id].Item2));
|
||||
record.TotalCount += furniture.FurnitureComponents[component.Id].Item2;
|
||||
}
|
||||
}
|
||||
list.Add(record);
|
||||
@ -104,7 +104,7 @@ namespace FurnitureAssemblyBusinessLogic
|
||||
_saveToExcel.CreateReport(new ExcelInfo
|
||||
{
|
||||
FileName = model.FileName,
|
||||
Title = "Список компонент",
|
||||
Title = "Список изделий",
|
||||
FurnitureComponents = GetFurnitureComponent()
|
||||
});
|
||||
}
|
||||
|
@ -2,9 +2,9 @@
|
||||
{
|
||||
public class ReportFurnitureComponentViewModel
|
||||
{
|
||||
public string ComponentName { get; set; } = string.Empty;
|
||||
public string FurnitureName { get; set; } = string.Empty;
|
||||
public int TotalCount { get; set; }
|
||||
public List<Tuple<string, int>> Furnitures { get; set; } = new();
|
||||
public List<Tuple<string, int>> Components { get; set; } = new();
|
||||
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user