66 lines
2.1 KiB
C#
66 lines
2.1 KiB
C#
using BankBusinessLogic.OfficePackage.HelperEnums;
|
||
using BankBusinessLogic.OfficePackage.HelperModels;
|
||
namespace BankBusinessLogic.OfficePackage
|
||
{
|
||
public abstract class AbstractSaveToPdf
|
||
{
|
||
public void CreateDoc(PdfInfo info)
|
||
{
|
||
CreatePdf(info);
|
||
CreateParagraph(new PdfParagraph
|
||
{
|
||
Text = info.Title,
|
||
Style = "NormalTitle",
|
||
ParagraphAlignment = PdfParagraphAlignmentType.Center
|
||
});
|
||
CreateParagraph(new PdfParagraph
|
||
{
|
||
Text = $"с {info.DateFrom.ToShortDateString()} по {info.DateTo.ToShortDateString()}",
|
||
Style = "Normal",
|
||
ParagraphAlignment = PdfParagraphAlignmentType.Center
|
||
});
|
||
CreateTable(new List<string> { "4cm", "4cm", "4cm", "4cm" });
|
||
CreateRow(new PdfRowParameters
|
||
{
|
||
Texts = new List<string> { "Дата", "Клиент", "Пополнения", "Валюты" },
|
||
Style = "NormalTitle",
|
||
ParagraphAlignment = PdfParagraphAlignmentType.Center
|
||
});
|
||
foreach (var client in info.Clients)
|
||
{
|
||
CreateRow(new PdfRowParameters
|
||
{
|
||
Texts = new List<string> { client.ClientSurname, client.ClientName, client.ClientPatronymic, "", "" },
|
||
Style = "NormalTitle",
|
||
ParagraphAlignment = PdfParagraphAlignmentType.Center
|
||
});
|
||
|
||
foreach (var refill in client.Refills)
|
||
{
|
||
CreateRow(new PdfRowParameters
|
||
{
|
||
Texts = new List<string> { refill.RefillDate.ToString(), "", refill.DepositId.ToString(), "" },
|
||
Style = "Normal",
|
||
ParagraphAlignment = PdfParagraphAlignmentType.Center
|
||
});
|
||
}
|
||
foreach (var currency in client.Currencies)
|
||
{
|
||
CreateRow(new PdfRowParameters
|
||
{
|
||
Texts = new List<string> { "", "", "", currency.CurrencyName },
|
||
Style = "Normal",
|
||
ParagraphAlignment = PdfParagraphAlignmentType.Center
|
||
});
|
||
}
|
||
}
|
||
SavePdf(info);
|
||
}
|
||
protected abstract void CreatePdf(PdfInfo info);
|
||
protected abstract void CreateParagraph(PdfParagraph paragraph);
|
||
protected abstract void CreateTable(List<string> columns);
|
||
protected abstract void CreateRow(PdfRowParameters rowParameters);
|
||
protected abstract void SavePdf(PdfInfo info);
|
||
}
|
||
}
|