2024-06-25 20:24:29 +04:00
|
|
|
|
using BusinessLogic.OfficePackage.HelperEnums;
|
|
|
|
|
using BusinessLogic.OfficePackage.HelperModels;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
namespace BusinessLogic.OfficePackage
|
|
|
|
|
{
|
|
|
|
|
public abstract class AbstractSaveToPdfCheque
|
|
|
|
|
{
|
|
|
|
|
public void CreateDoc(PdfInfo info)
|
|
|
|
|
{
|
|
|
|
|
CreatePdf(info);
|
|
|
|
|
CreateParagraph(new PdfParagraph
|
|
|
|
|
{
|
2024-06-25 20:29:36 +04:00
|
|
|
|
Text = $"{info.Title}\n{info.Product.Name}",
|
2024-06-25 20:24:29 +04:00
|
|
|
|
Style = "NormalTitle",
|
|
|
|
|
ParagraphAlignment = PdfParagraphAlignmentType.Center
|
|
|
|
|
});
|
|
|
|
|
CreateParagraph(new PdfParagraph
|
|
|
|
|
{
|
|
|
|
|
Text = $"Id: {info.Product.Id}",
|
|
|
|
|
Style = "NormalTitle",
|
|
|
|
|
ParagraphAlignment = PdfParagraphAlignmentType.Right
|
|
|
|
|
});
|
|
|
|
|
//CreateParagraph(new PdfParagraph
|
|
|
|
|
//{
|
|
|
|
|
// Text = "Список прилагаемых файлов",
|
|
|
|
|
// Style = "NormalTitle",
|
|
|
|
|
// ParagraphAlignment = PdfParagraphAlignmentType.Center
|
|
|
|
|
//});
|
|
|
|
|
//CreateTable(new List<string> { "10cm", "5cm" });
|
|
|
|
|
//CreateRow(new PdfRowParameters
|
|
|
|
|
//{
|
|
|
|
|
// Texts = new List<string> { "Название", "расширение" },
|
|
|
|
|
// Style = "NormalTitle",
|
|
|
|
|
// ParagraphAlignment = PdfParagraphAlignmentType.Center
|
|
|
|
|
//});
|
|
|
|
|
CreateImage($"product{info.Product.Id}.png");
|
|
|
|
|
CreateParagraph(new PdfParagraph
|
|
|
|
|
{
|
2024-06-25 20:40:10 +04:00
|
|
|
|
Text = $"Цена: {info.Product.Price.ToString("0.00")} руб.",
|
2024-06-25 20:24:29 +04:00
|
|
|
|
Style = "Normal",
|
|
|
|
|
ParagraphAlignment = PdfParagraphAlignmentType.Right
|
|
|
|
|
});
|
|
|
|
|
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 CreateImage(string path);
|
|
|
|
|
protected abstract void SavePdf(PdfInfo info);
|
|
|
|
|
}
|
|
|
|
|
}
|