}//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.
 // =====================================================================================
 /// <summary>
 ///  This method fills the parameter array with values to be passed to the update
 ///  stored procedures.
 /// </summary>
 /// <param name="parms">SqlParameter: an array of sql query parameters</param>
 /// <param name="Comment">EvFormRecordComment: Values to bind to parameters</param>
 /// <remarks>
 /// This method consists of the following step:
 ///
 /// 1. Update the items from comment object to the array of sql query parameters.
 /// </remarks>
 // -------------------------------------------------------------------------------------
 private void SetParameters(SqlParameter [] parms, EdFormRecordComment Comment)
 {
     parms [0].Value = Comment.RecordGuid;
     parms [1].Value = Comment.RecordFieldGuid;
     parms [2].Value = Comment.CommentType;
     parms [3].Value = Comment.AuthorType;
     parms [4].Value = Comment.Content;
     parms [5].Value = Comment.UserId;
     parms [6].Value = Comment.UserCommonName;
     parms [7].Value = Comment.CommentDate;
 }//END SetLetterParameters.
        }//END addNewComments method

        // =====================================================================================
        /// <summary>
        /// This class adds new items to the form record comment table.
        /// </summary>
        /// <param name="Comment">EvFormRecordComment: a retrieved form record comment object</param>
        /// <returns>EvEventCodes: an event code for adding items</returns>
        /// <remarks>
        /// This method consists of the following steps:
        ///
        /// 2. Try define the SQL query parameters and execute the storeprocedure for adding items.
        ///
        /// 3. Return the event code for adding items.
        ///
        /// 4. Catch write out error message log.
        /// </remarks>
        // -------------------------------------------------------------------------------------
        public EvEventCodes  addItem(EdFormRecordComment Comment)
        {
            //
            // Initialzie the debug log
            //
            this.LogMethod("addItem.");
            //this.LogDebugValue ( "RecordGuid: " + Comment.RecordGuid );
            //this.LogDebugValue ( "RecordFieldGuid: " + Comment.RecordFieldGuid );
            // this.LogDebugValue ( "CommentType: " + Comment.CommentType );
            //this.LogDebugValue ( "AuthorType: " + Comment.AuthorType );
            //this.LogDebugValue ( "Content: " + Comment.Content );
            //this.LogDebugValue ( "UserCommonName: " + Comment.UserCommonName );
            //this.LogDebugValue ( "CommentDate: " + Comment.stCommentDate );
            try
            {
                //
                // Define the SQL query parameters and load the query values.
                //
                SqlParameter [] _cmdParms = getItemsParameters( );
                SetParameters(_cmdParms, Comment);

                //
                // Execute the update command.
                //
                if (EvSqlMethods.StoreProcUpdate(_STORED_PROCEDURE_AddItem, _cmdParms) == 0)
                {
                    return(EvEventCodes.Database_Record_Update_Error);
                }

                this.LogMethodEnd("addItem.");
                return(EvEventCodes.Ok);
            }
            catch (Exception Ex)
            {
                //
                // Create the event message
                //
                string eventMessage = "DebugLog: + " + this.Log
                                      + "\r\n Exception: \r\n" + Evado.Digital.Model.EvcStatics.getException(Ex);

                throw (Ex);
            }
        }//END addItem class
        }// 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.