PIbd-21_BatylkinaAO_MusoevD.../Canteen/CanteenBusinessLogic/OfficePackage/AbstractSaveToWord.cs
2023-06-14 22:47:30 +04:00

87 lines
3.2 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using CanteenBusinessLogic.OfficePackage.HelperEnums;
using CanteenBusinessLogic.OfficePackage.HelperModels;
namespace CanteenBusinessLogic.OfficePackage
{
public abstract class AbstractSaveToWord
{
public void CreateCooksDoc(WordInfo 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 reportCookView in info.Cooks)
{
CreateParagraph(new WordParagraph
{
Texts = new List<(string, WordTextProperties)>
{
("Обед: ", new WordTextProperties { Bold = true, Size = "24" }),
(reportCookView.Lunch.LunchName, new WordTextProperties { Bold = false, Size = "24" }),
(" Дата создания: ", new WordTextProperties { Bold = true, Size = "24" }),
(reportCookView.Lunch.DateCreate.ToString(), new WordTextProperties { Bold = false, Size = "24" })
},
TextProperties = new WordTextProperties
{
Size = "24",
JustificationType = WordJustificationType.Both
}
});
CreateParagraph(new WordParagraph
{
Texts = new List<(string, WordTextProperties)>
{
("Повара: ", new WordTextProperties { Bold = true, Size = "24" })
},
TextProperties = new WordTextProperties
{
Size = "24",
JustificationType = WordJustificationType.Both
}
});
foreach (var cook in reportCookView.Cooks)
{
CreateParagraph(new WordParagraph
{
Texts = new List<(string, WordTextProperties)>
{
(cook.FIO, new WordTextProperties { Bold = false, Size = "24" })
},
TextProperties = new WordTextProperties
{
Size = "24",
JustificationType = WordJustificationType.Both
}
});
}
}
SaveWord(info);
}
protected abstract void CreateWord(WordInfo info);
protected abstract void CreateParagraph(WordParagraph paragraph);
protected abstract void SaveWord(WordInfo info);
internal void CreateOrdersDoc(WordInfo wordInfo)
{
throw new NotImplementedException();
}
}
}