DD.WellWorkover.Cloud/AsbCloudInfrastructure/Services/AutoGeneratedDailyReports/AutogeneratedDailyReportBlocks/LimitingParameterExcelBlockWriter.cs

31 lines
1.0 KiB
C#
Raw Normal View History

using System.Linq;
using AsbCloudApp.Data.AutogeneratedDailyReport;
using ClosedXML.Excel;
namespace AsbCloudInfrastructure.Services.AutoGeneratedDailyReports.AutogeneratedDailyReportBlocks;
public class LimitingParameterExcelBlockWriter : IExcelBlockWriter
{
private const int rowHeaderBlock = 18;
private const int columnNameFeedRegulator = 1;
private const int columnDepth = 2;
private const int columnTotalHours = 3;
private const int columnPercentDepth = 4;
public void Write(IXLWorksheet sheet, AutoGeneratedDailyReportDto report)
{
if(!report.LimitingParameters.Any())
return;
for (int i = 0; i < report.LimitingParameters.Length; i++)
{
var row = sheet.Row(1 + i + rowHeaderBlock);
row.Cell(columnNameFeedRegulator).Value = report.LimitingParameters[i].NameFeedRegulator;
row.Cell(columnDepth).Value = report.LimitingParameters[i].Depth;
row.Cell(columnTotalHours).Value = report.LimitingParameters[i].TotalHours;
row.Cell(columnPercentDepth).Value = report.LimitingParameters[i].PercentDepth;
}
}
}