using SchoolAgainStudyBusinessLogic.OfficePackage.HelperEnums; using SchoolAgainStudyBusinessLogic.OfficePackage.HelperModels; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace SchoolAgainStudyBusinessLogic.OfficePackage { public abstract class AbstractSaveToPdfTeacher { public void CreateDoc(PdfInfoTeacher 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", "4cm", "6cm", "4cm", "6cm" }); CreateRow(new PdfRowParameters { Texts = new List { "Номер","Занятие", "Дата занятия", "Задание", "Дата выдачи задания" }, Style = "NormalTitle", ParagraphAlignment = PdfParagraphAlignmentType.Center }); foreach (var taskLesson in info.LessonTasks) { CreateRow(new PdfRowParameters { Texts = new List { taskLesson.Id.ToString(), taskLesson.TitleLesson, taskLesson.DateEventLesson.ToShortDateString(), taskLesson.TitleTask, taskLesson.DateIssueTask.ToShortDateString()}, Style = "Normal", ParagraphAlignment = PdfParagraphAlignmentType.Left }); } SavePdf(info); } /// /// Создание doc-файла /// /// protected abstract void CreatePdf(PdfInfoTeacher info); /// /// Создание параграфа с текстом /// /// /// protected abstract void CreateParagraph(PdfParagraph paragraph); /// /// Создание таблицы /// /// /// protected abstract void CreateTable(List columns); /// /// Создание и заполнение строки /// /// protected abstract void CreateRow(PdfRowParameters rowParameters); /// /// Сохранение файла /// /// protected abstract void SavePdf(PdfInfoTeacher info); } }