}//END getReport class // ===================================================================================== /// <summary> /// This class retrieves a report object by is scope and retrieves the first instance. /// </summary> /// <param name="Scope">EvReport.ReportScopeTypes: Report Scope.</param> /// <returns>EvReport: a report object</returns> // ------------------------------------------------------------------------------------- public EdReport getReportByScope(EdReport.ReportScopeTypes Scope) { this._DebugLog = new System.Text.StringBuilder( ); this.LogMethod("getReportByScope method. "); this.LogDebug("Scope: " + Scope); EdReport report = new EdReport( ); List <EdReport> reportList = this._dalReportTemplates.getReportList( EdReport.ReportTypeCode.Null, Scope, String.Empty, false); if (reportList.Count == 0) { return(report); } report = this._dalReportTemplates.getReport(reportList [0].Guid); this.LogClass(this._dalReportTemplates.Log); // // Return the role. // return(report); }//END getReport class
public EvReportHtml( EdReport report, EdUserProfile userProfile) { this.writeDebugLogMethod("EvReportHtml initialisation method."); this._report = report; this._UserProfile = userProfile; }
} // Close getView method. #endregion #region Data Object Retrieval methods // ===================================================================================== /// <summary> /// This class retrieve the Report data table based on Guid value. /// </summary> /// <param name="Guid">Guid: A report's global unique identifier</param> /// <returns>EvReport: a report data object</returns> /// <remarks> /// This method consists of the following steps: /// /// 1. Define the sql query parameters and sql query string. /// /// 2. Execute the sql query string and store the results on data table. /// /// 3. Extract the first row data to the report object. /// /// 4. Return the Report data object. /// </remarks> // ------------------------------------------------------------------------------------- public EdReport getReport(Guid Guid) { this.LogMethod("getReport. "); this.LogDebug("Guid: " + Guid); // // Define the local variables // string _sqlQueryString; EdReport report = new EdReport( ); // // Define the SQL query parameters and load the query values. // SqlParameter [] cmdParms = new SqlParameter [] { new SqlParameter(_parmGuid, SqlDbType.UniqueIdentifier), }; cmdParms [0].Value = Guid; // // Generate the SQL query string // _sqlQueryString = _sqlQuery_View + "WHERE (RS_Guid = @Guid); "; this.LogDebug(_sqlQueryString); // // Execute the query against the database // using (DataTable table = EvSqlMethods.RunQuery(_sqlQueryString, cmdParms)) { // // If not rows the return // if (table.Rows.Count == 0) { return(report); } // // Extract the table row // DataRow row = table.Rows [0]; // // Fill the Report object. // report = this.readRow(row); }//END Using // // Return the Report data object. // this.LogMethodEnd("getReport."); return(report); } // Close getReport method.
} //EMD getMilestoneList method. // ===================================================================================== /// <summary> /// This class retrieves a report object based on Guid /// </summary> /// <param name="Guid">Guid: a global unique identifier</param> /// <returns>EvReport: a report object</returns> /// <remarks> /// This method consists of the following steps: /// /// 1. Execute the method for retrieving a list Report participant /// /// 2. Return a report object /// </remarks> // ------------------------------------------------------------------------------------- public EdReport getReport(Guid Guid) { this.LogMethod("getReport method."); EdReport report = this._dalReportSaved.getReport(Guid); this.LogClass(this._dalReportSaved.Log); return(report); }//END getReport class
// ===================================================================================== /// <summary> /// This class saves new report to database /// </summary> /// <param name="Report">EvReport: a report object</param> /// <returns>EvEventCodes: an event code for saving reports</returns> /// <remarks> /// This method consists of the following steps: /// /// 1. Execute the method for adding report to database /// /// 2. Return an event code for saving new report. /// </remarks> // ------------------------------------------------------------------------------------- public EvEventCodes saveNewReport(EdReport Report) { this.LogMethod("saveNewReport method."); this.LogDebug("Adding Report."); EvEventCodes iReturn = EvEventCodes.Ok; iReturn = this._dalReportSaved.addReport(Report); this.LogClass(this._dalReportSaved.Log); return(iReturn); }//END saveNewReport class
}//END getReportTypeList method. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ #endregion #region Report retrieval methods // ===================================================================================== /// <summary> /// This class retrieves a report object based on Guid /// </summary> /// <param name="ReportGuid">Guid: (Mandatory) The global unique identifier.</param> /// <returns>EvReport: a report object</returns> /// <remarks> /// This method consists of the following steps: /// /// 1. Execute the method for retrieving the report object based on the Guid /// /// 2. Return the report object. /// </remarks> // ------------------------------------------------------------------------------------- public EdReport getReport(Guid ReportGuid) { this._DebugLog = new System.Text.StringBuilder( ); this.LogMethod("getReport method. "); this.LogDebug("Guid: " + ReportGuid); EdReport report = this._dalReportTemplates.getReport(ReportGuid); this.LogClass(this._dalReportTemplates.Log); // // Return the role. // return(report); }//END getReport class
}//END getReportsParameters class. // ===================================================================================== /// <summary> /// This class sets the values from Report object to the array of sql parameters. /// </summary> /// <param name="parms">SqlParameter: an array of sql parameters</param> /// <param name="Report">EvReport: Values to bind to parameters</param> /// <remarks> /// This method consists of the following steps: /// /// 1. Bind the values from Report object to the array of parameters. /// </remarks> // ------------------------------------------------------------------------------------- private void SetParameters(SqlParameter [] parms, EdReport Report) { parms [0].Value = Report.Guid; parms [1].Value = String.Empty; parms [2].Value = Report.ReportId; parms [3].Value = Report.ReportNo; parms [4].Value = Report.ReportDate; parms [5].Value = Report.ReportTitle; parms [6].Value = Report.ReportType; parms [7].Value = Report.Category; parms [8].Value = Evado.Model.EvStatics.SerialiseObject <EdReport> (Report); parms [9].Value = Report.UpdateUserId; parms [10].Value = Report.UserCommonName; parms [11].Value = DateTime.Now; }//END SetParameters class.
}//END getReport class //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ #endregion #region Report update methods. // ===================================================================================== /// <summary> /// This class saves items to the Report ResultData table. /// The update and add process are the same as in each execution the currentMonth objects are /// set to superseded and then a new object is inserted to the database. /// </summary> /// <param name="Report">EvReport: a report object</param> /// <returns>EvEventCodes: an event code for saving items</returns> /// <remarks> /// This method consists of the following steps: /// /// 1. Execute the method for deleting items, if the Guid is not empty. /// /// 2. Else, execute the method for adding items /// /// 3. Else, execute the method for updating items. /// /// 4. Return the event code of the method execution. /// </remarks> // ------------------------------------------------------------------------------------- public EvEventCodes saveReport(EdReport Report) { this._DebugLog = new System.Text.StringBuilder( ); EvEventCodes iReturn = EvEventCodes.Ok; this.LogMethod("saveReport method."); // // Deletion in the ResultData object consists of setting the currentMonth object to superseded // with the rsult that it is not visible to operational system. // // If none of the properties are selected then delete the user. // if (Report.ReportTitle == String.Empty) { if (Report.Guid != Guid.Empty) { this.LogValue(" Deleting Report."); iReturn = this._dalReportTemplates.deleteItem(Report); this.LogClass(this._dalReportTemplates.Log); } return(iReturn); } // // If the object UID = 0 it is new selection to add a record // if (Report.Guid == Guid.Empty) { this.LogValue(" Adding Report."); iReturn = this._dalReportTemplates.addReport(Report); this.LogClass(this._dalReportTemplates.Log); return(iReturn); } this.LogValue(" Updating Report."); iReturn = this._dalReportTemplates.updateReport(Report); this.LogClass(this._dalReportTemplates.Log); return(iReturn); } // Close saveReport method
} // Close getReport method. #endregion #region Update Data methods // ===================================================================================== /// <summary> /// This class adds items to the Report table based on the selected report object. /// /// Author: Ross Anderson /// Date: 12/10/2005 /// </summary> /// <param name="Report">EvReport: a report data object</param> /// <returns>EvEventCodes: an event code for adding items</returns> /// <remarks> /// This method consists of the following steps: /// /// 1. Exit, if the VisitId or User Common Name is empty. /// /// 2. Define the sql query parameter and execute the storeprocedure for adding items. /// /// 3. Exit, if the storeprocedure runs fail /// /// 4. Else, return the event code for adding items. /// </remarks> // ------------------------------------------------------------------------------------- public EvEventCodes addReport(EdReport Report) { this.LogMethod("addReport. "); this.LogDebug("Guid: " + Report.Guid); this.LogDebug("ReportId: " + Report.ReportId); this.LogDebug("ReportTitle: " + Report.ReportTitle); this.LogDebug("ReportSubTitle: " + Report.ReportSubTitle); this.LogDebug("ReportCommonName: " + Report.UserCommonName); // // Define the local variables. // string _sqlQueryString = String.Empty; if (Report.UserCommonName == String.Empty) { this.LogDebug("CommonUser missing. "); return(EvEventCodes.Identifier_User_Common_Name_Error); } // // set the FormUid for the Report. // Report.Guid = Guid.NewGuid( ); // // Define the SQL query parameters and load the query values. // SqlParameter [] cmdParms = getReportsParameters( ); SetParameters(cmdParms, Report); // // Execute the update command. // if (EvSqlMethods.StoreProcUpdate(_STORED_PROCEDURE_AddReport, cmdParms) == 0) { this.LogMethodEnd("addReport."); return(EvEventCodes.Database_Record_Update_Error); } this.LogMethodEnd("addReport."); return(EvEventCodes.Ok); } // Close method addReport
} // Close getReport method. // ===================================================================================== /// <summary> /// This class obtains the order by string from the columns of the Report. /// </summary> /// <param name="Report">EvReport: a report data object</param> /// <returns>string: a string for ordering the report columns</returns> /// <remarks> /// This method consists of the following steps: /// /// 1. Loop through the report columns and set the index name by identifier value. /// /// 2. Define the sql query string based on the indexNameById value. /// /// 3. Format the sql query string. /// /// 4. Return the sql query string. /// </remarks> // ------------------------------------------------------------------------------------- private string getOrderByString(EdReport Report) { this.LogMethod("getOrderByString. "); // // Initialize the local variables and objects // String sqlQueryString = string.Empty; string [] indexNamebyId = new string [6]; indexNamebyId [0] = String.Empty; indexNamebyId [1] = String.Empty; indexNamebyId [2] = String.Empty; indexNamebyId [3] = String.Empty; indexNamebyId [4] = String.Empty; indexNamebyId [5] = String.Empty; // // Loop through the Report columns and set the index name by Id value. // for (int columnCounter = 0; columnCounter < Report.Columns.Count; columnCounter++) { EdReportColumn column = Report.Columns [columnCounter]; if (column.SectionLvl < 0 || column.SectionLvl > 5) { continue; } // // If the column is the detail, then the index is the first column. // if (indexNamebyId [column.SectionLvl].Contains(column.SourceField) == false) { if (indexNamebyId [column.SectionLvl] != String.Empty) { indexNamebyId [column.SectionLvl] += ", "; } indexNamebyId [column.SectionLvl] += column.SourceField; } }//END For index name by Id sqlQueryString += String.Empty; // // Set the sql query string values. // for (int i = 1; i < 5; i++) { if (indexNamebyId [i] != String.Empty) { if (sqlQueryString != String.Empty) { sqlQueryString += ", "; } sqlQueryString += indexNamebyId [i]; } }//END For sql query string. if (indexNamebyId [0] != String.Empty) { if (sqlQueryString != String.Empty) { sqlQueryString += ", "; } sqlQueryString += indexNamebyId [0]; } sqlQueryString = " ORDER BY " + sqlQueryString; this.LogDebug("sqlQueryString: " + sqlQueryString); // // Return the sql query string. // return(sqlQueryString); }//END getOrderByString class
}// End readRow method. #endregion #region Database selectionList query methods // ===================================================================================== /// <summary> /// This class returns a list of Reports based on the TrialId, RecordTypeId and Category value. /// </summary> /// <param name="ProjectId">string: (Mandatory) The Project identifier</param> /// <param name="ReportTypeId">EvReport.ReportTypeCode: The Report Type Identifier</param> /// <param name="Category">EvReport.ReportTypeCode: The Report's category</param> /// <returns>List of EvReport: A list of Report data objects.</returns> /// <remarks> /// This method consists of the following steps: /// /// 1. Define the sql query parameters and sql query string /// /// 2. Execute the sql query string and store the results on data table. /// /// 3. Loop through the table and extract the row data to the Report object. /// /// 4. Add the Report object value to the Report list. /// /// 5. Return the report list. /// </remarks> // ------------------------------------------------------------------------------------- public List <EdReport> getView(string ProjectId, EdReport.ReportTypeCode ReportTypeId, string Category) { this.LogMethod("getView. "); this.LogDebug("Projectid: " + ProjectId); this.LogDebug("ReportTypeId: " + ReportTypeId); this.LogDebug("Category: " + Category); // // Define the local variables // string _sqlQueryString; List <EdReport> view = new List <EdReport> ( ); // // Define the SQL query parameters and load the query values. // SqlParameter [] cmdParms = new SqlParameter [] { new SqlParameter(_parmTrialId, SqlDbType.NVarChar, 10), new SqlParameter(_parmReportTypeId, SqlDbType.SmallInt), new SqlParameter(_parmCategory, SqlDbType.NVarChar, 100), }; cmdParms [0].Value = ProjectId; cmdParms [1].Value = ReportTypeId; cmdParms [2].Value = Category; // // Generate the SQL query string // _sqlQueryString = _sqlQuery_View + "WHERE (TrialId = @TrialId) "; if (ReportTypeId != EdReport.ReportTypeCode.Null) { _sqlQueryString += " AND (RS_ReportTypeId = @ReportTypeId ) "; } if (Category != String.Empty) { _sqlQueryString += " AND (RS_Category = @Category ) "; } _sqlQueryString += " ORDER BY ReportId, RS_ReportNo; "; this.LogDebug(_sqlQueryString); // // Execute the query against the database // using (DataTable table = EvSqlMethods.RunQuery(_sqlQueryString, cmdParms)) { // // Iterate through the results extracting the Report information. // for (int Count = 0; Count < table.Rows.Count; Count++) { // // Extract the table row // DataRow row = table.Rows [Count]; EdReport Report = this.readRow(row); view.Add(Report); } } this.LogDebug("view Count: " + view.Count); // // Return the ArrayList containing the Report data object. // this.LogMethodEnd("getView."); return(view); } // Close getView method.
//=================================================================================== /// <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 EdReportSection loadModel(EdReport 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. // EdReportSection 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. // EdReportSection [] sections = new EdReportSection [5]; // // Define the detailed section separately as it treated separately. // EdReportSection detail = null; // // This stores the lower section before the detail. Is used since this section // has a specialized format. // EdReportSection 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 // EdReportRow row = report.DataRecords [record]; // // Iterate through the columns. // for (int column = 0; column < row.ColumnValues.Length; column++) { // // Retrieve the curren column // EdReportColumn 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 != EdReportSection.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 EdReportSection( ); 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 == EdReportSection.Detail_Level ? wholeReport : sections [sectionLvl - 1]; sections [sectionLvl].SectionLevel = sectionLvl; sections [sectionLvl].Layout = EdReportSection.LayoutTypes.Flat; sections [sectionLvl].GroupingColumnValue = currentValue; sectionHasChangedInThisRow [sectionLvl] = true; if (sections [sectionLvl].Parent == null) { sections [sectionLvl].Parent = new EdReportSection( ); } 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 EdReportSection( ); detail.RowNumber = record; detail.Layout = EdReportSection.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 == EdReport.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 == EdReport.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.
public EvReportCsv(EdReport report, string separator, EdUserProfile userProfile) { _report = report; _separator = separator; }
/// <summary> /// This method should be overriden by all of the classes that want to provide ResultData for the reports. /// </summary> /// <param name="Report"></param> /// <returns></returns> public virtual EdReport getReport(EdReport Report) { return(Report); } //END getReport class
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ #endregion // ===================================================================================== /// <summary> /// getReport method /// /// Description: /// Get an ArrayList of user ResultData objects. /// /// </summary> // ------------------------------------------------------------------------------------- public EdReport getReport(EdReport Report) { this.LogMethod("getReport method. "); this.LogDebug("ReportId: " + Report.ReportId); this.LogDebug("SourceId: " + Report.DataSourceId); this.LogDebug("RequireUserTrial: " + Report.RequireUserTrial); this.LogDebug("Report.Queries.Length: " + Report.Queries.Length); for (int index = 0; index < Report.Queries.Length; index++) { Evado.Digital.Model.EdReportQuery query = Report.Queries [index]; this.LogDebug(index + " > " + query.getAsString()); } this.LogDebug("Report.Column.Count: " + Report.Queries.Length); for (int index = 0; index < Report.Columns.Count; index++) { Evado.Digital.Model.EdReportColumn column = Report.Columns [index]; this.LogDebug(index + " > " + column.getAsString( )); } // // initialise the methods variables and objects. // EdReport report = new EdReport( ); switch (Report.DataSourceId) { case EdReport.ReportSourceCode.FormFields: { Evado.Digital.Dal.EdRecordFields DAL_formField = new Evado.Digital.Dal.EdRecordFields(this.ClassParameters); report = DAL_formField.getReport(Report); this.LogClass("Form Fields Status: " + DAL_formField.Log); break; } case EdReport.ReportSourceCode.Field_Monitoring_Query: { Evado.Digital.Dal.EdRecordValues DAL_formRecordField = new Evado.Digital.Dal.EdRecordValues(this.ClassParameters); report = Report; // DAL_formRecordField.getMonitoringReport ( Report ); this.LogClass("Form Record Fields Status: " + DAL_formRecordField.Log); break; } case EdReport.ReportSourceCode.Subject_Demographics: { report = null; break; } case EdReport.ReportSourceCode.Subject_Record_Status: { Evado.Digital.Dal.EdRecords dalRecords = new Evado.Digital.Dal.EdRecords(this.ClassParameters); report = Report; // new dalRecords.getRecordStatusReport ( Report ); //this.LogDebug( dalRecords.Log ); break; } case EdReport.ReportSourceCode.Class: { Type providerType = Type.GetType(Report.SqlDataSource); EvReportDataProviderBase provider = (EvReportDataProviderBase)providerType.GetConstructor( new Type [0]).Invoke(new Object [0]); report = provider.getReport(Report); break; } default: case EdReport.ReportSourceCode.SqlQuery: { report = this._dalReports.getReport(Report); this.LogClass(this._dalReports.Log); break; } } //Sets the correct date for this Report. Overrides the stored date since this is a new //Report. report.ReportDate = DateTime.Now; return(report); } // Close getReport method.
}// End readRow method. #endregion #region Database selectionList query methods // ===================================================================================== /// <summary> /// This class retrieves the Report data table based on the selected report object. /// </summary> /// <param name="Report">EvReport: (Mandatory) Report object with selection parameters</param> /// <returns>EvReport: a report data object.</returns> /// <remarks> /// This method consists of the following steps: /// /// 1. Define the sql qeury string. /// /// 2. Execute the sql query string and store the results on data table. /// /// 3. Loop through the table and extract data row to the Report object. /// /// 4. Return the Report data object. /// </remarks> // ------------------------------------------------------------------------------------- public EdReport getReport(EdReport Report) { this.LogMethod("getReport. "); this.LogDebug("ReportTypeId: " + Report.ReportType); this.LogDebug("Category: " + Report.Category); // // Define the local variables // string sqlQueryString; ArrayList view = new ArrayList( ); // // Generate the SQL query string // sqlQueryString = Report.SqlDataSource; bool isWhereSetted = false; if (sqlQueryString.ToLower( ).Contains("where")) { sqlQueryString = sqlQueryString + " "; isWhereSetted = true; } for (int queryCount = 0; queryCount < Report.Queries.Length; queryCount++) { if (Report.Queries [queryCount].Value == null || Report.Queries [queryCount].Value == String.Empty) { continue; } if (isWhereSetted == false) { sqlQueryString += " WHERE "; isWhereSetted = true; } else { sqlQueryString += " AND "; } sqlQueryString += Report.Queries [queryCount].FieldName + " " + Report.Queries [queryCount].getOperatorString( ) + " "; switch (Report.Queries [queryCount].DataType) { case EdReport.DataTypes.Text: case EdReport.DataTypes.Guid: case EdReport.DataTypes.Hidden: { sqlQueryString += "'" + Report.Queries [queryCount].Value + "'"; break; } case EdReport.DataTypes.Date: { //TODO I dont know what to do with dates. sqlQueryString += "'" + Report.Queries [queryCount].Value + "'"; break; } default: { sqlQueryString += Report.Queries [queryCount].Value; break; } } }//End of query iteration. sqlQueryString += getOrderByString(Report); this.LogDebug(sqlQueryString); //return Report; // // Execute the query against the database // using (DataTable table = EvSqlMethods.RunQuery(sqlQueryString, null)) { // // Iterate through the results extracting the Report information. // for (int Count = 0; Count < table.Rows.Count; Count++) { // // Extract the table row // DataRow row = table.Rows [Count]; Report.DataRecords.Add(this.readRow(row, Report.Columns)); } //End For } //END Using this.LogDebug("View Count: " + Report.DataRecords.Count); // // Return the ArrayList containing the Report data object. // return(Report); } // Close getReport method.
}//END SetParameters class. #endregion #region Data Reader methods // ===================================================================================== /// <summary> /// This class extracts the data row values to the report object. /// </summary> /// <param name="Row">DataRow: a data row object</param> /// <returns>EvReport: a report data object</returns> /// <remarks> /// This method consists of the following steps: /// /// 1. Extract the compatible data row values to the Report data object. /// /// 2. Set the xml report string, if it is empty. /// /// 3. Return the Report data object. /// </remarks> // ------------------------------------------------------------------------------------- public EdReport readRow(DataRow Row) { // // Initialise the methods variables and objects. // EdReport report = new EdReport( ); // // Set the xml report string, if it is empty. // string xmlReport = EvSqlMethods.getString(Row, "RS_XmlReport"); if (xmlReport != String.Empty) { xmlReport = xmlReport.Replace("utf-8", "utf-16"); xmlReport = xmlReport.Replace("<SelectionSource></SelectionSource>", "<SelectionSource>None</SelectionSource>"); xmlReport = xmlReport.Replace("<SelectionSource />", "<SelectionSource>None</SelectionSource>"); xmlReport = xmlReport.Replace("<SelectionSource>SubjectId</SelectionSource>", "<SelectionSource>Subject_Id</SelectionSource>"); xmlReport = xmlReport.Replace("<SelectionSource>SiteId</SelectionSource>", "<SelectionSource>Site_Id</SelectionSource>"); xmlReport = xmlReport.Replace("<SelectionSource>TrialId</SelectionSource>", "<SelectionSource>Trial_Id</SelectionSource>"); xmlReport = xmlReport.Replace("<SelectionSource>Trial_Id</SelectionSource>", "<SelectionSource>Project_Id</SelectionSource>"); xmlReport = xmlReport.Replace("<SelectionSource>ScheduleId</SelectionSource>", "<SelectionSource>Arm_Index</SelectionSource>"); xmlReport = xmlReport.Replace("<SelectionSource>AllTrialSites</SelectionSource>", "<SelectionSource>All_Trial_Sites</SelectionSource>"); xmlReport = xmlReport.Replace("<SelectionSource>CurrentTrial</SelectionSource>", "<SelectionSource>Current_Trial</SelectionSource>"); xmlReport = xmlReport.Replace("<SelectionSource>Current_Trial</SelectionSource>", "<SelectionSource>Current_Project</SelectionSource>"); xmlReport = xmlReport.Replace("<TrialId>", "<ProjectId>"); xmlReport = xmlReport.Replace("</TrialId>", "</ProjectId>"); xmlReport = xmlReport.Replace("<ReportTypeId>", "<ReportType>"); xmlReport = xmlReport.Replace("</ReportTypeId>", "</ReportType>"); report = Evado.Model.EvStatics.DeserialiseObject <EdReport> (xmlReport);; } // // Extract the compatible data row values to the Report object. // report.Guid = EvSqlMethods.getGuid(Row, "RS_Guid"); report.ReportId = EvSqlMethods.getString(Row, "ReportId"); report.ReportTitle = EvSqlMethods.getString(Row, "RS_ReportTitle"); //Report.ReportSubTitle = EvSqlMethods.getString( Row, "RS_ReportSubTitle" ); report.ReportDate = EvSqlMethods.getDateTime(Row, "RS_ReportDate"); report.ReportType = (EdReport.ReportTypeCode)EvSqlMethods.getInteger(Row, "RS_ReportTypeId"); report.ReportNo = EvSqlMethods.getInteger(Row, "RS_ReportNo"); report.UpdateUserId = EvSqlMethods.getString(Row, "RS_UpdatedByUserId"); report.Updated = EvSqlMethods.getString(Row, "RS_UpdatedBy"); report.Updated += " on " + EvSqlMethods.getDateTime(Row, "RS_UpdateDate").ToString("dd MMM yyyy HH:mm"); report.GeneratedBy = EvSqlMethods.getString(Row, "RS_UpdatedBy"); // // Return the Report object // return(report); }// End readRow method.