using LawFirmBusinessLogic.OfficePackages.HelperEnums;
using LawFirmBusinessLogic.OfficePackages.HelperModels;
namespace LawFirmBusinessLogic.OfficePackages
{
public abstract class AbstractSaveToExcelClientsConsultation
{
///
/// Создание отчета
///
///
public void CreateReport(ExcelClientsConsultationInfo 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 ch in info.ClientsConsultation)
{
InsertCellInWorksheet(new ExcelCellParameters
{
ColumnName = "A",
RowIndex = rowIndex,
Text = ch.ClientFIO,
StyleInfo = ExcelStyleInfoType.Text
});
rowIndex++;
foreach (var consultation in ch.Consultations)
{
InsertCellInWorksheet(new ExcelCellParameters
{
ColumnName = "B",
RowIndex = rowIndex,
Text = consultation.Cost,
StyleInfo =
ExcelStyleInfoType.TextWithBroder
});
InsertCellInWorksheet(new ExcelCellParameters
{
ColumnName = "C",
RowIndex = rowIndex,
Text = consultation.ConsultationDate.ToString(),
StyleInfo =
ExcelStyleInfoType.TextWithBroder
});
rowIndex++;
}
}
SaveExcel(info);
}
///
/// Создание excel-файла
///
///
protected abstract void CreateExcel(ExcelClientsConsultationInfo info);
///
/// Добавляем новую ячейку в лист
///
///
protected abstract void InsertCellInWorksheet(ExcelCellParameters
excelParams);
///
/// Объединение ячеек
///
///
protected abstract void MergeCells(ExcelMergeParameters excelParams);
///
/// Сохранение файла
///
///
protected abstract void SaveExcel(ExcelClientsConsultationInfo info);
}
}