PIbd-21_BatylkinaAO_MusoevD.../Canteen/CanteenBusinessLogic/OfficePackage/AbstractSaveToWord.cs

87 lines
3.2 KiB
C#
Raw Normal View History

2023-05-20 12:11:48 +04:00
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
{
2023-06-14 22:47:30 +04:00
public void CreateCooksDoc(WordInfo info)
2023-05-20 12:11:48 +04:00
{
CreateWord(info);
CreateParagraph(new WordParagraph
{
2023-06-14 22:47:30 +04:00
Texts = new List<(string, WordTextProperties)> { (info.Title, new WordTextProperties { Bold = true, Size = "24" }) },
2023-05-20 12:11:48 +04:00
TextProperties = new WordTextProperties
{
Size = "24",
JustificationType = WordJustificationType.Center
}
});
2023-06-14 22:47:30 +04:00
foreach (var reportCookView in info.Cooks)
2023-05-20 12:11:48 +04:00
{
CreateParagraph(new WordParagraph
{
2023-06-14 22:47:30 +04:00
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" })
},
2023-05-20 12:11:48 +04:00
TextProperties = new WordTextProperties
{
Size = "24",
JustificationType = WordJustificationType.Both
}
});
2023-06-14 22:47:30 +04:00
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
}
});
}
2023-05-20 12:11:48 +04:00
}
2023-06-14 22:47:30 +04:00
SaveWord(info);
2023-05-20 12:11:48 +04:00
}
2023-06-14 22:47:30 +04:00
2023-05-20 12:11:48 +04:00
protected abstract void CreateWord(WordInfo info);
protected abstract void CreateParagraph(WordParagraph paragraph);
protected abstract void SaveWord(WordInfo info);
2023-06-14 22:47:30 +04:00
internal void CreateOrdersDoc(WordInfo wordInfo)
{
throw new NotImplementedException();
}
2023-05-20 12:11:48 +04:00
}
}