73 lines
2.5 KiB
C#
73 lines
2.5 KiB
C#
using System;
|
||
using System.Collections.Generic;
|
||
using System.Linq;
|
||
using System.Text;
|
||
using System.Threading.Tasks;
|
||
using VeterinaryBusinessLogic.OfficePackage.HelperEnums;
|
||
using VeterinaryBusinessLogic.OfficePackage.HelperModels;
|
||
using VeterinaryDatabaseImplement.Implements;
|
||
|
||
namespace VeterinaryBusinessLogic.OfficePackage
|
||
{
|
||
public abstract class AbstractSaveToPdfDoctor
|
||
{
|
||
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 medication in info.ReportDrugsVisits)
|
||
{
|
||
CreateRow(new PdfRowParameters
|
||
{
|
||
Texts = new List<string> { "", medication.MedicationName, "", "" },
|
||
Style = "NormalTitle",
|
||
ParagraphAlignment = PdfParagraphAlignmentType.Center
|
||
});
|
||
foreach(var visit in medication.Drugs)
|
||
{
|
||
CreateRow(new PdfRowParameters
|
||
{
|
||
Texts = new List<string> { visit.DateCreate.ToString(), "", visit.DrugName, "" },
|
||
Style = "Normal",
|
||
ParagraphAlignment = PdfParagraphAlignmentType.Center
|
||
});
|
||
}
|
||
foreach (var guidance in medication.Visits)
|
||
{
|
||
CreateRow(new PdfRowParameters
|
||
{
|
||
Texts = new List<string> { guidance.DateVisit.ToString(), "", "", guidance.VisitName },
|
||
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);
|
||
}
|
||
}
|