private bool CreateSummarySheet(ISheet summaryPage, Facility facility) { try { var excelRow = summaryPage.GetRow(0) ?? summaryPage.CreateRow(0); var excelCell = excelRow.GetCell(0) ?? excelRow.CreateCell(0); SetHeader(excelCell); excelCell.SetCellValue("Facility summary"); var iRunningRow = 2; if (facility.AssetTypes != null && facility.AssetTypes.Any()) { var assetTypesReport = new GroupingObjectSummaryReport <CobieObject>(facility.AssetTypes, "Asset types report"); iRunningRow = WriteReportToPage(summaryPage, assetTypesReport.GetReport(PreferredClassification), iRunningRow); } if (facility.Zones != null && facility.Zones.Any()) { var zonesReport = new GroupingObjectSummaryReport <CobieObject>(facility.Zones, "Zones report"); iRunningRow = WriteReportToPage(summaryPage, zonesReport.GetReport(PreferredClassification), iRunningRow); } if (facility.Documents != null && facility.Documents.Any()) { var docReport = new DocumentsReport(facility.Documents); iRunningRow = WriteReportToPage(summaryPage, docReport.GetReport("ResponsibleRole"), iRunningRow); } Debug.WriteLine(iRunningRow); return(true); } catch (Exception e) { //log the error Logger.Error("Failed to create Summary Sheet", e); return(false); } }
private bool CreateSummarySheet(ISheet summaryPage, Facility facility) { try { var excelRow = summaryPage.GetRow(0) ?? summaryPage.CreateRow(0); var excelCell = excelRow.GetCell(0) ?? excelRow.CreateCell(0); SetHeader(excelCell); excelCell.SetCellValue("Facility summary"); var iRunningRow = 2; if (facility.AssetTypes != null && facility.AssetTypes.Any()) { var assetTypesReport = new GroupingObjectSummaryReport<CobieObject>(facility.AssetTypes, "Asset types report"); iRunningRow = WriteReportToPage(summaryPage, assetTypesReport.GetReport(PreferredClassification), iRunningRow); } if (facility.Zones != null && facility.Zones.Any()) { var zonesReport = new GroupingObjectSummaryReport<CobieObject>(facility.Zones, "Zones report"); iRunningRow = WriteReportToPage(summaryPage, zonesReport.GetReport(PreferredClassification), iRunningRow); } if (facility.Documents != null && facility.Documents.Any()) { var docReport = new DocumentsReport(facility.Documents); iRunningRow = WriteReportToPage(summaryPage, docReport.GetReport("ResponsibleRole"), iRunningRow); } Debug.WriteLine(iRunningRow); return true; } catch (Exception e) { //log the error Logger.Error("Failed to create Summary Sheet", e); return false; } }