Files
CourseWork_CarCenter/CarCenter/CarCenterBusinessLogic/OfficePackage/AbstractSaveToPdfAdministrator.cs

74 lines
2.3 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using CarCenterBusinessLogic.OfficePackage.HelperEnums;
using CarCenterBusinessLogic.OfficePackage.HelperModels;
/*using CarCenterDatabaseImplement.Implements;*/
namespace CarCenterBusinessLogic.OfficePackage
{
public abstract class AbstractSaveToPdfAdministrator
{
public void CreateDoc(PdfInfo 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
});
CreateTable(new List<string> { "4cm", "4cm", "4cm", "4cm" });
CreateRow(new PdfRowParameters
{
Texts = new List<string> { "Дата", "Название машины", "Сотрудник ", "Комплектация" },
Style = "NormalTitle",
ParagraphAlignment = PdfParagraphAlignmentType.Center
});
foreach (var car in info.ReportEquipmentsEmployees)
{
CreateRow(new PdfRowParameters
{
Texts = new List<string> { "", car.BrandCar, "", "" },
Style = "NormalTitle",
ParagraphAlignment = PdfParagraphAlignmentType.Center
});
/*foreach (var employee in car.Employees)
{
CreateRow(new PdfRowParameters
{
Texts = new List<string> { employee.EmployeeFIO.ToString(), "", "", employee.Specialization },
Style = "Normal",
ParagraphAlignment = PdfParagraphAlignmentType.Center
});
}*/
/*foreach (var guidance in car.Equipments)
{
CreateRow(new PdfRowParameters
{
Texts = new List<string> { guidance.DateCreateEquipment.ToString(), "", guidance.EquipmentName, "" },
Style = "Normal",
ParagraphAlignment = PdfParagraphAlignmentType.Center
});
}*/
}
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 SavePdf(PdfInfo info);
}
}