}//END SetParameters class. #endregion #region ExternalSelectionList Reader // ===================================================================================== /// <summary> /// This class extracts the content of the reader to the formfield selectionlist object. /// </summary> /// <param name="Row">DataRow: a data Reader containing the query results</param> /// <returns>EvFormFieldSelectionList: a formfield selectionlist object</returns> /// <remarks> /// This method consists of the following steps: /// /// 1. Extract the compatible data row values to the formfield selectionlist object. /// /// 2. Return the Formfield selectionlist object. /// </remarks> // --------------------------------------------------------------------------------- private EvSelectionList readDataRow(DataRow Row) { // // Initialise the formfield selectionlist object. // EvSelectionList Item = new EvSelectionList( ); // // Extract the compatible data row values to the formfield selectionlist object items. // Item.Guid = EvSqlMethods.getGuid(Row, EvSelectionLists.DB_GUID); Item.ListId = EvSqlMethods.getString(Row, EvSelectionLists.DB_LIST_ID); Item.Title = EvSqlMethods.getString(Row, EvSelectionLists.DB_TITLE); Item.Description = EvSqlMethods.getString(Row, EvSelectionLists.DB_DESCRIPTION); Item.Version = EvSqlMethods.getInteger(Row, EvSelectionLists.DB_VERSION); string xmlCodeItem = EvSqlMethods.getString(Row, EvSelectionLists.DB_ITEM_LIST); if (xmlCodeItem != String.Empty) { Item.Items = Evado.Digital.Model.EvcStatics.DeserialiseObject <List <EvSelectionList.Item> > (xmlCodeItem); } Item.State = Evado.Model.EvStatics.parseEnumValue <EvSelectionList.SelectionListStates> ( EvSqlMethods.getString(Row, EvSelectionLists.DB_STATE)); Item.UpdatedByUserId = EvSqlMethods.getString(Row, EvSelectionLists.DB_UPDATED_BY_USER_ID); Item.UpdatedBy = EvSqlMethods.getString(Row, EvSelectionLists.DB_UPDATED_BY); Item.UpdatedDate += EvSqlMethods.getDateTime(Row, EvSelectionLists.DB_UPDATED_DATE); // // Return item // return(Item); }//END readDataRow method.
}//END SetLetterParameters. #endregion #region Data Reader methods // ===================================================================================== /// <summary> /// This method reads the content of the data row object containing a query result /// into an form record comment object. /// </summary> /// <param name="Row">DataRow: a data row object</param> /// <returns>EvFormRecordComment: a form record comment object</returns> /// <remarks> /// This method consists of the following steps: /// /// 1. Extract the compatible data row values to the comment object. /// /// 2. Return the form record comment object. /// </remarks> // ------------------------------------------------------------------------------------- public EdFormRecordComment readDataRow(DataRow Row) { // // Initialise the comment object. // EdFormRecordComment comment = new EdFormRecordComment( ); // // Extract the data object values. // comment.RecordGuid = EvSqlMethods.getGuid(Row, "FRC_RECORD_GUID"); comment.RecordFieldGuid = EvSqlMethods.getGuid(Row, "FRC_RECORD_FIELD_GUID"); comment.AuthorType = Evado.Model.EvStatics.parseEnumValue <EdFormRecordComment.AuthorTypeCodes> ( EvSqlMethods.getString(Row, "FRC_AUTHOR_TYPE")); comment.Content = EvSqlMethods.getString(Row, "FRC_Content"); comment.UserId = EvSqlMethods.getString(Row, "FRC_USER_ID"); comment.UserCommonName = EvSqlMethods.getString(Row, "FRC_USER_COMMON_NAME"); comment.CommentDate = EvSqlMethods.getDateTime(Row, "FRC_COMMENT_DATE"); comment.NewComment = false; // // Return the object. // return(comment); }// End readRow method.
}//END setUpdateChangeParameters. // +++++++++++++++++++++++++ END QUERY PARAMETERS SECTION ++++++++++++++++++++++++++++++ #endregion #region data change reader // ===================================================================================== /// <summary> /// This class reads the content of the data reader object into Change business object. /// </summary> /// <param name="Row">DataRow: a data row object</param> /// <returns>EvDataChange: a data change object</returns> /// <remarks> /// This method consists of the following steps: /// /// 1. Extract the data row values to the data change object. /// /// 2. Encrypt the data change if it is not encrypted. /// /// 3. Return the data change object. /// </remarks> // ------------------------------------------------------------------------------------- private EvDataChange getRowData(DataRow Row) { // // Initialise the data change object // EvDataChange dataChange = new EvDataChange( ); // // Extract the data row values to the data change object. // dataChange.Guid = EvSqlMethods.getGuid(Row, "DC_Guid"); dataChange.RecordGuid = EvSqlMethods.getGuid(Row, "DC_RecordGuid"); dataChange.Uid = EvSqlMethods.getLong(Row, "DC_Uid"); dataChange.RecordUid = EvSqlMethods.getLong(Row, "DC_RecordUid"); dataChange.TableName = Evado.Model.EvStatics.parseEnumValue <EvDataChange.DataChangeTableNames> ( EvSqlMethods.getString(Row, "DC_TableName")); string encrypted = EvSqlMethods.getString(Row, "DC_DataChange"); dataChange.UserId = EvSqlMethods.getString(Row, "DC_UserId"); dataChange.DateStamp = EvSqlMethods.getDateTime(Row, "DC_DateStamp"); // // Check that the encrypted string exists. // if (encrypted != String.Empty) { dataChange = this.decryptData(encrypted, dataChange.Guid); // // Check that items exist. // if (dataChange != null) { // // If the data change items exist process them. // if (dataChange.Items.Count > 0) { // // Iterate through the data change items updating the html coding // for (int count = 0; count < dataChange.Items.Count; count++) { dataChange.Items [count].InitialValue = dataChange.Items [count].InitialValue.Replace("&gt;", "&gt; "); dataChange.Items [count].NewValue = dataChange.Items [count].NewValue.Replace("&gt;", "&gt; "); } //END iterate through the item values correcting html coding. } //END data change items exist. } //END items exit } //END encrypted date exists // // Return the newField . // return(dataChange); }//END getRowData method.
}//END SetParameters class. #endregion #region ancillary record Reader // ===================================================================================== /// <summary> /// This method extracts the data row values to the Subject Record object. /// </summary> /// <param name="Row">DataRow: A data row object</param> /// <returns>EvSubjectRecord: A milestone record object.</returns> /// <remarks> /// This method consists of following steps: /// /// 1. Extract the compatible data row values to the Subject record object. /// /// 2. Return the milestone record object. /// </remarks> // ---------------------------------------------------------------------------------- private EvAncillaryRecord readRowData(DataRow Row) { // // Initialise the method variables and objects. // EvAncillaryRecord record = new EvAncillaryRecord( ); // // Extract the data object values. // record.Guid = EvSqlMethods.getGuid(Row, "TSR_Guid"); record.ProjectId = EvSqlMethods.getString(Row, "TrialId"); record.SubjectId = EvSqlMethods.getString(Row, "SubjectId"); record.RecordId = EvSqlMethods.getString(Row, "RecordId"); record.RecordDate = EvSqlMethods.getDateTime(Row, "TSR_RecordDate"); record.Subject = EvSqlMethods.getString(Row, "TSR_Subject"); record.Record = EvSqlMethods.getString(Row, "TSR_Record"); // // Perform binary object management // record.BinaryLength = EvSqlMethods.getInteger(Row, "TSR_BinaryLength"); if (record.BinaryLength > 0) { record.BinaryObject = EvSqlMethods.getBytes(Row, "TSR_BinaryObject"); record.BinaryType = EvSqlMethods.getString(Row, "TSR_BinaryType"); record.BinaryExtension = EvSqlMethods.getString(Row, "TSR_BinaryExtension"); } record.XmlData = EvSqlMethods.getString(Row, "TSR_XmlData"); record.Researcher = EvSqlMethods.getString(Row, "TSR_Researcher"); record.ResearcherDate = EvSqlMethods.getDateTime(Row, "TSR_ResearcherDate"); record.Reviewer = EvSqlMethods.getString(Row, "TSR_Reviewer"); record.ReviewDate = EvSqlMethods.getDateTime(Row, "TSR_ReviewDate"); record.Approver = EvSqlMethods.getString(Row, "TSR_Approver"); record.ApprovalDate = EvSqlMethods.getDateTime(Row, "TSR_ApprovalDate"); record.State = Evado.Model.EvStatics.parseEnumValue <EdRecordObjectStates> (EvSqlMethods.getString(Row, "TSR_State")); record.UpdatedByUserId = EvSqlMethods.getString(Row, "TSR_UpdatedByUserId"); record.UpdatedBy = EvSqlMethods.getString(Row, "TSR_UpdatedBy"); record.UpdatedDate = EvSqlMethods.getDateTime(Row, "TSR_UpdateDate"); record.BookedOutBy = EvSqlMethods.getString(Row, "TSR_BookedOutBy"); record.Signoffs = Evado.Model.EvStatics.DeserialiseObject <List <EdUserSignoff> > (EvSqlMethods.getString(Row, "TSR_Signoffs")); // // Return an object containing EvSubjectRecord object. // return(record); }//END getRowData
}//ENd getHeaderColumnNo method // ===================================================================================== /// <summary> /// this method updates a table cell value form the query result set. /// Note: the cell indexes are zero based. /// </summary> /// <param name="Row">The DataRow containing the field</param> /// <param name="Col">Int: The column index in the able.</param> /// <param name="RecordField"> Evado.Model.Forms.EvFormField object, containg the field data.</param> // ------------------------------------------------------------------------------------- private String getTableColumnValue(DataRow Row, int Col, Evado.Digital.Model.EdRecordField RecordField) { LogMethod("getTableColumnValue"); // // Select the column to retieve the value from // switch (RecordField.Table.Header [Col].TypeId) { case EvDataTypes.Numeric: { float fltValue = EvSqlMethods.getFloat(Row, EdRecordValues.DB_VALUES_NUMERIC); return(fltValue.ToString( )); } case EvDataTypes.Yes_No: { bool bYesNo = EvSqlMethods.getBool(Row, EdRecordValues.DB_VALUES_NUMERIC); string value = "No"; if (bYesNo == true) { value = "Yes"; } return(value); } case EvDataTypes.Date: { DateTime dtValue = EvSqlMethods.getDateTime(Row, EdRecordValues.DB_VALUES_DATE); if (dtValue == Evado.Model.EvStatics.CONST_DATE_NULL) { return(String.Empty); } // // Return the value. // return(dtValue.ToString("dd MMM yyyy")); } default: { return(EvSqlMethods.getString(Row, EdRecordValues.DB_VALUES_STRING)); } } //END table column type switch. } //END getTableColumnValue method
}//END SetParameters class. #endregion #region Data Reader methods // ================================================================================== /// <summary> /// This method reads the content of the data row object containing a query result /// into an ActivityRecord object. /// </summary> /// <param name="Row">DataRow: a retrieving data row object</param> /// <returns>EvBinaryFileMetaData: a readed data row object</returns> /// <remarks> /// This method consists of the following steps: /// /// 1. Extract the compatible data row values to the Binary file Meta data object /// /// 2. Return the Binary file Meta data object /// </remarks> // ---------------------------------------------------------------------------------- public EvBinaryFileMetaData readDataRow(DataRow Row) { // // Initialise the instrument objects and variables. // EvBinaryFileMetaData binaryFile = new EvBinaryFileMetaData( ); // // Extract the data object values. // binaryFile.Guid = EvSqlMethods.getGuid(Row, EvBinaryFiles.DB_GUID); binaryFile.FileGuid = EvSqlMethods.getGuid(Row, EvBinaryFiles.DB_FILE_GUID); binaryFile.TrialGuid = EvSqlMethods.getGuid(Row, EvBinaryFiles.DB_PROJECT_GUID); binaryFile.GroupGuid = EvSqlMethods.getGuid(Row, EvBinaryFiles.DB_GROUP_GUID); binaryFile.SubGroupGuid = EvSqlMethods.getGuid(Row, EvBinaryFiles.DB_SUB_GROUP_GUID); binaryFile.Language = EvSqlMethods.getString(Row, EvBinaryFiles.DB_LANGUAGE); binaryFile.TrialId = EvSqlMethods.getString(Row, EvBinaryFiles.DB_TRIAL_ID); binaryFile.GroupId = EvSqlMethods.getString(Row, EvBinaryFiles.DB_GROUP_ID); binaryFile.SubGroupId = EvSqlMethods.getString(Row, EvBinaryFiles.DB_SUB_GROUP_ID); binaryFile.FileId = EvSqlMethods.getString(Row, EvBinaryFiles.DB_FILE_ID); binaryFile.Title = EvSqlMethods.getString(Row, EvBinaryFiles.DB_FILE_TITLE); binaryFile.Comments = EvSqlMethods.getString(Row, EvBinaryFiles.DB_FILE_COMMENT); binaryFile.FileName = EvSqlMethods.getString(Row, EvBinaryFiles.DB_FILE_NAME); binaryFile.MimeType = EvSqlMethods.getString(Row, EvBinaryFiles.DB_MIME_TYPE); binaryFile.Status = EvSqlMethods.getString <EvBinaryFileMetaData.FileStatus> ( Row, EvBinaryFiles.DB_FILE_STATUS); binaryFile.UploadDate = EvSqlMethods.getDateTime(Row, EvBinaryFiles.DB_UPLOAD_DATE); binaryFile.ReleaseDate = EvSqlMethods.getDateTime(Row, EvBinaryFiles.DB_RELEASE_DATE); binaryFile.SupersededDate = EvSqlMethods.getDateTime(Row, EvBinaryFiles.DB_SUPERSEDED_DATE); binaryFile.FileExists = EvSqlMethods.getBool(Row, EvBinaryFiles.DB_FILE_EXISTS); binaryFile.FileEncrypted = EvSqlMethods.getBool(Row, EvBinaryFiles.DB_FILE_ENCRYPTED); binaryFile.Version = EvSqlMethods.getInteger(Row, EvBinaryFiles.DB_VERSION); binaryFile.UpdatedByUserId = EvSqlMethods.getString(Row, EvBinaryFiles.DB_UPDATED_BY_USER_ID); binaryFile.UpdatedBy = EvSqlMethods.getString(Row, EvBinaryFiles.DB_UPDATED_BY); binaryFile.UpdatedByDate = EvSqlMethods.getDateTime(Row, EvBinaryFiles.DB_UPDATED_DATE); // // Return the object. // return(binaryFile); }//End readDataRow method.
}//END SetParameters class. #endregion #region PageLayout Reader // ===================================================================================== /// <summary> /// This class extracts the content of the reader to the formfield selectionlist object. /// </summary> /// <param name="Row">DataRow: a data Reader containing the query results</param> /// <returns>EvFormFieldSelectionList: a formfield selectionlist object</returns> /// <remarks> /// This method consists of the following steps: /// /// 1. Extract the compatible data row values to the formfield selectionlist object. /// /// 2. Return the Formfield selectionlist object. /// </remarks> // --------------------------------------------------------------------------------- private EdPageLayout readDataRow(DataRow Row) { // // Initialise the formfield selectionlist object. // EdPageLayout Item = new EdPageLayout( ); // // Extract the compatible data row values to the formfield selectionlist object items. // Item.Guid = EvSqlMethods.getGuid(Row, EdPageLayouts.DB_GUID); Item.PageId = EvSqlMethods.getString(Row, EdPageLayouts.DB_PAGE_ID); Item.State = EvSqlMethods.getString <EdPageLayout.States> (Row, EdPageLayouts.DB_STATE); Item.UserTypes = EvSqlMethods.getString(Row, EdPageLayouts.DB_USER_TYPES); Item.Title = EvSqlMethods.getString(Row, EdPageLayouts.DB_TITLE); Item.HomePage = EvSqlMethods.getBool(Row, EdPageLayouts.DB_HOME_PAGE); Item.MenuLocation = EvSqlMethods.getString <EdPageLayout.MenuLocations> (Row, EdPageLayouts.DB_MENU_LOCATION); Item.PageCommands = EvSqlMethods.getString(Row, EdPageLayouts.DB_PAGE_COMMANDS); Item.HeaderContent = EvSqlMethods.getString(Row, EdPageLayouts.DB_HEADER_CONTENT); Item.HeaderComponentList = EvSqlMethods.getString(Row, EdPageLayouts.DB_HEADER_COMPONENT_LIST); Item.LeftColumnContent = EvSqlMethods.getString(Row, EdPageLayouts.DB_LEFT_CONTENT); Item.LeftColumnComponentList = EvSqlMethods.getString(Row, EdPageLayouts.DB_LEFT_COMPONENT_LIST); Item.LeftColumnWidth = (short)EvSqlMethods.getInteger(Row, EdPageLayouts.DB_LEFT_COLUMN_WIDTH); Item.CenterColumnContent = EvSqlMethods.getString(Row, EdPageLayouts.DB_CENTER_CONTENT); Item.CenterColumnComponentList = EvSqlMethods.getString(Row, EdPageLayouts.DB_CENTER_COMPONENT_LIST); Item.RightColumnContent = EvSqlMethods.getString(Row, EdPageLayouts.DB_RIGHT_CONTENT); Item.RightColumnComponentList = EvSqlMethods.getString(Row, EdPageLayouts.DB_RIGHT_COMPONENT_LIST); Item.RightColumnWidth = (short)EvSqlMethods.getInteger(Row, EdPageLayouts.DB_RIGHT_COLUMN_WIDTH); Item.Version = EvSqlMethods.getInteger(Row, EdPageLayouts.DB_VERSION); Item.UpdatedByUserId = EvSqlMethods.getString(Row, EdPageLayouts.DB_UPDATED_BY_USER_ID); Item.UpdatedBy = EvSqlMethods.getString(Row, EdPageLayouts.DB_UPDATED_BY); Item.UpdatedDate += EvSqlMethods.getDateTime(Row, EdPageLayouts.DB_UPDATED_DATE); // // Return item // return(Item); }//END readDataRow method.
}//END SetParameters class. #endregion #region Data Reader section // ===================================================================================== /// <summary> /// This class reads the content of the SqlDataReader into the Organisation data object. /// </summary> /// <param name="Row">DataRow: a data row object</param> /// <returns>EvOrganization: an organization object</returns> /// <remarks> /// This method consists of the following steps: /// /// 1. Extract the compatible row data object to the organization object. /// /// 2. Return the organization data object. /// </remarks> // ------------------------------------------------------------------------------------- public EdOrganisation readQueryRow ( DataRow Row ) { // // Initialise the Organisation // EdOrganisation organisation = new EdOrganisation ( ); // // Fill the object. // organisation.Guid = EvSqlMethods.getGuid ( Row, EdOrganisations.DB_GUID ); organisation.OrgId = EvSqlMethods.getString ( Row, EdOrganisations.DB_ORG_ID ); organisation.Name = EvSqlMethods.getString ( Row, EdOrganisations.DB_NAME ); organisation.AddressStreet_1 = EvSqlMethods.getString ( Row, EdOrganisations.DB_ADDRESS_1 ); organisation.AddressStreet_2 = EvSqlMethods.getString ( Row, EdOrganisations.DB_ADDRESS_2 ); organisation.AddressCity = EvSqlMethods.getString ( Row, EdOrganisations.DB_ADDRESS_CITY ); organisation.AddressPostCode = EvSqlMethods.getString ( Row, EdOrganisations.DB_ADDRESS_POST_CODE ); organisation.AddressState = EvSqlMethods.getString ( Row, EdOrganisations.DB_ADDRESS_STATE ); organisation.AddressCountry = EvSqlMethods.getString ( Row, EdOrganisations.DB_ADDRESS_COUNTRY ); organisation.Telephone = EvSqlMethods.getString ( Row, EdOrganisations.DB_TELEPHONE ); organisation.EmailAddress = EvSqlMethods.getString ( Row, EdOrganisations.DB_EMAIL_ADDRESS ); organisation.OrgType = EvSqlMethods.getString ( Row, EdOrganisations.DB_ORG_TYPE ); organisation.ImageFileName = EvSqlMethods.getString ( Row, EdOrganisations.DB_IMAGE_FILENAME); organisation.UpdatedByUserId = EvSqlMethods.getString ( Row, EdOrganisations.DB_UPDATED_BY_USER_ID ); organisation.UpdatedBy = EvSqlMethods.getString ( Row, EdOrganisations.DB_UPDATED_By ); organisation.UpdatedDate = EvSqlMethods.getDateTime ( Row, EdOrganisations.DB_UPDATE_DATE ); if ( organisation.OrgId.ToLower ( ) == "evado" ) { organisation.OrgType = "Evado"; } // // Return the Organisation object. // return organisation; }//End readRow method.
// // Define the class EventId property and variable. // #endregion #region Data Reader section // ================================================================================== /// <summary> /// This class reads the content of the data reader object into ApplicationEvent business object. /// </summary> /// <param name="Row">DataRow: a data row object</param> /// <remarks> /// This method consists of the following step: /// /// 1. Convert the elements from data reader object into the elements /// in application event business object. /// </remarks> // ---------------------------------------------------------------------------------- public EvApplicationEvent getReaderData(DataRow Row) { EvApplicationEvent Event = new EvApplicationEvent( ); // // Convert the elements from data reader object into the elements in application event business object. // Event.Guid = EvSqlMethods.getGuid(Row, DB_GUID); Event.EventId = EvSqlMethods.getInteger(Row, DB_EVENT_ID); Event.DateTime = EvSqlMethods.getDateTime(Row, DB_DATE_TIME); string sType = EvSqlMethods.getString(Row, DB_EVENT_TYPE); if (sType == "A") { sType = "Action"; } if (sType == "I") { sType = "Information"; } if (sType == "W") { sType = "Warning"; } if (sType == "E") { sType = "Error"; } Event.Type = Evado.Model.EvStatics.parseEnumValue <EvApplicationEvent.EventType> (sType); Event.Category = EvSqlMethods.getString(Row, DB_EVENT_CATEGORY); Event.UserId = EvSqlMethods.getString(Row, DB_USER_NAME); Event.Description = EvSqlMethods.getString(Row, DB_DESCRIPTION); Event.PageUrl = EvSqlMethods.getString(Row, DB_PAGE_URL); Event.CustomerId = EvSqlMethods.getString(Row, DB_SITE); return(Event); }//END getRowData method.
// ================================================================================== /// <summary> /// This class reads the content of the SqlDataReader into the Facility data object. /// </summary> /// <param name="Row">DataRow: a row of data row table</param> /// <returns>EvDataBaseUpdate: an update database</returns> /// <remarks> /// This method consists of the following steps: /// /// 1. Initialise an update object. /// /// 2. Extract the data object values and update values to the update object. /// /// 3. Return the update object. /// </remarks> // ---------------------------------------------------------------------------------- public EvDataBaseUpdate readDataRow(DataRow Row) { // // Initialise an update object. // EvDataBaseUpdate update = new EvDataBaseUpdate( ); // // Extract the data object values and update values to the update object. // update.Guid = EvSqlMethods.getGuid(Row, "DBU_Guid"); update.UpdateNo = EvSqlMethods.getInteger(Row, "DBU_Update_No"); update.UpdateDate = EvSqlMethods.getDateTime(Row, "DBU_Update_Date"); update.Version = EvSqlMethods.getString(Row, "DBU_Version"); update.Objects = EvSqlMethods.getString(Row, "DBU_Object"); update.Description = EvSqlMethods.getString(Row, "DBU_Description"); // // Return the update object. // return(update); }// End readDataRow 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 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.
// ===================================================================================== /// <summary> /// This class reads the content of the SqlDataReader into the Report data object. /// </summary> /// <param name="Row">DataRow: a data row object.</param> /// <param name="Columns">List of EvReportColumn: a list of report columns</param> /// <returns>EvReportRow: a report row object</returns> /// <remarks> /// This method consists of the following steps: /// /// 1. Loop through the Report's columns list /// /// 2. Switch data type to update the Report object's column values. /// /// 3. Return the Report object. /// </remarks> // ------------------------------------------------------------------------------------- private EdReportRow readRow(DataRow Row, List <EdReportColumn> Columns) { // // Initialize the return report row object. // EdReportRow reportRow = new EdReportRow(Columns.Count); // // Loop through the report columns list. // for (int columnCount = 0; columnCount < Columns.Count; columnCount++) { // // Switch column's datatype for updating the column values. // switch (Columns [columnCount].DataType) { case EdReport.DataTypes.Bool: { reportRow.ColumnValues [columnCount] = EvSqlMethods.getBool(Row, Columns [columnCount].SourceField).ToString( ); break; } case EdReport.DataTypes.Date: { DateTime dateVal = EvSqlMethods.getDateTime(Row, Columns [columnCount].SourceField); if (dateVal != Evado.Model.EvStatics.CONST_DATE_NULL) { reportRow.ColumnValues [columnCount] = dateVal.ToString("dd MMM yyyy HH:mm:ss"); } else { reportRow.ColumnValues [columnCount] = ""; } break; } case EdReport.DataTypes.Integer: { reportRow.ColumnValues [columnCount] = EvSqlMethods.getInteger(Row, Columns [columnCount].SourceField).ToString( ); break; } case EdReport.DataTypes.Float: case EdReport.DataTypes.Currency: { reportRow.ColumnValues [columnCount] = EvSqlMethods.getFloat(Row, Columns [columnCount].SourceField).ToString( ); break; } default: { String val = EvSqlMethods.getString(Row, Columns [columnCount].SourceField); if (val == "Null") { val = String.Empty; } reportRow.ColumnValues [columnCount] = val; break; } } //END Type switch } //END column interation loop. // // Return the Report object // return(reportRow); }// End readRow 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.