2023-04-07 01:24:54 +04:00
|
|
|
|
using HotelBusinessLogic.OfficePackage.HelperEnums;
|
|
|
|
|
using HotelBusinessLogic.OfficePackage.HelperModels;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
namespace HotelBusinessLogic.OfficePackage
|
|
|
|
|
{
|
2023-04-07 01:31:18 +04:00
|
|
|
|
public abstract class AbstractSaveToPdfHeadwaiter
|
2023-04-07 01:24:54 +04:00
|
|
|
|
{
|
|
|
|
|
public void CreateDoc(PdfInfoHeadwaiter info)
|
|
|
|
|
{
|
|
|
|
|
CreatePdf(info);
|
|
|
|
|
CreateParagraph(new PdfParagraph
|
|
|
|
|
{
|
|
|
|
|
Text = info.Title,
|
|
|
|
|
Style = "NormalTitle",
|
|
|
|
|
ParagraphAlignment = PdfParagraphAlignmentType.Center
|
|
|
|
|
});
|
|
|
|
|
CreateParagraph(new PdfParagraph
|
|
|
|
|
{
|
|
|
|
|
Text = $"с {info.DateFrom.ToShortDateString()} по {info.DateTo.ToShortDateString()}",
|
|
|
|
|
Style = "Normal",
|
|
|
|
|
ParagraphAlignment = PdfParagraphAlignmentType.Center
|
|
|
|
|
});
|
2023-05-18 23:20:02 +04:00
|
|
|
|
CreateTable(new List<string> { "3cm", "3cm", "3cm", "4cm", "4cm" });
|
2023-04-07 01:24:54 +04:00
|
|
|
|
CreateRow(new PdfRowParameters
|
|
|
|
|
{
|
2023-05-19 01:52:16 +04:00
|
|
|
|
Texts = new List<string> { "Обед", "Комната", "Цена комнаты", "Бронирование", "Дата брони" },
|
2023-04-07 01:24:54 +04:00
|
|
|
|
Style = "NormalTitle",
|
|
|
|
|
ParagraphAlignment = PdfParagraphAlignmentType.Center
|
|
|
|
|
});
|
2023-05-18 23:20:02 +04:00
|
|
|
|
foreach (var dinner in info.Dinners)
|
2023-04-07 01:24:54 +04:00
|
|
|
|
{
|
|
|
|
|
CreateRow(new PdfRowParameters
|
|
|
|
|
{
|
2023-05-19 01:52:16 +04:00
|
|
|
|
Texts = new List<string> { dinner.DinnerName.ToString(), dinner.RoomName, dinner.RoomPrice.ToString(), dinner.NameHall, dinner.StartDate?.ToShortDateString() },
|
2023-04-07 01:24:54 +04:00
|
|
|
|
Style = "Normal",
|
|
|
|
|
ParagraphAlignment = PdfParagraphAlignmentType.Left
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
CreateParagraph(new PdfParagraph
|
|
|
|
|
{
|
2023-05-18 18:09:59 +04:00
|
|
|
|
Text = $"Итого: {info.Dinners.Sum(x => x.RoomPrice)}\t",
|
2023-04-07 01:24:54 +04:00
|
|
|
|
Style = "Normal",
|
|
|
|
|
ParagraphAlignment = PdfParagraphAlignmentType.Rigth
|
|
|
|
|
});
|
|
|
|
|
SavePdf(info);
|
|
|
|
|
}
|
|
|
|
|
protected abstract void CreatePdf(PdfInfoHeadwaiter info);
|
|
|
|
|
protected abstract void CreateParagraph(PdfParagraph paragraph);
|
|
|
|
|
protected abstract void CreateTable(List<string> columns);
|
|
|
|
|
protected abstract void CreateRow(PdfRowParameters rowParameters);
|
|
|
|
|
protected abstract void SavePdf(PdfInfoHeadwaiter info);
|
|
|
|
|
}
|
|
|
|
|
}
|