using System.Linq; using AsbCloudApp.Data.AutogeneratedDailyReport; using ClosedXML.Excel; namespace AsbCloudInfrastructure.Services.AutoGeneratedDailyReports.AutogeneratedDailyReportBlocks; public class SubsystemExcelBlockWriter : IExcelBlockWriter { private const int rowHeaderBlock = 13; private const int columnName = 1; private const int columnKUsage = 2; private const int columnDepth = 3; private const int columnUsedTimeHours = 4; public void Write(IXLWorksheet sheet, AutoGeneratedDailyReportDto report) { if(!report.Subsystems.Any()) return; for (int i = 0; i < report.Subsystems.Length; i++) { var row = sheet.Row(1 + i + rowHeaderBlock); row.Cell(columnName).Value = report.Subsystems[i].Name; row.Cell(columnKUsage).Value = report.Subsystems[i].KUsage; row.Cell(columnDepth).Value = report.Subsystems[i].Depth; row.Cell(columnUsedTimeHours).Value = report.Subsystems[i].UsedTimeHours; } } }