2023-05-18 22:18:40 +04:00
|
|
|
|
using ComputerShopBusinessLogic.OfficePackage.HelperEnums;
|
|
|
|
|
using ComputerShopBusinessLogic.OfficePackage.HelperModels;
|
|
|
|
|
using System;
|
2023-04-09 16:55:38 +04:00
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
namespace ComputerShopBusinessLogic.OfficePackage
|
|
|
|
|
{
|
2023-05-19 19:14:48 +04:00
|
|
|
|
public abstract class AbstractSaveToWord
|
2023-04-09 16:55:38 +04:00
|
|
|
|
{
|
2023-05-19 18:31:27 +04:00
|
|
|
|
|
2023-05-18 22:18:40 +04:00
|
|
|
|
public void CreateDoc(WordInfoProvider info)
|
|
|
|
|
{
|
2023-05-19 19:14:48 +04:00
|
|
|
|
|
|
|
|
|
|
2023-05-19 18:21:13 +04:00
|
|
|
|
CreateWord(info);
|
2023-05-18 22:18:40 +04:00
|
|
|
|
|
2023-05-19 18:21:13 +04:00
|
|
|
|
CreateParagraph(new WordParagraph
|
|
|
|
|
{
|
|
|
|
|
Texts = new List<(string, WordTextProperties)> { (info.Title, new WordTextProperties { Bold = true, Size = "24", }) },
|
|
|
|
|
TextProperties = new WordTextProperties
|
|
|
|
|
{
|
|
|
|
|
Size = "24",
|
|
|
|
|
JustificationType = WordJustificationType.Center
|
|
|
|
|
}
|
|
|
|
|
});
|
2023-05-18 22:18:40 +04:00
|
|
|
|
|
2023-05-19 19:14:48 +04:00
|
|
|
|
foreach (var cr in info.ComponentReceivings)
|
2023-05-19 18:21:13 +04:00
|
|
|
|
{
|
|
|
|
|
CreateParagraph(new WordParagraph
|
|
|
|
|
{
|
|
|
|
|
Texts = new List<(string, WordTextProperties)>
|
2023-05-19 19:14:48 +04:00
|
|
|
|
{ (cr.ComponentName, new WordTextProperties { Size = "20", Bold=true})},
|
2023-05-19 18:21:13 +04:00
|
|
|
|
TextProperties = new WordTextProperties
|
|
|
|
|
{
|
|
|
|
|
Size = "24",
|
|
|
|
|
JustificationType = WordJustificationType.Both
|
|
|
|
|
}
|
|
|
|
|
});
|
2023-05-18 22:18:40 +04:00
|
|
|
|
|
2023-05-19 19:14:48 +04:00
|
|
|
|
foreach (var receiving in cr.Receivings)
|
2023-05-19 18:21:13 +04:00
|
|
|
|
{
|
|
|
|
|
CreateParagraph(new WordParagraph
|
|
|
|
|
{
|
2023-05-19 19:14:48 +04:00
|
|
|
|
Texts = new List<(string, WordTextProperties)> { (receiving, new WordTextProperties { Size = "16", Bold = false }) },
|
2023-05-19 18:21:13 +04:00
|
|
|
|
TextProperties = new WordTextProperties
|
|
|
|
|
{
|
|
|
|
|
Size = "24",
|
|
|
|
|
JustificationType = WordJustificationType.Both
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
2023-05-19 19:14:48 +04:00
|
|
|
|
SaveWord(info);
|
2023-05-19 18:31:27 +04:00
|
|
|
|
|
2023-05-19 19:14:48 +04:00
|
|
|
|
|
2023-05-18 22:18:40 +04:00
|
|
|
|
}
|
|
|
|
|
|
2023-05-19 19:14:48 +04:00
|
|
|
|
protected abstract void CreateWord(WordInfoProvider info);
|
2023-05-19 18:21:13 +04:00
|
|
|
|
protected abstract void CreateParagraph(WordParagraph paragraph);
|
2023-05-19 19:14:48 +04:00
|
|
|
|
protected abstract void SaveWord(WordInfoProvider info);
|
2023-05-19 18:31:27 +04:00
|
|
|
|
}
|
2023-04-09 16:55:38 +04:00
|
|
|
|
}
|