2024-05-30 16:07:54 +04:00
|
|
|
|
using ElectronicsShopBusinessLogic.OfficePackage.HelperEnums;
|
|
|
|
|
using ElectronicsShopBusinessLogic.OfficePackage.HelperModels;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
namespace ElectronicsShopBusinessLogic.OfficePackage
|
|
|
|
|
{
|
2024-05-31 19:49:56 +04:00
|
|
|
|
public abstract class AbstractSaveToExcelEmployee
|
|
|
|
|
{
|
|
|
|
|
public void CreateReport(ExcelInfoEmployee info)
|
2024-05-30 16:07:54 +04:00
|
|
|
|
{
|
|
|
|
|
CreateExcel(info);
|
|
|
|
|
|
|
|
|
|
InsertCellInWorksheet(new ExcelCellParameters
|
|
|
|
|
{
|
|
|
|
|
ColumnName = "A",
|
|
|
|
|
RowIndex = 1,
|
|
|
|
|
Text = info.Title,
|
|
|
|
|
StyleInfo = ExcelStyleInfoType.Title
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
MergeCells(new ExcelMergeParameters
|
|
|
|
|
{
|
|
|
|
|
CellFromName = "A1",
|
|
|
|
|
CellToName = "C1"
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
uint rowIndex = 2;
|
2024-05-31 19:49:56 +04:00
|
|
|
|
foreach (var pc in info.Products)
|
2024-05-30 16:07:54 +04:00
|
|
|
|
{
|
|
|
|
|
InsertCellInWorksheet(new ExcelCellParameters
|
|
|
|
|
{
|
|
|
|
|
ColumnName = "A",
|
|
|
|
|
RowIndex = rowIndex,
|
2024-05-31 19:49:56 +04:00
|
|
|
|
Text = pc.ProductName.ToString(),
|
2024-05-30 16:07:54 +04:00
|
|
|
|
StyleInfo = ExcelStyleInfoType.Text
|
|
|
|
|
});
|
|
|
|
|
rowIndex++;
|
2024-06-01 00:38:15 +04:00
|
|
|
|
InsertCellInWorksheet(new ExcelCellParameters
|
2024-05-30 16:07:54 +04:00
|
|
|
|
{
|
2024-06-01 00:38:15 +04:00
|
|
|
|
ColumnName = "B",
|
|
|
|
|
RowIndex = rowIndex,
|
|
|
|
|
Text = pc.ProductName.ToString(),
|
|
|
|
|
StyleInfo = ExcelStyleInfoType.TextWithBroder
|
|
|
|
|
});
|
|
|
|
|
InsertCellInWorksheet(new ExcelCellParameters
|
|
|
|
|
{
|
|
|
|
|
ColumnName = "C",
|
|
|
|
|
RowIndex = rowIndex,
|
|
|
|
|
Text = pc.Price.ToString(),
|
|
|
|
|
StyleInfo = ExcelStyleInfoType.TextWithBroder
|
|
|
|
|
});
|
2024-05-30 16:07:54 +04:00
|
|
|
|
|
|
|
|
|
rowIndex++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
SaveExcel(info);
|
|
|
|
|
}
|
|
|
|
|
|
2024-05-31 19:49:56 +04:00
|
|
|
|
protected abstract void CreateExcel(ExcelInfoEmployee info);
|
2024-05-30 16:07:54 +04:00
|
|
|
|
|
|
|
|
|
protected abstract void InsertCellInWorksheet(ExcelCellParameters excelParams);
|
|
|
|
|
|
|
|
|
|
protected abstract void MergeCells(ExcelMergeParameters excelParams);
|
|
|
|
|
|
2024-05-31 19:49:56 +04:00
|
|
|
|
protected abstract void SaveExcel(ExcelInfoEmployee info);
|
2024-05-30 16:07:54 +04:00
|
|
|
|
}
|
|
|
|
|
}
|