private ExcelRow CreateRowForItem(JobItemDocumentVM item) { var cells = new ExcelCell[item.Macros.Length + 3]; var errors = new List <string>(); if (item.Issues.Any()) { errors.Add($"[File] - {string.Join(", ", item.Issues)}"); } var cellColor = default(KnownColor?); switch (item.Status) { case Common.Services.JobItemStatus_e.Failed: cellColor = KnownColor.Red; break; case Common.Services.JobItemStatus_e.InProgress: cellColor = KnownColor.LightBlue; break; case Common.Services.JobItemStatus_e.Succeeded: cellColor = KnownColor.LightGreen; break; case Common.Services.JobItemStatus_e.Warning: cellColor = KnownColor.LightYellow; break; case Common.Services.JobItemStatus_e.AwaitingProcessing: cellColor = KnownColor.LightGray; break; } cells[0] = new ExcelCell(item.Status, null, cellColor); cells[1] = new ExcelCell(item.DisplayObject.Path, null, cellColor); for (int i = 0; i < item.Macros.Length; i++) { var macro = item.Macros[i]; if (macro.Issues.Any()) { errors.Add($"[{macro.Name}] - {string.Join("; ", macro.Issues)}"); } cells[i + 2] = new ExcelCell(macro.Status, null, cellColor); } cells[cells.Length - 1] = new ExcelCell(string.Join(Environment.NewLine, errors), null, cellColor); return(new ExcelRow(cells)); }
private ExcelRow CreateHeader(JobItemDocumentVM template) { var cells = new ExcelCell[template.Macros.Length + 3]; cells[0] = new ExcelCell("Status"); cells[1] = new ExcelCell("File"); for (int i = 0; i < template.Macros.Length; i++) { cells[i + 2] = new ExcelCell(template.Macros[i].Name); } cells[cells.Length - 1] = new ExcelCell("Error"); return(new ExcelRow(cells)); }