/// <summary> /// Find all the data sections in this VESTA report and add them /// to our list. /// /// VESTA report data sections are marked by particular text strings. Which /// text strings might be found in a particular report depends on the report /// type -- see SectionMarkers property of this class. /// /// Return the number of data sections found. /// </summary> private int FindDataSections() { int retInt = 0; // Check for each marker string relevant to // this report type: foreach (string marker_text in this.SectionMarkers) { // find marker string: int top_row_idx = this.sheet.RowIndexOf(marker_text); if (top_row_idx != -1) // if not -1, we found it { // if there's data, add a section to our list VestaReportSection sect = ReportSectionFactory.create( sheet, top_row_idx, marker_text, this.report_type, this.year); if (sect != null) { this.sections.Add(sect); retInt++; } } } return retInt; }
public static VestaReportSection create( ExcelSheet sheet, int top_row_idx, string marker_text, ReportTypes report_type, int year ) { VestaReportSection retSect = null; ExcelRow r = sheet[top_row_idx + 2]; if (!r.IsEmpty() && (r[EMPTY_SECTION_MARKER_COLUMN]).Trim() != EMPTY_SECTION_MARKER) { switch (report_type) { case ReportTypes.Participant: retSect = new ParticipantReportSection(sheet, top_row_idx, year); break; case ReportTypes.Labels: Tuple <LabelType, RequestType> tu = parse_marker_text(marker_text); LabelType lt = tu.Item1; RequestType rt = tu.Item2; switch (lt) { case LabelType.Bag: retSect = new BagLabelReportSection(sheet, top_row_idx, rt, year); break; case LabelType.Gift: retSect = new GiftLabelReportSection(sheet, top_row_idx, rt, year); break; } break; } } return(retSect); }