71 lines
2.2 KiB
C#
71 lines
2.2 KiB
C#
using HotelBusinessLogic.OfficePackage.HelpersEnums;
|
|
using HotelBusinessLogic.OfficePackage.HelpersModels;
|
|
|
|
namespace HotelBusinessLogic.OfficePackage;
|
|
|
|
public abstract class AbstractSaveToExcel
|
|
{
|
|
public void CreateReport(ExcelInfo info)
|
|
{
|
|
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;
|
|
|
|
foreach (var mc in info.ListCleaningModels)
|
|
{
|
|
InsertCellInWorksheet(new ExcelCellParameters
|
|
{
|
|
ColumnName = "A",
|
|
RowIndex = rowIndex,
|
|
Text = mc.StartDate.ToString(),
|
|
StyleInfo = ExcelStyleInfoType.Text
|
|
});
|
|
|
|
InsertCellInWorksheet(new ExcelCellParameters
|
|
{
|
|
ColumnName = "B",
|
|
RowIndex = rowIndex,
|
|
Text = mc.RoomNumber.ToString(),
|
|
StyleInfo = ExcelStyleInfoType.TextWithBroder
|
|
});
|
|
|
|
rowIndex++;
|
|
|
|
foreach (var valuePair in mc.CleaningInstruments.Values)
|
|
{
|
|
InsertCellInWorksheet(new ExcelCellParameters
|
|
{
|
|
ColumnName = "C",
|
|
RowIndex = rowIndex,
|
|
Text = valuePair.Type,
|
|
StyleInfo = ExcelStyleInfoType.TextWithBroder
|
|
});
|
|
|
|
rowIndex++;
|
|
}
|
|
|
|
rowIndex++;
|
|
}
|
|
|
|
SaveExcel(info);
|
|
}
|
|
|
|
protected abstract void CreateExcel(ExcelInfo info);
|
|
protected abstract void InsertCellInWorksheet(ExcelCellParameters excelParams);
|
|
protected abstract void MergeCells(ExcelMergeParameters excelParams);
|
|
protected abstract void SaveExcel(ExcelInfo info);
|
|
} |