Вроде робит

This commit is contained in:
ElEgEv 2023-10-11 11:15:44 +04:00
parent 3666046345
commit 4b6d44e659

View File

@ -1,4 +1,5 @@
using System; using DocumentFormat.OpenXml.Spreadsheet;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using System.Data; using System.Data;
@ -40,7 +41,7 @@ namespace VisualComponentsForm
Car secondCar = new("Opel", "Astra", 1320000, 2017); Car secondCar = new("Opel", "Astra", 1320000, 2017);
Car thirdCar = new("Lada", "Granta", 430000, 2009); Car thirdCar = new("Lada", "Granta", 430000, 2009);
Car fourthCar = new("Lada", "Vesta", 1220000, 2022); Car fourthCar = new("Lada", "Vesta", 1220000, 2022);
Car fifthCar = new("Opel", "Astra", 2100000, 2018); Car fifthCar = new("Opel", "Vectra", 2100000, 2018);
Car sixthCar = new("Mercedes", "E-class", 3200500, 2019); Car sixthCar = new("Mercedes", "E-class", 3200500, 2019);
Dictionary<int, ColumnName> colData; Dictionary<int, ColumnName> colData;
@ -57,9 +58,9 @@ namespace VisualComponentsForm
colData = new Dictionary<int, ColumnName>() colData = new Dictionary<int, ColumnName>()
{ {
{ 0, new ColumnName("Марка автомобиля", "Brand") }, { 0, new ColumnName("Марка автомобиля", "Brand") },
{ 1, new ColumnName("Год выпуска", "YearProduction") }, { 1, new ColumnName("Модель", "Model") },
{ 2, new ColumnName("Цена", "Price") }, { 2, new ColumnName("Год выпуска", "YearProduction") },
{ 3, new ColumnName("Модель", "Model") }, { 3, new ColumnName("Цена", "Price") },
}; };
} }
@ -101,7 +102,7 @@ namespace VisualComponentsForm
try try
{ {
setDataTable = new(dialog.FileName, "Второе задание", new List<double> { 48, 24 }, setDataTable = new(dialog.FileName, "Второе задание", new List<double> { 48, 24 },
new List<double> { 2000, 2000, 1500, 1500 }, listCars, colData); new List<double> { 2000, 2000, 1500, 1500 }, listCars.GroupBy(x => x.Brand).SelectMany(r => r).ToList(), colData);
componentBigTable.CreateDoc(setDataTable); componentBigTable.CreateDoc(setDataTable);