}//END getVersionedView method. #endregion #region Class Retrieval methods // ================================================================================== /// <summary> /// This class gets itmes of binary file data object. /// </summary> /// <param name="Guid">Guid: a binary global unique identifier</param> /// <returns>EvBinaryFileMetaData: a binary file data object</returns> /// <remarks> /// This method consists of the following steps: /// /// 1. Return an empty binary file object if the Binary file's Guid is empty /// /// 2. Define the sql query parameter and the sql query string /// /// 3. Execute the sql query string with parameter and store the result on the datatable /// /// 4. Extract the first data row to the binary file object. /// /// 5. Return the Binary file object. /// </remarks> // ---------------------------------------------------------------------------------- public EvBinaryFileMetaData GetFile(Guid Guid) { this.LogMethod("GetFile method. "); this.LogDebug("Guid: " + Guid); // // Define local variables // string sqlQueryString; EvBinaryFileMetaData binaryFile = new EvBinaryFileMetaData( ); // // Check that the TrialObjectId is valid. // if (Guid == Guid.Empty) { return(binaryFile); } // // Define the SQL query parameters and load the query values. // SqlParameter cmdParms = new SqlParameter(EvBinaryFiles.PARM_GUID, SqlDbType.UniqueIdentifier); cmdParms.Value = Guid; // // Generate the SQL query string // sqlQueryString = SQL_VIEW_QUERY + "\r\n WHERE (" + EvBinaryFiles.DB_GUID + " = " + EvBinaryFiles.PARM_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(binaryFile); } // // Extract the table row // DataRow row = table.Rows [0]; binaryFile = this.readDataRow(row); }//END Using // // Return the TrialVisit data object. // this.LogMethodEnd("GetFile"); return(binaryFile); }//END GetItem class.
}//END getList class #endregion #region Retrieval Queries // ===================================================================================== /// <summary> /// This class retrieves the formfield selection list based on Guid value /// </summary> /// <param name="ListGuid">Guid: The Global unique identifier</param> /// <returns>EvFormFieldSelectionList: The formfield selection list object</returns> /// <remarks> /// This method consists of the following steps: /// /// 1. Return an empty selection list if the list's Guid is empty. /// /// 2. Define the sql query string and sql query parameters. /// /// 3. Execute the sql query string and store the results on data table. /// /// 4. Extract the first row to the formfield selection list object. /// /// 5. Return the formfield selection list data object. /// </remarks> // --------------------------------------------------------------------------------- public EvSelectionList getItem(Guid ListGuid) { this.LogMethod("getItem"); this._Log.AppendLine("ListGuid: " + ListGuid); // // Initialise the local variables // EvSelectionList item = new EvSelectionList( ); String sqlQueryString = String.Empty; // // If TestReport UID is null return empty checlist object. // if (ListGuid == Guid.Empty) { return(item); } // // Initialise the query parameters. // SqlParameter [] cmdParms = new SqlParameter [] { new SqlParameter(EvSelectionLists.PARM_GUID, SqlDbType.UniqueIdentifier), }; cmdParms [0].Value = ListGuid; // // Generate the Selection query string. // sqlQueryString = SQL_VIEW_QUERY + " WHERE " + EvSelectionLists.DB_GUID + " = " + EvSelectionLists.PARM_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(item); } // // Extract the table row // DataRow row = table.Rows [0]; item = this.readDataRow(row); }//END Using // // Return Checklsit data object. // return(item); }//END EvFormFieldSelectionList method
}//END GroupExists method #endregion #region Retreival methods // ===================================================================================== /// <summary> /// This class gets Menus data object by its unique object identifier. /// </summary> /// <param name="MenuGuid">Guid: (Mandatory)a global unique object identifier.</param> /// <returns>EvMenuItem: a menu data object</returns> /// <remarks> /// This method consists of the following steps: /// /// 1. Return an empty MenuItem object, if the Guid is empty. /// /// 2. Define the SQL query parameters and a query string. /// /// 3. Execute the query string and store the results on datatable. /// /// 4. Return an empty MenuItem object if the table has no value. /// /// 5. Else, Extract the table row to the MenuItem object. /// /// 6. Return the MenuItem object. /// /// </remarks> // ------------------------------------------------------------------------------------- public Evado.Digital.Model.EvMenuItem getItem(Guid MenuGuid) { this.LogMethod("getItem"); this.LogDebug("MenuGuid: " + MenuGuid); // // Initialize a debug log and a menu item object // Evado.Digital.Model.EvMenuItem menuItem = new Evado.Digital.Model.EvMenuItem( ); // // Check that there is a valid unique identifier. // if (MenuGuid == Guid.Empty) { return(menuItem); } // // Define the query parameters. // SqlParameter cmdParms = new SqlParameter(PARM_GUID, SqlDbType.UniqueIdentifier); cmdParms.Value = MenuGuid; // // Define the query string. // _sqlQueryString = _sqlQuery_View + " WHERE (Mnu_Guid = @Guid ); "; // // Execute the query against the database. // using (DataTable table = EvSqlMethods.RunQuery(_sqlQueryString, cmdParms)) { // // If not rows the return // if (table.Rows.Count == 0) { return(menuItem); } // // Extract the table row // DataRow row = table.Rows [0]; // // Process the results. // menuItem = this.getRowData(row); }//END Using statement // // Pass back the data object. // return(menuItem); }//END getItem class
}//END getList method. #endregion #region Retrieval Queries // ===================================================================================== /// <summary> /// This method retrieves the SubjectRecord data table based on Record's Guid /// </summary> /// <param name="RecordGuid">Guid: A Subject Record's Global Unique identifier</param> /// <returns>EvSubjectRecord: A Subject data object</returns> /// <remarks> /// This method consists of following steps: /// /// 1. Return an empty SubjectRecord object, if the Guid is empty. /// /// 2. Define the sql query parameters and sql query string. /// /// 3. Execute the sql query string and store the results on datatable. /// /// 4. Return an empty SubjectRecord object, if the table has no value. /// /// 5. Else, extract the first data row to the SubjectRecord object. /// /// 6. Return the SubjectRecord object. /// </remarks> // ------------------------------------------------------------------------------------ public EvAncillaryRecord getRecord(Guid RecordGuid) { this.LogMethod("getRecord"); this.LogValue("RecordGuid: " + RecordGuid.ToString( )); // // Define the local variables. // EvAncillaryRecord record = new EvAncillaryRecord( ); // // Validate whether the Subject Record object's Guid is not empty. // if (RecordGuid == Guid.Empty) { return(record); } // // Set the query parameter values. // SqlParameter cmdParms = new SqlParameter(PARM_Guid, SqlDbType.UniqueIdentifier); cmdParms.Value = RecordGuid; // // Generate the SQL query string // _sqlQueryString = _sqlQuery_View + " WHERE (TSR_Guid = @Guid) ;"; // // Execute the query against the database. // using (DataTable table = EvSqlMethods.RunQuery(_sqlQueryString, cmdParms)) { // // If no rows found, return an EvsubjectRecord object. // if (table.Rows.Count == 0) { return(record); } // // Extract the table row // DataRow row = table.Rows [0]; // // Fill the EvsubjectRecord object. // record = this.readRowData(row); }//END Using statement // // Return an object containing an EvsubjectRecord object. // return(record); }//END getRecord method
}//END getRowData method. #endregion #region Form Field Queries // ===================================================================================== /// <summary> /// This class returns a list of formfield items retrieving by form Guid /// </summary> /// <param name="FormGuid">Guid: (Mandatory) The form GUID.</param> /// <returns>List of EvFormField: a list of FormField items</returns> /// <remarks> /// This method consists of the following steps: /// /// 1. Define the sql query parameters and a sql query string. /// /// 2. Execute the sql query string with parameters and store the results on data table. /// /// 3. Iterate through the table and extract data row to the formfield data object. /// /// 4. Add the object values to the Formfield list. /// /// 5. Return the FormFields list. /// </remarks> // ------------------------------------------------------------------------------------- public List <EdRecordSection> getSectionList(Guid FormGuid) { this.LogMethod("GetView method"); this.LogDebug("FormGuid: " + FormGuid); // // Initialize the debug log and a return list of formfield // List <EdRecordSection> sectionList = new List <EdRecordSection> ( ); // // Define the SQL query parameters. // SqlParameter [] cmdParms = new SqlParameter [] { new SqlParameter(PARM_FORM_GUID, SqlDbType.UniqueIdentifier), }; cmdParms [0].Value = FormGuid; // // Define the query string. // _sqlQueryString = _sqlQueryView + " WHERE ( " + DB_LAYOUT_GUID + " = " + PARM_FORM_GUID + ") " + "ORDER BY " + DB_ORDER + "; "; this.LogDebug(_sqlQueryString); // // Scroll through the results // using (DataTable table = EvSqlMethods.RunQuery(_sqlQueryString, cmdParms)) { // // Iterate through the results extracting the role information. // for (int count = 0; count < table.Rows.Count; count++) { // // Extract the table row // DataRow row = table.Rows [count]; EdRecordSection section = this.getRowData(row); section.Order = count * 2 + 1; sectionList.Add(section); } } this.LogDebug("Count: " + sectionList.Count.ToString( )); // // Pass back the result arrray. // return(sectionList); }//END GetView method.
} // 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.
}//END getItem class // ===================================================================================== /// <summary> /// This class gets Menus data object by its object identifier. /// </summary> /// <param name="Title">string: a name menu item</param> /// <returns>EvMenuItem: a menu item</returns> /// <remarks> /// This method consists of the following steps: /// /// 1. Return an empty MenuItem object, if the Name is empty /// /// 2. Define the SQL query parameters and a query string. /// /// 3. Execute the query string and store the results on datatable. /// /// 4. Return an empty MenuItem object if the table has no value. /// /// 5. Else, Extract the table row to the MenuItem object. /// /// 6. Return the MenuItem object. /// /// </remarks> // ------------------------------------------------------------------------------------- public Evado.Digital.Model.EvMenuItem getItem(string Title) { this.LogMethod("getItem"); this.LogDebug("Title: " + Title); // // Initialize a debug log and a menu item object // Evado.Digital.Model.EvMenuItem menuItem = new Evado.Digital.Model.EvMenuItem( ); // // Check that there is a valid name. // if (Title == String.Empty) { return(menuItem); } // // Define the query parameters. // SqlParameter cmdParms = new SqlParameter(PARM_TITLE, SqlDbType.NVarChar, 20); cmdParms.Value = Title; // // Define the query string. // _sqlQueryString = _sqlQuery_View + " WHERE (Mnu_Title = @Title ); "; // // Execute the query against the database. // using (DataTable table = EvSqlMethods.RunQuery(_sqlQueryString, cmdParms)) { // // If not rows the return // if (table.Rows.Count == 0) { return(menuItem); } // // Extract the table row // DataRow row = table.Rows [0]; // // Process the results. // menuItem = this.getRowData(row); }//END Using statement return(menuItem); }// Close method getMenus.
}//END getRecord method // ===================================================================================== /// <summary> /// This method retrieves the SubjectRecord data table based on RecordId /// </summary> /// <param name="RecordId">string: A Record identifier</param> /// <returns>An object containing an EvSubjectRecord object.</returns> /// <returns>EvSubjectRecord: A Subject data object</returns> /// <remarks> /// This method consists of following steps: /// /// 1. Return an empty SubjectRecord object, if the RecordId is empty. /// /// 2. Define the sql query parameters and sql query string. /// /// 3. Execute the sql query string and store the results on datatable. /// /// 4. Return an empty SubjectRecord object, if the table has no value. /// /// 5. Else, extract the first data row to the SubjectRecord object. /// /// 6. Return the SubjectRecord object. /// </remarks> // ---------------------------------------------------------------------------------- public EvAncillaryRecord getRecord(string RecordId) { this.LogMethod("getRecord"); this.LogValue(" RecordId: " + RecordId); // // Define the object. // EvAncillaryRecord record = new EvAncillaryRecord( ); // // If Record does not exist, return an object containing EvSubjectRecord object. // if (RecordId == String.Empty) { return(record); } // // Define the parameters for the query // SqlParameter cmdParms = new SqlParameter(PARM_RecordId, SqlDbType.NVarChar, 17); cmdParms.Value = RecordId; _sqlQueryString = _sqlQuery_View + " WHERE ( RecordId = @RecordId );"; // // Execute the query against the database. // using (DataTable table = EvSqlMethods.RunQuery(_sqlQueryString, cmdParms)) { // // If not rows the return, an object containing EvSubjectRecord object. // if (table.Rows.Count == 0) { return(record); } // // Extract the table row // DataRow row = table.Rows [0]; // // Fill the EvSubjectRecord object. // record = this.readRowData(row); }//END Using statement // // Return an object containing an EvSubjectRecord object. // return(record); }//END getRecord method
}//END getView method. #endregion #region Get Event section // ===================================================================================== /// <summary> /// This class gets ApplicationEvent data object by its unique object identifier. /// </summary> /// <param name="EventGuid">String: (Mandatory) Unique identifier.</param> /// <returns>ApplicationEvent: an item of application event</returns> /// <remarks> /// This method consists of the following steps: /// /// 1. Initialize a status string and an application event object /// /// 2. Validate whether the Unique identifier is not zero /// /// 3. Define the query parameters and the query string /// /// 4. Execute the query string /// /// 5. Convert the value from data reader event object to application event business object, /// if value exists /// /// 6. Return the application event value /// </remarks> // ------------------------------------------------------------------------------------- public EvApplicationEvent getItem( Guid EventGuid) { this.LogMethod("getItem method. "); this.LogDebugValue("EventGuid: " + EventGuid); // // Initialize a status string and an application event object // EvApplicationEvent applicationEvent = new EvApplicationEvent( ); // // Check that there is a valid unique identifier. // if (EventGuid == Guid.Empty) { return(applicationEvent); } // // Define the query parameters. // SqlParameter cmdParms = new SqlParameter(PARM_GUID, SqlDbType.UniqueIdentifier); cmdParms.Value = EventGuid; // // Define the query string. // _sqlQueryString = _sqlQuery_View + " WHERE (" + DB_GUID + " = " + PARM_GUID + " ); "; using (DataTable table = EvSqlMethods.RunQuery(_sqlQueryString, cmdParms)) { // // If not rows the return // if (table.Rows.Count == 0) { return(applicationEvent); } // // Extract the table row and store the data row to an activity object // DataRow row = table.Rows [0]; applicationEvent = this.getReaderData(row); } // // Pass back the data object. // return(applicationEvent); }//END getItem class
}//End readRow method. #endregion #region List Queries section // ===================================================================================== /// <summary> /// This class returns a list of organization data object based on the passed parameters. /// </summary> /// <param name="Type">EvOrganisation.OrganisationTypes: the organisation type.</param> /// <returns>List of EvOrganisation: a list of organization data object</returns> /// <remarks> /// This method consists of the following steps: /// /// 1. Set the IsTrue string to 0, if the selection type is not selected. /// /// 2. Define the sql query string and execute the sql query string to a datatable /// /// 3. Loop through the table and extract the row data to the organization object. /// /// 4. Add the organization object value to the Organizations list. /// /// 5. Return the organizations list. /// </remarks> // ------------------------------------------------------------------------------------- public int getOrganisationCount ( String Type ) { // // Initialize the method status, a return organization list and an IsTrue string value // this.LogMethod ( "getOrganisationCount method. " ); this.LogDebug ( "Type: " + Type ); // // Initialise the methods variables and objects. // int OrgCount = 0; // // Define the SQL query parameters and load the query values. // SqlParameter [ ] cmdParms = new SqlParameter [ ] { new SqlParameter ( EdOrganisations.PARM_ORG_TYPE, SqlDbType.NVarChar, 50 ) }; cmdParms [ 0 ].Value = Type; // // Create the sql query string. // sqlQueryString = SQL_SELECT_QUERY + "WHERE (" + EdOrganisations.DB_DELETED + " = 0) "; if ( Type != String.Empty ) { sqlQueryString += " AND (" + EdOrganisations.DB_ORG_TYPE + " = " + EdOrganisations.PARM_ORG_TYPE + ") "; } sqlQueryString += " ORDER BY " + EdOrganisations.DB_ORG_ID + ";"; this.LogDebug ( sqlQueryString ); // // Execute the query against the database // using ( DataTable table = EvSqlMethods.RunQuery ( sqlQueryString, cmdParms ) ) { OrgCount = table.Rows.Count; } // // Return the arraylist of organisations. // this.LogMethodEnd ( "getOrganisationCount" ); return OrgCount; }//End getOrganisationCount method.
}//End getOrganisationCount method. // ===================================================================================== /// <summary> /// This class returns a list of organization data object based on the passed parameters. /// </summary> /// <param name="Type">EvOrganisation.OrganisationTypes: the organisation type.</param> /// <returns>List of EvOrganisation: a list of organization data object</returns> /// <remarks> /// This method consists of the following steps: /// /// 1. Set the IsTrue string to 0, if the selection type is not selected. /// /// 2. Define the sql query string and execute the sql query string to a datatable /// /// 3. Loop through the table and extract the row data to the organization object. /// /// 4. Add the organization object value to the Organizations list. /// /// 5. Return the organizations list. /// </remarks> // ------------------------------------------------------------------------------------- public List<EdOrganisation> getOrganisationList ( String Type ) { // // Initialize the method status, a return organization list and an IsTrue string value // this.LogMethod ( "getView method. " ); this.LogDebug ( "Type: " + Type ); // // Initialise the methods variables and objects. // List<EdOrganisation> organisationList = new List<EdOrganisation> ( ); // // Define the SQL query parameters and load the query values. // SqlParameter [ ] cmdParms = new SqlParameter [ ] { new SqlParameter ( EdOrganisations.PARM_ORG_TYPE, SqlDbType.NVarChar, 50 ) }; cmdParms [ 0 ].Value = Type; // // Create the sql query string. // sqlQueryString = SQL_SELECT_QUERY + "WHERE (" + EdOrganisations.DB_DELETED + " = 0) "; if ( Type != String.Empty ) { sqlQueryString += " AND (" + EdOrganisations.DB_ORG_TYPE + " = " + EdOrganisations.PARM_ORG_TYPE + ") "; } sqlQueryString += " ORDER BY " + EdOrganisations.DB_ORG_ID + ";"; this.LogDebug ( sqlQueryString ); // // Execute the query against the database // using ( DataTable table = EvSqlMethods.RunQuery ( sqlQueryString, cmdParms ) ) { // // Iterate through the results extracting the role information. // for ( int Count = 0; Count < table.Rows.Count; Count++ ) { // // Extract the table row // DataRow row = table.Rows [ Count ]; EdOrganisation organisation = this.readQueryRow ( row ); organisationList.Add ( organisation ); } } this.LogDebug ( " View Count: " + organisationList.Count ); // // Return the arraylist of organisations. // this.LogMethodEnd ( "getView" ); return organisationList; }//End getView method.
}//END processNotAvailableValues method #endregion #region Record field list Queries // ===================================================================================== /// <summary> /// This class returns a list of formfield object retrieved by the record Guid. /// </summary> /// <param name="Record">EvForm: (Mandatory) The record object.</param> /// <param name="IncludeComments">bool: true = include field comments.</param> /// <returns>List of EvFormField: a formfield object.</returns> /// <remarks> /// This method consists of the following steps: /// /// 1. Return an empty formfield object if the record's Guid is empty /// /// 2. Define the sql query parameters and sql query string /// /// 3. Execute the sql query string with parameters and store the results on data table. /// /// 4. Iterate through the table and extract the data row to the formfield object. /// /// 5. Add object result to the formfields list. /// /// 6. Return the formfields list. /// </remarks> // ------------------------------------------------------------------------------------- public List <EdRecordField> getRecordFieldList( EdRecord Record) { this.LogMethod("getRecordFieldList method. "); this.LogDebug("Record.Guid: " + Record.Guid); // // Initialise the methods variables and objects. // List <EdRecordField> recordFieldList = new List <EdRecordField> ( ); EdRecordField recordField = new EdRecordField( ); Guid previousValueGuid = Guid.Empty; // // Validate whether the record Guid is not empty. // if (Record.Guid == Guid.Empty) { return(recordFieldList); } // // Define the SQL query parameters. // SqlParameter [] cmdParms = new SqlParameter [] { new SqlParameter(PARM_RECORD_GUID, SqlDbType.UniqueIdentifier), }; cmdParms [0].Value = Record.Guid; // // Define the query string. // _Sql_QueryString = SQL_QUERY_VALUES_VIEW + " WHERE ( " + EdRecordValues.DB_RECORD_GUID + " =" + EdRecordValues.PARM_RECORD_GUID + ") " + "ORDER BY " + EdRecordFields.DB_ORDER + "; "; this.LogDebug(_Sql_QueryString); // // Execute the query against the database. // using (DataTable table = EvSqlMethods.RunQuery(_Sql_QueryString, cmdParms)) { if (table.Rows.Count == 0) { return(recordFieldList); } // // Iterate through the results extracting the role information. // for (int count = 0; count < table.Rows.Count; count++) { // // Extract the table row // DataRow row = table.Rows [count]; Guid recordValueGuid = EvSqlMethods.getGuid(row, EdRecordValues.DB_VALUES_GUID); this.LogDebug("previousValueGuid: {0}, recordValueGuid: {1}.", previousValueGuid, recordValueGuid); // // Empty fields are skipped. // if (recordValueGuid == Guid.Empty) { this.LogDebug("Skip the value Guid is empty."); continue; } // If the field guid has changed then it is a new field. // So add the previous field then get the data for the new field. // if (previousValueGuid != recordValueGuid) { this.LogDebug("Change of recordValueGuid."); // // Add the last field to the list. // if (recordField.Guid != Guid.Empty) { this.LogDebug("Add field to record field list."); recordFieldList.Add(recordField); } // // Get the object data from the row. // recordField = this.getRowData(row); // // skip all non summary field if summary fields is selected. // if (Record.Design.LinkContentSetting != EdRecord.LinkContentSetting.First_Text_Field && Record.SelectOnlySummaryFields == true && recordField.Design.IsSummaryField == false) { this.LogDebug("{0} is a summary field so SKIPPED.", recordField.FieldId); continue; } // // skip all non summary field if summary fields is selected. // if (Record.Design.LinkContentSetting != EdRecord.LinkContentSetting.First_Text_Field && count > 1) { this.LogDebug("{0} first field retrieved so SKIPPED.", recordField.FieldId); continue; } // // Update the lst field guid to enable the other field values to be collected. // previousValueGuid = recordField.Guid; }//END create new field object. this.LogDebug("Read in value data."); switch (recordField.TypeId) { case Evado.Model.EvDataTypes.Special_Matrix: case Evado.Model.EvDataTypes.Table: { this.getTableCellValue(row, recordField); break; } case Evado.Model.EvDataTypes.Check_Box_List: { this.getCheckBoxValue(row, recordField); break; } case Evado.Model.EvDataTypes.Numeric: { recordField.ItemValue = EvSqlMethods.getString(row, EdRecordValues.DB_VALUES_NUMERIC); this.LogDebug("recordField.ItemValue: {0}.", recordField.ItemValue); break; } case Evado.Model.EvDataTypes.Boolean: case Evado.Model.EvDataTypes.Yes_No: { bool bValue = EvSqlMethods.getBool(row, EdRecordValues.DB_VALUES_NUMERIC); this.LogDebug("bValue: {0}.", bValue); recordField.ItemValue = "No"; if (bValue == true) { recordField.ItemValue = "Yes"; } this.LogDebug("recordField.ItemValue: {0} bool.", recordField.ItemValue); break; } case Evado.Model.EvDataTypes.Date: { var dtValue = EvSqlMethods.getDateTime(row, EdRecordValues.DB_VALUES_DATE); recordField.ItemValue = EvStatics.getDateAsString(dtValue); this.LogDebug("recordField.ItemValue: {0}.", recordField.ItemValue); break; } case Evado.Model.EvDataTypes.Free_Text: { recordField.ItemText = EvSqlMethods.getString(row, EdRecordValues.DB_VALUES_TEXT); this.LogDebug("recordField.ItemValue: {0}.", recordField.ItemText); break; } default: { if (recordField.isReadOnly == true) { break; } recordField.ItemValue = EvSqlMethods.getString(row, EdRecordValues.DB_VALUES_STRING); this.LogDebug("recordField.ItemValue: {0}.", recordField.ItemValue); break; } } } //ENR record iteration loop. } //ENd using statement // // Add the last field to the list. // if (recordField.Guid != Guid.Empty) { recordFieldList.Add(recordField); } // // Return the formfields list. // return(recordFieldList); }//END getRecordFieldList 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 readRow method. #endregion #region Class list and queries methods // ===================================================================================== /// <summary> /// This class returns a list of form record comments object retrieved by passed parameters. /// </summary> /// <param name="RecordGuid">Guid: The record guid identifier</param> /// <param name="RecordFieldGuid">Guid: The record field guid identifier</param> /// <param name="CommentType">EvFormRecordComment.CommentTypeCodes: Comment type setting</param> /// <param name="AuthorType"> EvFormRecordComment.AuthorTypeCodes: Author type seting</param> /// <returns>List of EvFormRecordComment: a list of form record comment.</returns> /// <remarks> /// This method consists of the following steps: /// /// 1. Reset the record field guid to empty for all form coments. /// /// 2. Define the sql query parameters and sql query string. /// /// 3. Execute the sql query string and store the results on data table. /// /// 4. Iterate through the data table and extract the data row to the comment object. /// /// 5. Add the object values to the Form Record Comment list. /// /// 6. Return the Form Record Comment List. /// </remarks> // ------------------------------------------------------------------------------------- public List <EdFormRecordComment> getCommentList( Guid RecordGuid, Guid RecordFieldGuid, EdFormRecordComment.CommentTypeCodes CommentType, EdFormRecordComment.AuthorTypeCodes AuthorType) { this.LogMethod("getCommentList method. "); //this.LogDebugValue ( "RecordGuid: " + RecordGuid ); //this.LogDebugValue ( "RecordFieldGuid: " + RecordFieldGuid ); //this.LogDebugValue ( "CommentType: " + CommentType ); //this.LogDebugValue ( "AuthorType: " + AuthorType ); // // Initialzie the method debug log, local sql query string and the return list of comment object. // string sqlQueryString; List <EdFormRecordComment> view = new List <EdFormRecordComment> ( ); // // Reset the record field guid to empty for all form coments. // if (CommentType == EdFormRecordComment.CommentTypeCodes.Form || CommentType == EdFormRecordComment.CommentTypeCodes.Subject) { RecordFieldGuid = Guid.Empty; } // // Define the SQL query parameters and load the query values. // SqlParameter [] cmdParms = new SqlParameter [] { new SqlParameter(_parmRecordGuid, SqlDbType.UniqueIdentifier), new SqlParameter(_parmRecordFieldGuid, SqlDbType.UniqueIdentifier), new SqlParameter(_parmCommentType, SqlDbType.NVarChar, 10), new SqlParameter(_parmAuthorType, SqlDbType.NVarChar, 10), }; cmdParms [0].Value = RecordGuid; cmdParms [1].Value = RecordFieldGuid; cmdParms [2].Value = CommentType; cmdParms [3].Value = AuthorType; // // Generate the SQL query string // sqlQueryString = _sqlQuery_View + "WHERE FRC_RECORD_GUID = " + _parmRecordGuid; if (RecordFieldGuid != Guid.Empty) { sqlQueryString += " AND FRC_RECORD_FIELD_GUID = " + _parmRecordFieldGuid; } if (CommentType != EdFormRecordComment.CommentTypeCodes.Not_Set) { sqlQueryString += " AND FRC_COMMENT_TYPE = " + _parmCommentType; } if (AuthorType != EdFormRecordComment.AuthorTypeCodes.Not_Set) { sqlQueryString += " AND FRC_AUTHOR_TYPE = " + _parmAuthorType; } sqlQueryString += " ORDER BY FRC_COMMENT_DATE; "; //this.LogDebugValue( sqlQueryString ); // // Execute the query against the database // using (DataTable table = EvSqlMethods.RunQuery(sqlQueryString, cmdParms)) { // // Iterate through the results extracting the role information. // for (int Count = 0; Count < table.Rows.Count; Count++) { // // Extract the table row // DataRow row = table.Rows [Count]; EdFormRecordComment BinaryFile = this.readDataRow(row); view.Add(BinaryFile); } //END interation loop. } //END using method this.LogDebug("View count: " + view.Count.ToString( )); this.LogMethodEnd("getCommentList."); // // Return the list containing the User data object. // return(view); }//END getCommentList method.
}//END readDataRow method. #endregion #region SelectionList Queries // ===================================================================================== /// <summary> /// This class returns the list of formfield selectionlist object using state and orderBy values /// </summary> /// <param name="State">EvFormFieldSelectionList.SelectionListStates: an enumeration state</param> /// <returns>List of EvFormFieldSelectionList: a list of formfield selectionlist object</returns> /// <remarks> /// This method consists of the following steps: /// /// 1. Define the sql query parameter and sql query string /// /// 2. Execute the sql query string with parameters and store the results on datatable. /// /// 3. Iterate through the table and extract datarow to the formfield selectionlist object /// /// 4. Add the object values to the Formfield selection list. /// /// 5. Return the Formfield selection list. /// </remarks> // --------------------------------------------------------------------------------- public List <EdPageLayout> getView( EdPageLayout.States State) { // // Initialize the method status and a return list of formfield selectionlist object // this.LogMethod("getView method."); this._Log.AppendLine("State: " + State); List <EdPageLayout> view = new List <EdPageLayout> ( ); String sqlQueryString = String.Empty; // // Define the sql query parameter and load the query values. // SqlParameter [] cmdParms = new SqlParameter [] { new SqlParameter(EdPageLayouts.PARM_STATE, SqlDbType.VarChar, 20) }; cmdParms [0].Value = State.ToString( ); // // Define the sql query string. // sqlQueryString = SQL_VIEW_QUERY; if (State != EdPageLayout.States.Null) { sqlQueryString += " WHERE ( " + EdPageLayouts.DB_STATE + " = " + EdPageLayouts.PARM_STATE + " ) " + " AND (" + EdPageLayouts.DB_DELETED + " = 0) " + " ORDER BY " + EdPageLayouts.DB_PAGE_ID + ";"; } else { sqlQueryString += " WHERE ( " + EdPageLayouts.DB_STATE + " <> '" + EdPageLayout.States.Withdrawn + "' ) " + " AND (" + EdPageLayouts.DB_DELETED + " = 0) " + " ORDER BY " + EdPageLayouts.DB_PAGE_ID + ";"; } this.LogDebug("SQL Query: " + sqlQueryString); // // Execute the query against the database // using (DataTable table = EvSqlMethods.RunQuery(sqlQueryString, cmdParms)) { // // Iterate through the results extracting the role information. // for (int Count = 0; Count < table.Rows.Count; Count++) { // // Extract the table row // DataRow row = table.Rows [Count]; EdPageLayout pageLayout = this.readDataRow(row); // // retrieve the parameter object values. // pageLayout.Parameters = this.LoadObjectParameters(pageLayout.Guid); // // Append the value to the visit // view.Add(pageLayout); } //END interation loop. } //END using statement this.LogDebug(" view count: " + view.Count.ToString( )); // // return the Array object. // return(view); }// END getView method.
}// End readDataRow method. #endregion #region Class Query method section // ================================================================================== /// <summary> /// This class gets a List containing a selectionList of ApplicationEvent data objects. /// </summary> /// <param name="Version">EvDataBaseUpdate.UpdateVersionList: A sorting order of the list</param> /// <param name="OrderBy">EvDataBaseUpdate.DataBaseUpdateOrderBy: The sorting order enumeration.</param> /// <returns>List of EvDataBaseUpdate: a view of database update list</returns> /// <remarks> /// This method consists of the following steps: /// /// 1. Initialize a status string and a return view of database update list. /// /// 2. Define the query string. /// /// 3. Execute the query against the database. /// /// 4. Iterate through the results extracting the role information. /// /// 5. Extract the table row /// /// 6. Append the value to the visit /// /// 7. Return the view /// </remarks> // ---------------------------------------------------------------------------------- public List <EvDataBaseUpdate> getUpdateList( EvDataBaseUpdate.UpdateVersionList Version, EvDataBaseUpdate.UpdateOrderBy OrderBy) { // // Initialize a status string and a return database update view list. // this.LogMethod("getUpdateList method. "); this.LogDebug("Version: " + Version); this.LogDebug("OrderBy: " + OrderBy); List <EvDataBaseUpdate> view = new List <EvDataBaseUpdate> ( ); // // Define the query string. // string sqlQueryString = _sqlQuery_View; switch (Version) { case EvDataBaseUpdate.UpdateVersionList.Version_2: { sqlQueryString += "WHERE DBU_Version LIKE '%R2%' \r\n"; break; } case EvDataBaseUpdate.UpdateVersionList.Version_3: { sqlQueryString += "WHERE DBU_Version LIKE '%R3%' \r\n"; break; } case EvDataBaseUpdate.UpdateVersionList.Version_4: { sqlQueryString += "WHERE DBU_Version LIKE '%R4%' \r\n"; break; } case EvDataBaseUpdate.UpdateVersionList.Version_4_1: { sqlQueryString += "WHERE DBU_Version LIKE '%R4.1%' \r\n"; break; } case EvDataBaseUpdate.UpdateVersionList.Version_4_2: { sqlQueryString += "WHERE DBU_Version LIKE '%R4.2%' \r\n"; break; } case EvDataBaseUpdate.UpdateVersionList.Version_4_3: { sqlQueryString += "WHERE DBU_Version LIKE '%R4.3%' \r\n"; break; } case EvDataBaseUpdate.UpdateVersionList.Version_4_4: { sqlQueryString += "WHERE DBU_Version LIKE '%R4.4%' \r\n"; break; } case EvDataBaseUpdate.UpdateVersionList.Version_4_5: { sqlQueryString += "WHERE DBU_Version LIKE '%R4.5%' \r\n"; break; } case EvDataBaseUpdate.UpdateVersionList.Version_4_6: { sqlQueryString += "WHERE DBU_Version LIKE '%R4.6%' \r\n"; break; } case EvDataBaseUpdate.UpdateVersionList.Version_4_7: { sqlQueryString += "WHERE DBU_Version LIKE '%R4.7%' \r\n"; break; } case EvDataBaseUpdate.UpdateVersionList.Version_4_8: { sqlQueryString += "WHERE DBU_Version LIKE '%R4.8%' \r\n"; break; } case EvDataBaseUpdate.UpdateVersionList.Version_5: { sqlQueryString += "WHERE DBU_Version LIKE '%R5%' \r\n"; break; } case EvDataBaseUpdate.UpdateVersionList.Version_6: { sqlQueryString += "WHERE DBU_Version LIKE '%R6%' \r\n"; break; } case EvDataBaseUpdate.UpdateVersionList.Version_7: { sqlQueryString += "WHERE DBU_Version LIKE '%R7%' \r\n"; break; } } switch (OrderBy) { case EvDataBaseUpdate.UpdateOrderBy.Date: { sqlQueryString += " ORDER BY DBU_Update_Date, DBU_Update_No ;"; break; } case EvDataBaseUpdate.UpdateOrderBy.Version: { sqlQueryString += " ORDER BY DBU_Version, DBU_Update_Date ;"; break; } default: { sqlQueryString += " ORDER BY DBU_Update_No ;"; break; } } this.LogDebug(sqlQueryString); // // Execute the query against the database. // using (DataTable table = EvSqlMethods.RunQuery(sqlQueryString, null)) { // // Iterate through the results extracting the role information. // for (int Count = 0; Count < table.Rows.Count; Count++) { // // Extract the table row // DataRow row = table.Rows [Count]; EvDataBaseUpdate update = this.readDataRow(row); // // Append the value to the visit // view.Add(update); } //END interation loop. } //END Using statement // // Pass back the result arrray. // return(view); }//END getView method.
}//END getRecord method // ===================================================================================== /// <summary> /// This method retrieves the SubjectRecord data table based on RecordId and state value. /// </summary> /// <param name="RecordId">string: A Record identifier</param> /// <param name="State">string: a milestone record's state</param> /// <returns>An object containing an EvSubjectRecord object.</returns> /// <returns>EvSubjectRecord: A Subject data object</returns> /// <remarks> /// This method consists of following steps: /// /// 1. Return an empty SubjectRecord object, if the RecordId is empty. /// /// 2. Define the sql query parameters and sql query string. /// /// 3. Execute the sql query string and store the results on datatable. /// /// 4. Return an empty SubjectRecord object, if the table has no value. /// /// 5. Else, extract the first data row to the SubjectRecord object. /// /// 6. Return the SubjectRecord object. /// </remarks> // ---------------------------------------------------------------------------------- public EvAncillaryRecord getRecord(string RecordId, string State) { this.LogMethod("getRecord"); this.LogValue("RecordId: " + RecordId); this.LogValue("State: " + State); // // Define the local variables. // EvAncillaryRecord record = new EvAncillaryRecord( ); // // If Record does not exist, return an object containing EvSubjectRecord object. // if (RecordId == String.Empty) { return(record); } // // Define the parameters for the query. // SqlParameter [] cmdParms = new SqlParameter [] { new SqlParameter(PARM_RecordId, SqlDbType.NVarChar, 20), new SqlParameter(PARM_State, SqlDbType.Char, 5), }; cmdParms [0].Value = RecordId; cmdParms [1].Value = State; _sqlQueryString = _sqlQuery_View + " WHERE ( RecordId = @RecordId )" + " AND ( TSR_State = @State );"; // // Execute the query against the database. // using (DataTable table = EvSqlMethods.RunQuery(_sqlQueryString, cmdParms)) { // // If no rows found, return an object containing an EvSubjectRecord object. // if (table.Rows.Count == 0) { return(record); } // // Extract the table row. // DataRow row = table.Rows [0]; // // Fill the EvSubjectRecord object. // record = this.readRowData(row); }//END Using statement // // Return an object containing an EvSubjectRecord object. // return(record); }//END getRecord method
}//END getView method. // ===================================================================================== /// <summary> /// This method returns a list of Subject Record object based on TrialId, SubjectId and useGuid condition /// </summary> /// <param name="ProjectId">String: A Project identifier</param> /// <param name="EntityId">String: A Subject identifier</param> /// <param name="useGuid">Boolean: true, if the Guid is used</param> /// <returns>List of EvOption: A list containing an Option object.</returns> /// <remarks> /// This method consists of following steps: /// /// 1. Define the sql query parameters and sql query string. /// /// 2. Execute the sql query string and store the results on datatable. /// /// 3. Loop through the table and extract the data row on Option object. /// /// 4. Add the Option object's values to the Options list. /// </remarks> // ---------------------------------------------------------------------------------- public List <EvOption> getList(string EntityId, bool useGuid) { this.LogMethod("getList, "); this.LogValue("SubjectId: " + EntityId); // // Define the local variables and objects. // List <EvOption> list = new List <EvOption>( ); EvOption option = new EvOption( ); // // If useGuid is equal to true, add option object to the list. // if (useGuid == true) { option = new EvOption(Guid.Empty.ToString( ), String.Empty); } list.Add(option); // // Define the query parameters. // SqlParameter [] cmdParms = new SqlParameter [] { new SqlParameter(PARM_SubjectId, SqlDbType.NVarChar, 20), }; cmdParms [0].Value = EntityId; // // Generate the SQL query string. // _sqlQueryString = _sqlQuery_View + " WHERE ( TrialId = @TrialId ) "; if (EntityId.Length > 0) { _sqlQueryString += " AND ( SubjectId = @SubjectId ) "; } _sqlQueryString += " ORDER BY RecordId"; //_Status = "\r\n" + sqlQueryString; // //Execute the query against the database. // using (DataTable table = EvSqlMethods.RunQuery(_sqlQueryString, cmdParms)) { // // Iterate through the table rows count list. // for (int count = 0; count < table.Rows.Count; count++) { // // Extract the table row. // DataRow row = table.Rows [count]; // // Process the query result. // if (useGuid == true) { option = new EvOption( EvSqlMethods.getString(row, "TSR_Guid"), EvSqlMethods.getString(row, "RecordId") + " - " + EvSqlMethods.getDateTime(row, "TSR_Subject")); } else { option = new EvOption( EvSqlMethods.getString(row, "RecordId"), EvSqlMethods.getString(row, "RecordId") + " - " + EvSqlMethods.getDateTime(row, "TSR_Subject")); } if (EntityId == String.Empty) { option.Description = "(" + EvSqlMethods.getString(row, "SubjectId") + ") " + option.Description; } // // Append the EvOption object to the list. // list.Add(option); } } // // Return a list containing an EvOption object. // return(list); }//END getList method.
} // Close getView method. // ================================================================================== /// <summary> /// This class gets a ArrayList containing a selectionList of Menus data identifiers. /// </summary> /// <param name="PlatformId">string: (Optional) The Site identifier.</param> /// <returns>List of Evado.Model.EvOption: a list of groups</returns> /// <remarks> /// This method consists of the following steps: /// /// 1. Define the SQL query parameters and a query string. /// /// 2. Execute the query and store the results on datatable. /// /// 3. Loop through the table and extract data row to the Option object. /// /// 4. Add Option object's values to the Options list. /// /// 5. Return the Option list. /// /// </remarks> // ---------------------------------------------------------------------------------- public List <Evado.Model.EvOption> getGroupList( String PlatformId) { this.LogMethod("getGroupList, "); this.LogDebug(" PlatformId: " + PlatformId); // // Initialize a debug log, a return list of options, an option object, site 1 and site 2 // List <Evado.Model.EvOption> List = new List <Evado.Model.EvOption> ( ); Evado.Model.EvOption option = new Evado.Model.EvOption( ); // // Define the SQL query parameters. // SqlParameter [] cmdParms = new SqlParameter [] { new SqlParameter(PARM_PLATFORM, SqlDbType.VarChar, 10), }; cmdParms [0].Value = PlatformId; // // Define the query string. // _sqlQueryString = _sqlQuery_View + " WHERE ( MNU_PLATFORM = @PLATFORM)" + " AND (MNU_GROUP_HEADER = 1) ORDER BY MNU_ORDER"; this.LogDebug(_sqlQueryString); // // Execute the query against the database. // using (DataTable table = EvSqlMethods.RunQuery(_sqlQueryString, cmdParms)) { // // Iterate through the results extracting the role information. // for (int Count = 0; Count < table.Rows.Count; Count++) { // // Extract the table row // DataRow row = table.Rows [Count]; // // Process the results into the visitSchedule. // String stGroup = EvSqlMethods.getString(row, "MNU_GROUP"); String stTitle = EvSqlMethods.getString(row, "MNU_TITLE"); // // if the group does not exist add it to the list. // if (GroupExists(List, stGroup) == false) { // // Append the new Menus object to the array. // List.Add(new Evado.Model.EvOption(stGroup, stTitle)); } } } // // Pass back the result arrray. // return(List); }//END getGroupList method.
}//END getRowData #endregion #region List Queries // ===================================================================================== /// <summary> /// This method returns a list of Subject record object based on TrialId, SubjectId, State and OrderBy value /// </summary> /// <param name="ProjectId">String: A Project identifier.</param> /// <param name="SubjectId">String: A Subject identifier</param> /// <param name="State">String: A string that defines the record state to the query.</param> /// <param name="OrderBy">String: A string that defines the sorting order of the result set.</param> /// <returns>List of EvSubjectRecord: A list containing SubjectRecord object.</returns> /// <remarks> /// This method consists of following steps. /// /// 1. Define the sql query parameters and sql query string. /// /// 2. Execute the sql query string and store the results on datatable. /// /// 3. Loop through the table and extract data row to the SubjectRecord object. /// /// 4. Add SubjectRecord object's values to the list of Subject Records /// </remarks> // ---------------------------------------------------------------------------------- public List <EvAncillaryRecord> getView(string ProjectId, string SubjectId, string State, string OrderBy) { this.LogMethod("getView, "); this.LogValue("ProjectId: " + ProjectId); this.LogValue("SubjectId: " + SubjectId); // // Define the local variable. // List <EvAncillaryRecord> view = new List <EvAncillaryRecord>( ); // // Define the query parameters. // SqlParameter [] cmdParms = new SqlParameter [] { new SqlParameter(PARM_TrialId, SqlDbType.NVarChar, 10), new SqlParameter(PARM_SubjectId, SqlDbType.NVarChar, 20), new SqlParameter(PARM_State, SqlDbType.VarChar, 20), }; cmdParms [0].Value = ProjectId; cmdParms [1].Value = SubjectId; cmdParms [2].Value = State; // // Generate the SQL query string. // _sqlQueryString = _sqlQuery_View + " WHERE ( ( TrialId = @TrialId ) "; if (SubjectId.Length > 0) { _sqlQueryString += " AND ( SubjectId = @SubjectId ) "; } if (State.Length > 0) { _sqlQueryString += " AND (TSR_State = @State) "; } if (OrderBy.Length == 0) { _sqlQueryString += ") ORDER BY RecordId"; } else { _sqlQueryString += ") ORDER BY " + OrderBy; } this.LogDebug(_sqlQueryString); // // Execute the query against the database. // using (DataTable table = EvSqlMethods.RunQuery(_sqlQueryString, cmdParms)) { // // Iterate through the results extracting the role information. // for (int count = 0; count < table.Rows.Count; count++) { // // Extract the table row. // DataRow row = table.Rows [count]; EvAncillaryRecord record = this.readRowData(row); view.Add(record); } //END count interation } //END Using statement // // Return a list containing an EvSubjectRecord object. // return(view); }//END getView method.
}//END getRowData method. // +++++++++++++++++++++++++++ END RECORD READER SECTION ++++++++++++++++++++++++++++++ #endregion #region DataChange Queries // ===================================================================================== /// <summary> /// This method queries the data changes for a record. /// </summary> /// <param name="RecordGuid">Guid: (Mandatory) Record global Unique identifier.</param> /// <param name="TableName">EvDataChange.DataChangeTableNames: (Mandatory) table name.</param> /// <returns>List of EvDataChange: a list of data change items</returns> /// <remarks> /// This method consists of the following steps: /// /// 1. Defines the sql query parameters and the sql query string. /// /// 2. Execute the sql query string with parameters and store the results on datatable. /// /// 3. Loop through the table and extract data row to the data change object. /// /// 4. Add the object to the Datachanges list. /// /// 5. Return the Datachanges list. /// </remarks> // ------------------------------------------------------------------------------------- public List <EvDataChange> GetView( Guid RecordGuid, EvDataChange.DataChangeTableNames TableName) { // // Initialize the status and the return data change list // this.LogMethod("GetView method. "); this.LogDebug("SiteGuid: " + EvDataChanges._SiteGuid); this.LogDebug("RecordGuid: " + RecordGuid); this.LogDebug("Record Type: " + TableName); List <EvDataChange> View = new List <EvDataChange> ( ); // // If the site guid is empty exit. // if (EvDataChanges._SiteGuid == Guid.Empty) { return(new List <EvDataChange> ( )); } // // Define the SQL query parameters. // SqlParameter [] cmdParms = new SqlParameter [] { new SqlParameter(_parmRecordGuid, SqlDbType.UniqueIdentifier), new SqlParameter(_parmTableName, SqlDbType.NVarChar, 50) }; cmdParms [0].Value = RecordGuid; cmdParms [1].Value = TableName.ToString( ); // // Define the query string. // _sqlQueryString = _sqlQueryView + " WHERE (DC_RecordGuid = @RecordGuid) " + " AND (DC_TableName = @TableName) " + " ORDER BY DC_DateStamp;"; this.LogClass(_sqlQueryString); // // Execute the query against the database. // using (DataTable table = EvSqlMethods.RunQuery(_sqlQueryString, cmdParms)) { // // Iterate through the results extracting the role information. // for (int Count = 0; Count < table.Rows.Count; Count++) { // // Extract the table row // DataRow row = table.Rows [Count]; // // Read the row data. // EvDataChange Item = this.getRowData(row); // // Append the new Change object to the array. // View.Add(Item); } //END record iteration loop. } //END Using statement this.LogDebug("Record Count: " + View.Count); // // Pass back the result arrray. // return(View); } // Close GetView method.
}// End readDataRow method. #endregion #region List and queries methods // ================================================================================== /// <summary> /// This method returns the list of activity records based on the activityGuid and OrderBy value. /// </summary> /// <param name="ObjectGuid">Guid: (Mandatory) The selection organistion's identifier</param> /// <returns>List of EvActivityForm: a list contains selected data objects.</returns> /// <remarks> /// This method consists of the following steps: /// /// 1. Define the SQL query parameters and the sql query string /// /// 2. Execute the sql query command and store the results on the data table. /// /// 3. Iterate through the result table and extract the data row to the Activity record object. /// /// 4. Add the Activity Record Object values to the Activity record list. /// /// 5. Update the numeric order of the Activity record list /// /// 6. Return the Activity Record List. /// </remarks> // ---------------------------------------------------------------------------------- public List <EvObjectParameter> getParameterList(Guid ObjectGuid) { this.LogMethod("getParameterList method. "); this.LogValue("ObjectGuid: " + ObjectGuid); // // Initialize the method status string, an sql query string and a return list of activity records // string sqlQueryString; List <EvObjectParameter> parameterList = new List <EvObjectParameter> ( ); // // Define the SQL query parameters and load the query values. // SqlParameter [] cmdParms = new SqlParameter [] { new SqlParameter(PARM_OBJECT_GUID, SqlDbType.UniqueIdentifier), }; cmdParms [0].Value = ObjectGuid; // // Generate the SQL query string // sqlQueryString = _sqlQuery_View + "WHERE OBJ_GUID = " + PARM_OBJECT_GUID + " ORDER BY OBP_ORDER; "; this.LogDebug(sqlQueryString); // // Execute the query against the database // using (DataTable table = EvSqlMethods.RunQuery(sqlQueryString, cmdParms)) { // // Iterate through the results extracting the role information. // for (int Count = 0; Count < table.Rows.Count; Count++) { // // Extract the table row // DataRow row = table.Rows [Count]; EvObjectParameter parameter = this.readDataRow(row); this.LogValue("parameter: " + parameter.Name + ", Selected: " + parameter.Value); parameterList.Add(parameter); } //END interation loop. } //END using method // // Update the numbering // for (int count = 0; count < parameterList.Count; count++) { ((EvObjectParameter)parameterList [count]).Order = count * 5 + 5; } this.LogValue("view count: " + parameterList.Count); // // Return the list containing the User data object. // return(parameterList); }//END getView method.
}//END getList method #endregion #region Get Organisation object section // ===================================================================================== /// <summary> /// This class retrieves an organization data table based on Organization Guid /// </summary> /// <param name="OrgGuid">Guid: Organisation object global unique identifier</param> /// <returns>EvOrganisation: an organisation data object</returns> /// <remarks> /// This method consists of the following steps: /// /// 1. Return an empty Organization object if the Guid is empty. /// /// 2. Define the sql query parameters and sql query string /// /// 3. Execute the sql query string and store the results on the datatable. /// /// 4. Extract the first row data to the organization object. /// /// 5. Return the organization data object. /// </remarks> // ------------------------------------------------------------------------------------- public EdOrganisation getItem ( Guid OrgGuid ) { // // Initialize the method status and a return organization object. // this.LogMethod ( "getItem method" ); this.LogDebug ( "OrgGuid: " + OrgGuid ); EdOrganisation organisation = new EdOrganisation ( ); // // Validate whether the Guid is not empty. // if ( OrgGuid == Guid.Empty ) { this.LogDebug ( "OrgGuid empty" ); this.LogMethodEnd ( "getItem" ); return organisation; } // // Define the SQL query parameters and load the query values. // SqlParameter [ ] cmdParms = new SqlParameter [ ] { new SqlParameter ( EdOrganisations.PARM_Guid, SqlDbType.UniqueIdentifier ) }; cmdParms [ 0 ].Value = OrgGuid; // // Construct the Sql query string. // sqlQueryString = SQL_SELECT_QUERY + "WHERE (" + EdOrganisations.DB_GUID + " = " + EdOrganisations.PARM_Guid + ") ; "; this.LogDebug ( sqlQueryString ); this.LogDebug ( EvSqlMethods.getParameterSqlText ( cmdParms ) ); // // Execute the query against the database // using ( DataTable table = EvSqlMethods.RunQuery ( sqlQueryString, cmdParms ) ) { // // If not rows the return // if ( table.Rows.Count == 0 ) { this.LogDebug ( "ROW NOT FOUND" ); this.LogMethodEnd ( "getItem" ); return organisation; } // // Extract the table row // DataRow row = table.Rows [ 0 ]; // // Fill the role object. // organisation = this.readQueryRow ( row ); // // if the use is not an Evado user and the organisation type is Evado // return an empty organisation object. // if ( organisation.OrgType == "Evado" && this.ClassParameters.UserProfile.hasEvadoAccess == false ) { organisation = new EdOrganisation ( ); } }//END Using // // Return Organisation. // this.LogMethodEnd ( "getItem" ); return organisation; }//END getItem method
}//END getView method. // ================================================================================== /// <summary> /// This class gets an list of last upload of versioned binary file objects. /// </summary> /// <param name="ProjectId">String: Project identifier (Mandatory)</param> /// <param name="GroupId">Stirng: FilingIndex Identifier (Mandatory)</param> /// <param name="SubGroupId">String: A sub group identifier</param> /// <param name="FileId">String: A file identifier</param> /// <returns>List of EvBinaryFileMetaData: a list contains binary file data objects.</returns> /// <remarks> /// This method consists of the following steps: /// /// 1. Define the sql query parameters and the sql query string /// /// 2. Execute the sql query string with parameters and store the values on datatable. /// /// 3. Iterate through the table and extract the row data to a binary file object. /// /// 4. Find the last instance of the file (with the highest version). /// /// 5. Add the object values to the return binary file meta data list. /// /// 6. Return the list of binary file meta data /// </remarks> // ---------------------------------------------------------------------------------- public List <EvBinaryFileMetaData> GetVersionedFileList( String GroupId, String SubGroupId, String FileId) { this.LogMethod("GetVersionedFileList method. "); // // Initialize a method debug status, a internal sql query string and a return list of binary file data objects. // StringBuilder sqlQueryString = new StringBuilder( ); List <EvBinaryFileMetaData> fileList = new List <EvBinaryFileMetaData> ( ); // // Define the SQL query parameters and load the query values. // SqlParameter [] cmdParms = new SqlParameter [] { new SqlParameter(EvBinaryFiles.PARM_GROUP_ID, SqlDbType.VarChar, 50), new SqlParameter(EvBinaryFiles.PARM_SUB_GROUP_ID, SqlDbType.VarChar, 50), new SqlParameter(EvBinaryFiles.PARM_FILE_ID, SqlDbType.VarChar, 100), }; cmdParms [0].Value = GroupId; cmdParms [1].Value = SubGroupId; cmdParms [2].Value = FileId; // // Generate the SQL query string // sqlQueryString.AppendLine(SQL_VIEW_QUERY); sqlQueryString.AppendLine("WHERE (" + EvBinaryFiles.DB_FILE_ID + " = " + EvBinaryFiles.PARM_FILE_ID + ") "); sqlQueryString.AppendLine(" AND (" + EvBinaryFiles.DB_FILE_EXISTS + " = 1 ) "); if (GroupId == String.Empty) { sqlQueryString.AppendLine(" AND (" + EvBinaryFiles.DB_GROUP_ID + " = '' ) "); } else { sqlQueryString.AppendLine(" AND (" + EvBinaryFiles.DB_GROUP_ID + " = " + EvBinaryFiles.PARM_GROUP_ID + ") "); } if (SubGroupId == String.Empty) { sqlQueryString.AppendLine(" AND (" + EvBinaryFiles.DB_SUB_GROUP_ID + " = '' ) "); } else { sqlQueryString.AppendLine(" AND (" + EvBinaryFiles.DB_SUB_GROUP_ID + " = " + EvBinaryFiles.PARM_SUB_GROUP_ID + ") "); } sqlQueryString.AppendLine("ORDER BY " + EvBinaryFiles.DB_VERSION + ", " + EvBinaryFiles.DB_UPDATED_DATE + " ; "); this.LogDebug(sqlQueryString.ToString( )); // // Execute the query against the database // using (DataTable table = EvSqlMethods.RunQuery(sqlQueryString.ToString( ), cmdParms)) { this.LogDebug("Rows.Count: " + table.Rows.Count); // // Iterate through the results extracting the role information. // for (int Count = 0; Count < table.Rows.Count; Count++) { // // Extract the table row // DataRow row = table.Rows [Count]; EvBinaryFileMetaData binaryFile = this.readDataRow(row); fileList.Add(binaryFile); } //END interation loop. } //END using method this.LogValue("fileList.Count: " + fileList.Count); // // Return the list containing the User data object. // this.LogMethodEnd("GetVersionedFileList"); return(fileList); }//END getVersionedView method.
}//END getItem method // ===================================================================================== /// <summary> /// This class retrieves an organization data table based on the organization identifier. /// </summary> /// <param name="OrgId">string: Organisation identifier</param> /// <returns>EvOrganisation: Organisation data object.s</returns> /// <remarks> /// This method consists of the following steps: /// /// 1. Return an empty Organization object if the OrgId is empty. /// /// 2. Define the sql query parameters and sql query string /// /// 3. Execute the sql query string and store the results on the datatable. /// /// 4. Extract the first row data to the organization object. /// /// 5. Return the Organization data object. /// </remarks> // ------------------------------------------------------------------------------------- public EdOrganisation getItem ( string OrgId ) { // // Initialize the method status and a return organization object. // this.LogMethod ( "getItem method" ); this.LogDebug ( "OrgId: " + OrgId ); // // Initialise the local variables // EdOrganisation organisation = new EdOrganisation ( ); // // Validate whether the organizationId is not empty // if ( OrgId == String.Empty ) { return organisation; } // // Define the SQL query parameters and load the query values. // SqlParameter [ ] cmdParms = new SqlParameter [ ] { new SqlParameter ( EdOrganisations.PARM_ORG_ID, SqlDbType.NVarChar, 10 ) }; cmdParms [ 0 ].Value = OrgId; // // Construct the Sql query string. // sqlQueryString = SQL_SELECT_QUERY + "WHERE ( " + EdOrganisations.DB_ORG_ID + " =" + EdOrganisations.PARM_ORG_ID + " ) ; "; 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 ) { this.LogDebug ( "No Rows returned" ); return organisation; } // // Extract the table row // DataRow row = table.Rows [ 0 ]; // // Fill the role object. // organisation = this.readQueryRow ( row ); // // if the use is not an Evado user and the organisation type is Evado // return an empty organisation object. // if ( organisation.OrgType =="Evado" && this.ClassParameters.UserProfile.hasEvadoAccess == false ) { organisation = new EdOrganisation ( ); } }//END Using // // Return Organisation. // this.LogMethodEnd ( "getItem" ); return organisation; }//END getItem method
}//END getRowData method. #endregion #region Query methods // ================================================================================== /// <summary> /// This class gets a List containing a EvMenutItem data objects. /// </summary> /// <param name="PlatformId">String: (Optional) The Site identifier.</param> /// <param name="Group">String: (Optional) The Group identifier.</param> /// <returns>List of Evado.Digital.Model.EvMenuItem : a view of menu item list</returns> /// <remarks> /// This method consists of the following steps: /// /// 1. Define the SQL query parameters and a query string. /// /// 2. Execute the query and store the results on datatable. /// /// 3. Loop through the table and extract data row to the MenuItem object. /// /// 4. Add MenuItem object's values to the MenuItem list. /// /// 5. Return the MenuItem list. /// /// </remarks> // ---------------------------------------------------------------------------------- public List <Evado.Digital.Model.EvMenuItem> getView( String PlatformId, String Group) { // // Initialize a debug log // this.LogMethod("getView method"); this.LogDebug("PlatformId: " + PlatformId); this.LogDebug("Group: " + Group); // // Initialize a return list of menu item, site 1 and site 2. // List <Evado.Digital.Model.EvMenuItem> view = new List <Evado.Digital.Model.EvMenuItem> ( ); // // Define the SQL query parameters. // SqlParameter [] cmdParms = new SqlParameter [] { new SqlParameter(PARM_PLATFORM, SqlDbType.VarChar, 10), new SqlParameter(PARM_GROUP, SqlDbType.NVarChar, 50), }; cmdParms [0].Value = PlatformId; cmdParms [1].Value = Group; // // Define the query string. // _sqlQueryString = _sqlQuery_View + " WHERE (MNU_PLATFORM = @PLATFORM)"; if (Group != String.Empty) { _sqlQueryString += " AND (Mnu_Group = @Group) "; } _sqlQueryString += " ORDER BY Mnu_Order"; this.LogDebug(_sqlQueryString); // // Execute the query against the database. // using (DataTable table = EvSqlMethods.RunQuery(_sqlQueryString, cmdParms)) { // // Iterate through the results extracting the role information. // for (int Count = 0; Count < table.Rows.Count; Count++) { // // Extract the table row // DataRow row = table.Rows [Count]; Evado.Digital.Model.EvMenuItem menu = this.getRowData(row); // // Append the value to the visit // view.Add(menu); } //END interation loop. } //END using method // // Update debug log with a view count number // this.LogDebug("view count: " + view.Count); // // Pass back the result arrray. // return(view); } // Close getView method.
}//END getReaderData method #endregion #region Retrieval Queries // ===================================================================================== /// <summary> /// This method retrieves the SiteProfile data table based on SiteId. /// </summary> /// <param name="ApplicationId">String: A site identifier.</param> /// <returns>EvSiteProfile: a Site Profile data object.</returns> /// <remarks> /// This method consisits of following steps. /// /// 1. Return an empty SiteProfile object, if the SiteId is not defined. /// /// 2. Define the sql query parameters and sql query string. /// /// 3. Execute the sql query string and store the results on data reader. /// /// 4. Return an empty SiteProfile object, if the data reader object has no value. /// /// 5. Else, extract the data reader values to the SiteProfile object. /// /// 6. Return a SiteProfile Object. /// </remarks> // ------------------------------------------------------------------------------------ public Evado.Digital.Model.EdAdapterSettings getItem(string ApplicationId) { this.LogMethod("getItem method. "); // // Define the local variables and objects. // Evado.Digital.Model.EdAdapterSettings adapterParameters = new Evado.Digital.Model.EdAdapterSettings( ); String sqlQueryString = String.Empty; // // Check that there is a valid unique identifier. // if (ApplicationId == String.Empty) { return(adapterParameters); } // // Define the query parameters. // SqlParameter cmdParms = new SqlParameter(EdAdapterConfig.PARM_APPLICATION_ID, SqlDbType.NVarChar, 1); cmdParms.Value = ApplicationId; // // Generate the query string. // sqlQueryString = EdAdapterConfig.SQL_ADAPTER_SETTINGS_QUERY + " WHERE (" + EdAdapterConfig.DB_FIELD_APPLICATION_ID + " = " + EdAdapterConfig.PARM_APPLICATION_ID + " ); "; this.LogDebug(sqlQueryString); // // Execute the query against the database. // using (DataTable table = EvSqlMethods.RunQuery(sqlQueryString, cmdParms)) { // // If the reader is null, retrieve from the site profile table // and add record to the application profile table. if (table.Rows.Count == 0) { return(adapterParameters); } // // Extract the table row // DataRow row = table.Rows [0]; adapterParameters = this.getReaderData(row); } adapterParameters.Parameters = this.LoadObjectParameters(adapterParameters.Guid); this.LogDebug("Parameter list count: " + adapterParameters.Parameters.Count); // // Return an object containing an EvSiteProfile data object. // this.LogMethodEnd("getItem"); return(adapterParameters); }//END getItemById method.
}//END SetParameters method. #endregion #region Class Query method section // ===================================================================================== /// <summary> /// This class gets a ArrayList containing a selectionList of ApplicationEvent data objects. /// </summary> /// <param name="EventId">int: The event identifier</param> /// <param name="EventType">String: The event type</param> /// <param name="Category">String: The event category</param> /// <param name="DateStart">DateTime: The period start date</param> /// <param name="DateFinish">DateTime: The period finish date</param> /// <param name="UserName">String: The user that raised the event</param> /// <returns>List of ApplicationEvent: a list of application event parameters</returns> /// <remarks> /// This method consists of the following steps: /// /// 1. Initialize a status string and a return view of the application event. /// /// 2. Format the started date and finished date and add them to the status string. /// /// 3. Define the sql query parameters and update them with the retrieving values /// /// 4. Define the sql query string and execute the query string /// /// 5. Scroll through the query result /// /// 6. Convert the result from a data reader event object to an application event business object /// /// 7. Appent the converted result to a return view. /// </remarks> // ------------------------------------------------------------------------------------- public List <EvApplicationEvent> getApplicationEventList( int EventId, String EventType, String Category, DateTime DateStart, DateTime DateFinish, String UserName) { this.LogMethod("getView method"); this.LogDebugValue("EventId: " + EventId); this.LogDebugValue("Type: " + EventType); this.LogDebugValue("Category: " + Category); this.LogDebugValue("DateStart: " + DateStart.ToString("dd MMM yy hh:mm")); this.LogDebugValue("DateFinish: " + DateFinish.ToString("dd MMM yy hh:mm")); this.LogDebugValue("UserName :"******"dd MMM yyyy") + " 00:00 AM"; DateStart = DateTime.Parse(stStartDate); } // // Set the finish date to default of one day // if (DateFinish == Evado.Model.EvStatics.CONST_DATE_NULL && DateStart > Evado.Digital.Model.EvcStatics.CONST_DATE_NULL) { DateFinish = DateStart.AddDays(1); } // // Format the finished date // String stDateFinish = DateFinish.ToString("dd MMM yyyy") + " 23:59 PM"; DateFinish = DateTime.Parse(stDateFinish); // // Add started date and finished date to the status string. // this.LogDebugValue("DateStart: " + DateStart.ToString("dd MMM yyyy HH:mm")); this.LogDebugValue("DateFinish: " + DateFinish.ToString("dd MMM yyyy HH:mm")); // // Define the SQL query parameters. // SqlParameter [] cmdParms = new SqlParameter [] { new SqlParameter(PARM_EVENT_ID, SqlDbType.SmallInt), new SqlParameter(PARM_EVENT_TYPE, SqlDbType.Char, 1), new SqlParameter(PARM_EVENT_CATEGORY, SqlDbType.NVarChar, 20), new SqlParameter(PARM_DATE_STATE, SqlDbType.DateTime), new SqlParameter(PARM_DATE_FINISH, SqlDbType.DateTime), new SqlParameter(PARM_USER_NAME, SqlDbType.NVarChar, 100), }; // // Update retrieving values to the sql query parameters. // cmdParms [0].Value = EventId; cmdParms [1].Value = EventType; cmdParms [2].Value = Category; cmdParms [3].Value = DateStart; cmdParms [4].Value = DateFinish; cmdParms [5].Value = UserName; // // Define the query string. // _sqlQueryString = _sqlQuery_View; if (EventId < 0) { _sqlQueryString += " WHERE (" + PARM_EVENT_ID + " = " + DB_EVENT_ID + " ) "; if (EventType != String.Empty) { _sqlQueryString += " AND (" + PARM_EVENT_TYPE + " = " + DB_EVENT_TYPE + ") "; } if (Category != String.Empty) { _sqlQueryString += " AND (" + PARM_EVENT_CATEGORY + " = " + DB_EVENT_CATEGORY + ") "; } if (UserName != String.Empty) { _sqlQueryString += " AND (" + PARM_USER_NAME + " = " + DB_USER_NAME + ") "; } if (DateStart > Evado.Digital.Model.EvcStatics.CONST_DATE_NULL) { _sqlQueryString += " AND (" + DB_DATE_TIME + " >= " + PARM_DATE_STATE + ") " + " AND (" + DB_DATE_TIME + " <= " + PARM_DATE_FINISH + ") "; } } else if (EventType != String.Empty) { _sqlQueryString += " WHERE (" + PARM_EVENT_TYPE + " = " + DB_EVENT_TYPE + ") "; if (UserName != String.Empty) { _sqlQueryString += " AND (" + PARM_USER_NAME + " = " + DB_USER_NAME + ") "; } if (DateStart > Evado.Digital.Model.EvcStatics.CONST_DATE_NULL) { _sqlQueryString += " AND (" + DB_DATE_TIME + " >= " + PARM_DATE_STATE + ") " + " AND (" + DB_DATE_TIME + " <= " + PARM_DATE_FINISH + ") "; } } else if (Category != String.Empty) { _sqlQueryString += " WHERE (" + PARM_EVENT_CATEGORY + " = " + DB_EVENT_CATEGORY + ") "; if (UserName != String.Empty) { _sqlQueryString += " AND (" + PARM_USER_NAME + " = " + DB_USER_NAME + ") "; } if (DateStart > Evado.Digital.Model.EvcStatics.CONST_DATE_NULL) { _sqlQueryString += " AND (" + DB_DATE_TIME + " >= " + PARM_DATE_STATE + ") " + " AND (" + DB_DATE_TIME + " <= " + PARM_DATE_FINISH + ") "; } } else { if (DateStart > Evado.Digital.Model.EvcStatics.CONST_DATE_NULL) { _sqlQueryString += " WHERE (" + DB_DATE_TIME + " >= " + PARM_DATE_STATE + ") " + " AND (" + DB_DATE_TIME + " <= " + PARM_DATE_FINISH + ") "; if (UserName != String.Empty) { _sqlQueryString += " AND (" + PARM_USER_NAME + " = " + DB_USER_NAME + ") "; } } else { _sqlQueryString += " WHERE (" + PARM_USER_NAME + " = " + DB_USER_NAME + ") "; } } _sqlQueryString += " ORDER BY " + DB_DATE_TIME + ";"; this.LogDebugValue(_sqlQueryString); //this.LogDebugValue ( EvSqlMethods.getParameters( cmdParms ) ); // // Execute the query against the database. // using (DataTable table = EvSqlMethods.RunQuery(_sqlQueryString, cmdParms)) { // // Iterate through the results table for extracting the role information. // for (int Count = 0; Count < table.Rows.Count; Count++) { DataRow row = table.Rows [Count]; EvApplicationEvent Event = this.getReaderData(row); Event.Uid = Count.ToString("00000");; applicationEventList.Add(Event); } //END record iteration loop. } //END using statement // // Pass back the result arrray. // return(applicationEventList); }//END getView method.
}//END updateItem class // ===================================================================================== /// <summary> /// This class adds new items to the formfield selection list table. /// </summary> /// <param name="Item">EvFormFieldSelectionList: a formfield selection list object</param> /// <returns>EvEventCodes: an event code for adding items</returns> /// <remarks> /// This method consists of the following steps: /// /// 1. Exit if the List's identifier is empty or duplicated /// /// 2. Create new DB row Guid /// /// 3. Define the sql query parameters and execute the sql storeprocedure for adding items. /// /// 4. Return the event code fore adding new items. /// </remarks> // ------------------------------------------------------------------------------------- public EvEventCodes addItem(EdPageLayout Item) { this.LogMethod("addItem method. "); this.LogDebug("ListId: '" + Item.PageId); this.LogDebug("Version: '" + Item.Version + "'"); String sqlQueryString = String.Empty; //---------------------- Check for duplicate TestReport identifiers. ------------------ // // Define the query parameters // SqlParameter [] cmdParms = new SqlParameter [] { new SqlParameter(EdPageLayouts.PARM_PAGE_ID, SqlDbType.NVarChar, 10), }; cmdParms [0].Value = Item.PageId; // // Generate the SQL query string // sqlQueryString = SQL_VIEW_QUERY + " WHERE (" + EdPageLayouts.DB_PAGE_ID + " = " + EdPageLayouts.PARM_PAGE_ID + ") " + " AND (" + EdPageLayouts.DB_DELETED + " = 0);"; this.LogDebug("Duplication SQL Query:" + sqlQueryString); // // Execute the query against the database // using (DataTable table = EvSqlMethods.RunQuery(sqlQueryString, cmdParms)) { // // If not rows the return // if (table.Rows.Count > 0) { this.LogDebug("Duplication list found."); return(EvEventCodes.Data_Duplicate_Id_Error); } } // // Create the Guid // Item.Guid = Guid.NewGuid( ); // // Define the query parameters // SqlParameter [] commandParameters = GetParameters( ); SetParameters(commandParameters, Item); //this.LogDebug( EvSqlMethods.getParameterSqlText( commandParameters ) ) ; // // Execute the update command. // if (EvSqlMethods.StoreProcUpdate(_STORED_PROCEDURE_AddItem, commandParameters) == 0) { return(EvEventCodes.Database_Record_Update_Error); } // // Return the event code for adding new items. // return(EvEventCodes.Ok); }//END addItem class
}//END EvFormFieldSelectionList method // ==================================================================================== /// <summary> /// This class retrieves the formfield selection list based on ListId and Issued condition /// </summary> /// <param name="ListId">string: the selection list identifier</param> /// <param name="Issued">Boolean: true, if the selection list is issued.</param> /// <returns>EvFormFieldSelectionList: a formfield selection list object</returns> /// <remarks> /// This method consists of the following steps: /// /// 1. Return an empty selection list if the list's identifier is empty. /// /// 2. Define the sql query string and sql query parameters. /// /// 3. Execute the sql query string and store the results on data table. /// /// 4. Extract the first row to the formfield selection list object. /// /// 5. Return the formfield selection list data object. /// </remarks> // --------------------------------------------------------------------------------- public EvSelectionList getItem( string ListId, bool Issued) { this.LogMethod("getItem, ListId = " + ListId); // // Initialise the local variables // EvSelectionList item = new EvSelectionList( ); String sqlQueryString = String.Empty; // // If the ListId is null then return empty Ethics object. // if (ListId == string.Empty) { return(item); } // // Initialise the query parameters. // SqlParameter [] cmdParms = new SqlParameter [] { new SqlParameter(EvSelectionLists.PARM_LIST_ID, SqlDbType.NVarChar, 10), }; cmdParms [0].Value = ListId; // // Generate the Selection query string. // sqlQueryString = SQL_VIEW_QUERY + " WHERE (" + EvSelectionLists.DB_LIST_ID + " = " + EvSelectionLists.PARM_LIST_ID + ") " + " AND (" + EvSelectionLists.DB_DELETED + " = 0 )"; if (Issued == true) { sqlQueryString += " AND (" + EvSelectionLists.DB_STATE + " = '" + EvSelectionList.SelectionListStates.Issued + "'); "; } 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(item); } // // Extract the table row // DataRow row = table.Rows [0]; item = this.readDataRow(row); }//END Using // // Return the TestReport data object. // return(item); }// END getItem method