2023-10-09 19:17:33 +04:00
|
|
|
|
using DocumentFormat.OpenXml.Wordprocessing;
|
|
|
|
|
using System;
|
2023-10-09 18:14:48 +04:00
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using VisualComponentsLib.Components.SupportClasses.Enums;
|
|
|
|
|
|
|
|
|
|
namespace VisualComponentsLib.Components.SupportClasses
|
|
|
|
|
{
|
|
|
|
|
public class SetDataTable<T>
|
|
|
|
|
{
|
|
|
|
|
public string FilePath = string.Empty;
|
|
|
|
|
|
|
|
|
|
public string FileHeader = string.Empty;
|
|
|
|
|
|
|
|
|
|
//высота столбцов
|
2023-10-09 19:17:33 +04:00
|
|
|
|
public List<double> HeightRow = new();
|
2023-10-09 18:14:48 +04:00
|
|
|
|
|
|
|
|
|
//высота колонок
|
|
|
|
|
public List<double> WidthCol = new();
|
|
|
|
|
|
|
|
|
|
public List<T> DataList;
|
|
|
|
|
|
2023-10-09 19:17:33 +04:00
|
|
|
|
public SetDataTable(string filePath, string fileHeader, List<double> heightRow,
|
|
|
|
|
List<double> widthCol, List<T> dataList)
|
2023-10-09 18:14:48 +04:00
|
|
|
|
{
|
|
|
|
|
FilePath = filePath;
|
2023-10-10 00:38:20 +04:00
|
|
|
|
FileHeader = fileHeader;
|
2023-10-09 19:17:33 +04:00
|
|
|
|
HeightRow = heightRow;
|
2023-10-09 18:14:48 +04:00
|
|
|
|
WidthCol = widthCol;
|
|
|
|
|
DataList = dataList;
|
2023-10-09 19:17:33 +04:00
|
|
|
|
|
2023-10-10 00:38:20 +04:00
|
|
|
|
DataList.GroupBy(field => dataList[0].GetType().GetProperties().First()).Select(field => field.ToList());
|
2023-10-09 19:17:33 +04:00
|
|
|
|
}
|
|
|
|
|
|
2023-10-09 22:54:08 +04:00
|
|
|
|
////группировка элементов списка по первому полю
|
|
|
|
|
//private static List<T> GroupValue<T>(List<T> data)
|
|
|
|
|
//{
|
|
|
|
|
// var mainField = data[0].GetType().GetProperties().First().Name;
|
2023-10-09 19:17:33 +04:00
|
|
|
|
|
2023-10-09 22:54:08 +04:00
|
|
|
|
// return data.GroupBy(field => field.GetType().GetProperties().First().Name).Select(field => field.ToList());
|
|
|
|
|
//}
|
2023-10-09 18:14:48 +04:00
|
|
|
|
}
|
|
|
|
|
}
|