PIbd-22_Filippov_D.S._Cours.../VeterinaryBusinessLogic/OfficePackage/AbstractSaveToWordOwner.cs

57 lines
1.5 KiB
C#
Raw Permalink Normal View History

2024-05-30 07:33:38 +04:00
using VeterinaryBusinessLogic.OfficePackage.HelperEnums;
using VeterinaryBusinessLogic.OfficePackage.HelperModels;
namespace VeterinaryBusinessLogic.OfficePackage
{
public abstract class AbstractSaveToWordOwner
{
public void CreateDoc(WordInfoOwner info)
{
CreateWord(info);
CreateParagraph(new WordParagraph
{
Texts = new List<(string, WordTextProperties)> { (info.Title, new WordTextProperties { Bold = true, Size = "24", }) },
TextProperties = new WordTextProperties
{
Size = "24",
JustificationType = WordJustificationType.Center
}
});
foreach (var rec in info.PetServices)
{
CreateParagraph(new WordParagraph
{
Texts = new List<(string, WordTextProperties)>
{ (rec.PetName, new WordTextProperties { Size = "24", Bold=true})},
TextProperties = new WordTextProperties
{
Size = "24",
JustificationType = WordJustificationType.Both
}
});
foreach (var animal in rec.Services)
{
CreateParagraph(new WordParagraph
{
Texts = new List<(string, WordTextProperties)>
{ (animal.ServiceName, new WordTextProperties { Size = "20", Bold=false})},
TextProperties = new WordTextProperties
{
Size = "24",
JustificationType = WordJustificationType.Both
}
});
}
}
SaveWord(info);
}
protected abstract void CreateWord(WordInfoOwner info);
protected abstract void CreateParagraph(WordParagraph paragraph);
protected abstract void SaveWord(WordInfoOwner info);
}
}