public EvReportHtml( EvReport report, EdUserProfile userProfile) { this.writeDebugLogMethod("EvReportHtml initialisation method."); this._report = report; this._UserProfile = userProfile; }
public EvReportCsv(EvReport report, string separator, EdUserProfile userProfile) { _report = report; _separator = separator; }
//=================================================================================== /// <summary> /// This class loads the EvReportSection model from the flat table given in this report object. /// The model is a herarchy of EvReportSection Objects. /// AFC 6 nov 2009 /// </summary> /// <returns>EvReportSection: a report section model</returns> /// <remarks> /// This method consists of the following steps: /// /// 1. Initialize report section properties: top section, section, detail, low section /// /// 2. Iterate through the report data records. /// /// 3. Iterate through the columns. /// /// 4. If column is not a detail column, use detail column functionality /// /// 5. If not a detail column, use non-detail column functionality /// </remarks> // ---------------------------------------------------------------------------------- public EvReportSection loadModel(EvReport report) { this.writeDebugLogMethod("loadModel method."); // // This is the main section and contains the whole report. // It has some special characteristichs such as the level and the column values. // EvReportSection wholeReport = getTopSection( ); // // Stores group column value for each level in the report. // This value is used to determine when a group value has changed, to then close that group and // all child groups including the detailed group. // String [] lastIndexValue = new String [5]; // // Define a section for each level in the report. // EvReportSection [] sections = new EvReportSection [5]; // // Define the detailed section separately as it treated separately. // EvReportSection detail = null; // // This stores the lower section before the detail. Is used since this section // has a specialized format. // EvReportSection lowerSection = null; // // True if the section has changed in this row. // This is used for initialize sections when iterating trhough columns. // bool [] sectionHasChangedInThisRow = new bool [5]; // // Iterate through the report data records. // for (int record = 0; record < report.DataRecords.Count; record++) { // // Get a data report row // EvReportRow row = report.DataRecords [record]; // // Iterate through the columns. // for (int column = 0; column < row.ColumnValues.Length; column++) { // // Retrieve the curren column // EvReportColumn currentColumn = report.Columns [column]; if (currentColumn.HeaderText == String.Empty) { continue; } // // Extract the value of the current column // String currentValue = row.ColumnValues [column]; this.writeDebugLogLine("CurrentValue: " + currentValue); int sectionLvl = currentColumn.SectionLvl; // // If the column is not the detail level, then this must be a group column // // So process the column using group column functionality. // if (sectionLvl != EvReportSection.Detail_Level) { // // Test whether the group index has changed its value. // if (currentColumn.GroupingIndex && lastIndexValue [currentColumn.SectionLvl] != currentValue) { // // Resets all the lower levels. // for (int level = currentColumn.SectionLvl; level < 5; level++) { lastIndexValue [level] = null; } // // Open a new level. // lastIndexValue [currentColumn.SectionLvl] = currentValue; sections [sectionLvl] = new EvReportSection( ); sections [sectionLvl].RowNumber = record; // // Stores the parent. If the previous level is the detail, then the parent is the // whole report. If not, the parent is the previous section // sections [sectionLvl].Parent = sectionLvl - 1 == EvReportSection.Detail_Level ? wholeReport : sections [sectionLvl - 1]; sections [sectionLvl].SectionLevel = sectionLvl; sections [sectionLvl].Layout = EvReportSection.LayoutTypes.Flat; sections [sectionLvl].GroupingColumnValue = currentValue; sectionHasChangedInThisRow [sectionLvl] = true; if (sections [sectionLvl].Parent == null) { sections [sectionLvl].Parent = new EvReportSection( ); } sections [sectionLvl].Parent.ChildrenList.Add(sections [sectionLvl]); }//END Group index has changed. if (sectionHasChangedInThisRow [sectionLvl]) { sections [sectionLvl].ColumnValuesByHeaderText.Add(currentColumn.HeaderText, currentValue); sections [sectionLvl].ColumnList.Add(currentColumn); } // // If the lower section has a level less than the current section level, // then the current become the lower section. // if (lowerSection == null || lowerSection.SectionLevel < currentColumn.SectionLvl) { lowerSection = sections [sectionLvl]; } } else { // // This is the section lvl 0 ("Detail"). // This assumes that the sections are coninuously enumerated. // if (lastIndexValue [currentColumn.SectionLvl] != ("" + record)) { if (lowerSection == null) { lowerSection = wholeReport; } lastIndexValue [currentColumn.SectionLvl] = "" + record; detail = new EvReportSection( ); detail.RowNumber = record; detail.Layout = EvReportSection.LayoutTypes.Tabular; detail.Parent = lowerSection; if (report.IsAggregated == true) { // // Is the report is aggregated, then the detail is not visible. // detail.Visible = false; detail.OnlyShowHeadersForTotalColumns = true; }//End if is aggregated. // // Process: If the site header of the report is not empty, and the value of this site // is different to the user organization, then dont show the detail. // else if (report.IsUserSiteFiltered == true) { String detailOrganizationId = detail.searchValueByHeaderText(report.SiteColumnHeaderText, true); // // If the user is not site staff, or site trial coordinator, or site principal investigator // dont show the details. // }//End if it is site filtered. else { detail.Visible = true; detail.OnlyShowHeadersForTotalColumns = false; } lowerSection.ChildrenList.Add(detail); lowerSection.DetailColumnsList = detail.ColumnList; } detail.ColumnValuesByHeaderText.Add( currentColumn.HeaderText, currentValue); detail.ColumnList.Add(currentColumn); if (currentColumn.GroupingType == EvReport.GroupingTypes.Total) { detail.addToAcumulator(currentColumn.HeaderText, currentValue); } // // If the grouping type is count, then add 1 to the acumulator // if the value is not empty. // if (currentColumn.GroupingType == EvReport.GroupingTypes.Count) { if (currentValue.Trim( ) != String.Empty) { detail.addToAcumulator(currentColumn.HeaderText, "1"); } } } } for (int i = 0; i < sectionHasChangedInThisRow.Length; i++) { sectionHasChangedInThisRow [i] = false; } lowerSection = null; } return(wholeReport); }//End loadModel method.