// =====================================================================================
        /// <summary>
        /// This class reads the content of the data reader object into FormField business object.
        /// </summary>
        /// <param name="Row">DataRow: an sql data query row</param>
        /// <returns>EvFormField: a form field object</returns>
        /// <remarks>
        /// This method consists of the following steps:
        ///
        /// 1. Update formfield object with the compatible data row items.
        ///
        /// 2. If the formfield typeId is table, iterate through the formfield table and set the validation rules
        ///
        /// 3. If the selection validation options are missing, add them.
        ///
        /// 4. If it is an external coding visitSchedule then add the relevant coding visitSchedule items.
        ///
        /// 5. Resolve the numeric 'NA' to negative infinity issue.
        ///
        /// 6. Update the instrument type to current enumeration.
        ///
        /// 7. If formfield typeId is either analogue scale or horizontal radio buttons,
        /// select the design by coding value
        ///
        /// 8. Return the formfield object.
        /// </remarks>
        // -------------------------------------------------------------------------------------
        private EdRecordSection getRowData(DataRow Row)
        {
            //
            // Initialise xmltable string and a return formfield object.
            //
            string          xmlTable    = String.Empty;
            EdRecordSection formSection = new  EdRecordSection( );

            //
            // Update formfield object with the compatible data row items.
            //
            formSection.LayoutGuid      = EvSqlMethods.getGuid(Row, EdEntitySections.DB_LAYOUT_GUID);
            formSection.No              = EvSqlMethods.getInteger(Row, EdEntitySections.DB_NUMBER);
            formSection.Title           = EvSqlMethods.getString(Row, EdEntitySections.DB_NAME);
            formSection.Order           = EvSqlMethods.getInteger(Row, EdEntitySections.DB_ORDER);
            formSection.FieldId         = EvSqlMethods.getString(Row, EdEntitySections.DB_FIELD_NAME);
            formSection.Instructions    = EvSqlMethods.getString(Row, EdEntitySections.DB_INSTRUCTIONS);
            formSection.FieldValue      = EvSqlMethods.getString(Row, EdEntitySections.DB_FIELD_VALUE);
            formSection.OnMatchVisible  = EvSqlMethods.getBool(Row, EdEntitySections.DB_ON_MATCH_VISIBLE);
            formSection.OnOpenVisible   = EvSqlMethods.getBool(Row, EdEntitySections.DB_VISIBLE);
            formSection.ReadAccessRoles = EvSqlMethods.getString(Row, EdEntitySections.DB_DEFAULT_DISPLAY_ROLES);
            formSection.EditAccessRoles = EvSqlMethods.getString(Row, EdEntitySections.DB_DEFAULT_EDIT_ROLES);
            formSection.PercentWidth    = EvSqlMethods.getInteger(Row, EdEntitySections.DB_PERCENT_WIDTH);

            return(formSection);
        }//END getRowData 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.