using LawFirmBusinessLogic.OfficePackages.HelperEnums; using LawFirmBusinessLogic.OfficePackages.HelperModels; namespace LawFirmBusinessLogic.OfficePackages { public abstract class AbstractSaveToPdfClients { public void CreateDoc(PDFClientsInfo 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 { "2cm", "3cm", "6cm", "3cm" }); CreateRow(new PdfRowParameters { Texts = new List { "Номер", "Имя клиента", "Дело", "Дата визита" }, Style = "NormalTitle", ParagraphAlignment = PdfParagraphAlignmentType.Center }); foreach (var client in info.Clients) { CreateRow(new PdfRowParameters { Texts = new List { client.Id.ToString(), client.FIO, client.CaseName, client.VisitDate.ToString()}, Style = "Normal", ParagraphAlignment = PdfParagraphAlignmentType.Left }); } SavePdf(info); } /// /// Создание doc-файла /// /// protected abstract void CreatePdf(PDFClientsInfo info); /// /// Создание параграфа с текстом /// /// /// protected abstract void CreateParagraph(PdfParagraph paragraph); /// /// Создание таблицы /// /// /// protected abstract void CreateTable(List columns); /// /// Создание и заполнение строки /// /// protected abstract void CreateRow(PdfRowParameters rowParameters); /// /// Сохранение файла /// /// protected abstract void SavePdf(PDFClientsInfo info); } }