}//END create_PasswordChangeEmail_Group Method


    // ==============================================================================
    /// <summary>
    /// This method add the group commands to the passed group.
    /// </summary>
    /// <param name="PageObject">Evado.UniForm.Model.Page object.</param>
    //  ------------------------------------------------------------------------------
    private void addGroupCommands ( Evado.UniForm.Model.Group PageGroup )
    {
      //
      // Initialise the methods variables and objects.
      //
      Evado.UniForm.Model.Command pageCommand = new Evado.UniForm.Model.Command ( );

      if ( this._displayPage == true )
      {
        // 
        // Add the display groupCommand
        //
        pageCommand = PageGroup.addCommand (
          EdLabels.UserAdmin_Edit_Page_Command_Title,
          EuAdapter.ADAPTER_ID,
          EuAdapterClasses.Email_Templates.ToString ( ),
          Evado.UniForm.Model.ApplicationMethods.Custom_Method );

        pageCommand.setCustomMethod ( Evado.UniForm.Model.ApplicationMethods.Get_Object );

        pageCommand.AddParameter ( EuStaticContentTemplates.CONST_DISPLAY_PAGE, "false" );

        pageCommand.SetPageId ( Evado.Digital.Model.EdStaticPageIds.Email_Templates_Page );

        return;
      }
      else
      {
        // 
        // Add the display groupCommand
        //
        pageCommand = PageGroup.addCommand (
          EdLabels.UserAdmin_Display_Page_Command_Title,
          EuAdapter.ADAPTER_ID,
          EuAdapterClasses.Email_Templates.ToString ( ),
          Evado.UniForm.Model.ApplicationMethods.Custom_Method );

        pageCommand.setCustomMethod ( Evado.UniForm.Model.ApplicationMethods.Get_Object );

        pageCommand.AddParameter ( EuStaticContentTemplates.CONST_DISPLAY_PAGE, "true" );

        pageCommand.SetPageId ( Evado.Digital.Model.EdStaticPageIds.Email_Templates_Page );
      }

      // 
      // Add the save groupCommand
      //
      if ( this._displayPage == false )
      {
        pageCommand = PageGroup.addCommand (
          EdLabels.UserAdmin_Save_Command_Title,
          EuAdapter.ADAPTER_ID,
          EuAdapterClasses.Email_Templates.ToString ( ),
          Evado.UniForm.Model.ApplicationMethods.Save_Object );
      }
    }
    }//END getProperties_GeneralPageGroup Method

    // ==============================================================================
    /// <summary>
    /// This method returns a client application ResultData object
    /// </summary>
    /// <param name="Page">Evado.UniForm.Model.AppData object.</param>
    //  ------------------------------------------------------------------------------
    private void getPropertiesPage_SectionsGroup (
      Evado.UniForm.Model.Page Page )
    {
      this.LogMethod ( "getProperties_SectionsPageGroup" );
      // 
      // Initialise the methods variables and objects.
      // 
      Evado.UniForm.Model.Group pageGroup = new Evado.UniForm.Model.Group ( );
      Evado.UniForm.Model.Command groupCommand = new Evado.UniForm.Model.Command ( );
      Evado.UniForm.Model.Field groupField = new Evado.UniForm.Model.Field ( );
      Evado.UniForm.Model.Parameter parameter = new Evado.UniForm.Model.Parameter ( );
      String stFieldList = String.Empty;

      //
      // Define the section properties pageMenuGroup..
      //
      pageGroup = Page.AddGroup (
        EdLabels.Form_Properties_Sections_Group_Title );
      pageGroup.Layout = Evado.UniForm.Model.GroupLayouts.Full_Width;
      pageGroup.CmdLayout = Evado.UniForm.Model.GroupCommandListLayouts.Vertical_Orientation;

      //
      // Add the new form section object.

      groupCommand = pageGroup.addCommand ( EdLabels.Form_Section_New_Section_Command_Title,
        EuAdapter.ADAPTER_ID,
        EuAdapterClasses.Entity_Layouts.ToString ( ),
        Evado.UniForm.Model.ApplicationMethods.Get_Object );

      groupCommand.AddParameter ( EdRecordSection.FormSectionClassFieldNames.Sectn_No.ToString ( ), "-1" );
      groupCommand.SetPageId ( Evado.Digital.Model.EdStaticPageIds.Form_Properties_Section_Page );
      groupCommand.SetBackgroundDefaultColour ( Evado.UniForm.Model.Background_Colours.Purple );

      this.LogValue ( "No of form sections: " + this.Session.EntityLayout.Design.FormSections.Count );

      //
      // Iterate through the sections.
      //
      foreach ( EdRecordSection formSection in this.Session.EntityLayout.Design.FormSections )
      {
        groupCommand = pageGroup.addCommand ( formSection.LinkText,
          EuAdapter.ADAPTER_ID,
          EuAdapterClasses.Entity_Layouts.ToString ( ),
          Evado.UniForm.Model.ApplicationMethods.Get_Object );

        groupCommand.AddParameter ( EdRecordSection.FormSectionClassFieldNames.Sectn_No.ToString ( ), formSection.No );
        groupCommand.SetPageId ( Evado.Digital.Model.EdStaticPageIds.Form_Properties_Section_Page );
      }

      this.LogValue ( "After No of form sections: " + this.Session.EntityLayout.Design.FormSections.Count );

      this.LogMethodEnd ( "getProperties_SectionsPageGroup" );

    }//END getProperties_SectionsPageGroup Method
    // ==============================================================================
    /// <summary>
    /// This method returns a client application ResultData object
    /// </summary>
    /// <param name="Page">Evado.UniForm.Model.Page object.</param>
    //  ------------------------------------------------------------------------------
    private void getDataObject_UserGroupCommands (
      Evado.UniForm.Model.Group PageGroup )
    {
      this.LogMethod ( "getDataObject_UserGroupCommands" );
      // 
      // Initialise the methods variables and objects.
      // 
      Evado.UniForm.Model.Command groupCommand = new Evado.UniForm.Model.Command ( );

      // 
      // Add the save groupCommand
      // 
      groupCommand = PageGroup.addCommand (
        EdLabels.User_Profile_Save_Command_Title,
        EuAdapter.ADAPTER_ID,
        EuAdapterClasses.Users.ToString ( ),
        Evado.UniForm.Model.ApplicationMethods.Save_Object );

      groupCommand.SetPageId ( Evado.Digital.Model.EdStaticPageIds.My_User_Profile_Update_Page );

      // 
      // Define the save and delete groupCommand parameters
      // 
      groupCommand.SetGuid ( this.Session.UserProfile.Guid );

      this.LogMethodEnd ( "getDataObject_UserGroupCommands" );

    }//END getDataObject_GroupCommands method.
    }//END getDataObject_FieldGroup Method

    // ==============================================================================
    /// <summary>
    /// This method returns a client application ResultData object
    /// </summary>
    /// <param name="Page">Evado.UniForm.Model.Page object.</param>
    //  ------------------------------------------------------------------------------
    private void getDataObject_GroupCommands (
      Evado.UniForm.Model.Group PageGroup )
    {
      this.LogMethod ( "getDataObject_GroupCommands" );
      // 
      // Initialise the methods variables and objects.
      // 
      Evado.UniForm.Model.Command groupCommand = new Evado.UniForm.Model.Command ( );

      // 
      // Add the save groupCommand
      // 
      groupCommand = PageGroup.addCommand (
        EdLabels.Demo_Registration_Save_Command_Title,
        EuAdapter.ADAPTER_ID,
        EuAdapterClasses.User_Registration.ToString ( ),
        Evado.UniForm.Model.ApplicationMethods.Custom_Method );

      groupCommand.setCustomMethod ( Evado.UniForm.Model.ApplicationMethods.Get_Object );

      groupCommand.SetPageId ( Evado.Digital.Model.EdStaticPageIds.Demo_User_Exit_Page );

      this.LogMethodEnd ( "getDataObject_GroupCommands" );
    }//END getDataObject_GroupCommands method.
    }//END method

    // =====================================================================================
    /// <summary>
    /// This method generates the commands associated with the selected menu item.
    /// </summary>
    /// <param name="PageId">String: page identifier</param>
    /// <param name="Title">String: command  title</param>
    /// <returns>Evado.UniForm.Model.Command object.</returns>
    //  ------------------------------------------------------------------------------------
    public Evado.UniForm.Model.Command GetNavigationCommand ( 
      String PageId, 
      String Title,
      String Parameters)
    {
      this.resetAdapterLog ( );
      this.LogMethod ( "getMenuCommandObject" );
      this.LogDebug ( "PageId: {0}, Title: {1}.", PageId, Title );
      //
      // Initialise the methods variables and objects.
      //
      Evado.Digital.Model.EdStaticPageIds pageId = Evado.Digital.Model.EdStaticPageIds.Null;
      Evado.UniForm.Model.Command pageCommand = new Evado.UniForm.Model.Command ( );

      //
      // process static page identifeirs to create their commands.
      //
      if ( EvStatics.tryParseEnumValue<Evado.Digital.Model.EdStaticPageIds> ( PageId, out pageId ) == true )
      {
        #region Admin menu items

        //
        // Administration page commands
        //
        switch ( pageId )
        {
          case Evado.Digital.Model.EdStaticPageIds.Application_Profile:
            {
              pageCommand = new Evado.UniForm.Model.Command (
                Title,
                EuAdapter.ADAPTER_ID,
                EuAdapterClasses.Application_Properties.ToString ( ),
                Evado.UniForm.Model.ApplicationMethods.Get_Object );

              pageCommand.SetPageId ( PageId );

              return pageCommand;
            }

          case Evado.Digital.Model.EdStaticPageIds.Database_Version:
            {
              pageCommand = new Evado.UniForm.Model.Command (
                Title,
                EuAdapter.ADAPTER_ID,
                EuAdapterClasses.Application_Properties.ToString ( ),
                Evado.UniForm.Model.ApplicationMethods.Get_Object );

              pageCommand.SetPageId ( Evado.Digital.Model.EdStaticPageIds.Database_Version );

              return pageCommand;
            }

          case Evado.Digital.Model.EdStaticPageIds.Email_Templates_Page:
            {
              pageCommand = new Evado.UniForm.Model.Command (
                Title,
                EuAdapter.ADAPTER_ID,
                EuAdapterClasses.Email_Templates.ToString ( ),
                Evado.UniForm.Model.ApplicationMethods.Get_Object );

              pageCommand.SetPageId ( PageId );

              return pageCommand;
            }

          case Evado.Digital.Model.EdStaticPageIds.Application_Event_View:
            {
              pageCommand = new Evado.UniForm.Model.Command (
                Title,
                EuAdapter.ADAPTER_ID,
                EuAdapterClasses.Events.ToString ( ),
                Evado.UniForm.Model.ApplicationMethods.List_of_Objects );

              pageCommand.SetPageId ( PageId );

              return pageCommand;
            }

          case Evado.Digital.Model.EdStaticPageIds.Application_Event:
            {
              pageCommand = new Evado.UniForm.Model.Command (
                Title,
                EuAdapter.ADAPTER_ID,
                EuAdapterClasses.Events.ToString ( ),
                Evado.UniForm.Model.ApplicationMethods.Get_Object );

              pageCommand.SetPageId ( PageId );

              // 
              // Add the groupCommand parameters.
              // 
              pageCommand.SetGuid (
                this.Session.MenuItem.Guid );

              return pageCommand;
            }

          case Evado.Digital.Model.EdStaticPageIds.Organisation_View:
            {
              pageCommand = new Evado.UniForm.Model.Command (
                Title,
                EuAdapter.ADAPTER_ID,
                EuAdapterClasses.Organisations.ToString ( ),
                Evado.UniForm.Model.ApplicationMethods.List_of_Objects );

              pageCommand.SetPageId ( PageId );

              return pageCommand;
            }

          case Evado.Digital.Model.EdStaticPageIds.Organisation_Page:
            {
              pageCommand = new Evado.UniForm.Model.Command (
                Title,
                EuAdapter.ADAPTER_ID,
                EuAdapterClasses.Organisations.ToString ( ),
                Evado.UniForm.Model.ApplicationMethods.Get_Object );

              // 
              // Add the groupCommand parameters.
              // 
              pageCommand.SetGuid ( this.Session.MenuItem.Guid );

              pageCommand.SetPageId ( PageId );

              return pageCommand;
            }

          case Evado.Digital.Model.EdStaticPageIds.User_View:
            {
              pageCommand = new Evado.UniForm.Model.Command (
                Title,
                EuAdapter.ADAPTER_ID,
                EuAdapterClasses.Users.ToString ( ),
                Evado.UniForm.Model.ApplicationMethods.List_of_Objects );

              pageCommand.SetPageId ( PageId );

              return pageCommand;
            }

          case Evado.Digital.Model.EdStaticPageIds.My_User_Profile_Update_Page:
            {
              pageCommand = new Evado.UniForm.Model.Command (
                Title,
                EuAdapter.ADAPTER_ID,
                EuAdapterClasses.Users.ToString ( ),
                Evado.UniForm.Model.ApplicationMethods.Get_Object );

              pageCommand.SetPageId ( PageId );

              return pageCommand;
            }
          case Evado.Digital.Model.EdStaticPageIds.Email_User_Page:
            {
              string [] arParameters = Parameters.Split ( ';' );

              pageCommand = new Evado.UniForm.Model.Command (
                Title,
                EuAdapter.ADAPTER_ID,
                EuAdapterClasses.Users.ToString ( ),
                Evado.UniForm.Model.ApplicationMethods.Get_Object );

              pageCommand.SetPageId ( PageId );

              foreach ( string parm in arParameters )
              {
                if ( parm.Contains ( "=" ) == false )
                {
                  continue;
                }
                String [] arParm = parm.Split ( '=' );

                pageCommand.AddParameter ( arParm [ 0 ], arParm [ 1 ] );
              }

              return pageCommand;
            }

          case Evado.Digital.Model.EdStaticPageIds.Menu_View:
            {
              pageCommand = new Evado.UniForm.Model.Command (
                Title,
                EuAdapter.ADAPTER_ID,
                EuAdapterClasses.Menu.ToString ( ),
                Evado.UniForm.Model.ApplicationMethods.List_of_Objects );

              pageCommand.SetPageId ( PageId );

              return pageCommand;
            }

        }//END  admin page switch statement

        //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
        #endregion

        #region applilcation configuration
        //
        // Project configuration menu commands.
        //
        switch ( pageId )
        {
          case Evado.Digital.Model.EdStaticPageIds.Alert_View:
            {
              pageCommand = new Evado.UniForm.Model.Command (
               Title,
               EuAdapter.ADAPTER_ID,
               EuAdapterClasses.Alert.ToString ( ),
                Evado.UniForm.Model.ApplicationMethods.List_of_Objects );

              pageCommand.SetPageId ( PageId );

              return pageCommand;
            }

          case Evado.Digital.Model.EdStaticPageIds.Binary_File_List_Page:
            {
              pageCommand = new Evado.UniForm.Model.Command (
                Title,
                EuAdapter.ADAPTER_ID,
                EuAdapterClasses.Binary_File.ToString ( ),
                Evado.UniForm.Model.ApplicationMethods.List_of_Objects );

              pageCommand.SetPageId ( PageId );

              return pageCommand;
            }

          case Evado.Digital.Model.EdStaticPageIds.Page_Layout_View:
            {
              pageCommand = new Evado.UniForm.Model.Command (
                Title,
                EuAdapter.ADAPTER_ID,
                EuAdapterClasses.Page_Layouts.ToString ( ),
                Evado.UniForm.Model.ApplicationMethods.List_of_Objects );

              pageCommand.SetPageId ( PageId );

              return pageCommand;
            }

          case Evado.Digital.Model.EdStaticPageIds.Page_Layout_Page:
            {
              pageCommand = new Evado.UniForm.Model.Command (
                Title,
                EuAdapter.ADAPTER_ID,
                EuAdapterClasses.Page_Layouts.ToString ( ),
                Evado.UniForm.Model.ApplicationMethods.Get_Object );

              pageCommand.SetPageId ( PageId );

              return pageCommand;
            }

          case Evado.Digital.Model.EdStaticPageIds.Selection_List_View:
            {
              pageCommand = new Evado.UniForm.Model.Command (
                Title,
                EuAdapter.ADAPTER_ID,
                EuAdapterClasses.Selection_Lists.ToString ( ),
                Evado.UniForm.Model.ApplicationMethods.List_of_Objects );

              pageCommand.SetPageId ( PageId );

              return pageCommand;
            }

          case Evado.Digital.Model.EdStaticPageIds.Selection_List_Page:
            {
              pageCommand = new Evado.UniForm.Model.Command (
                Title,
                EuAdapter.ADAPTER_ID,
                EuAdapterClasses.Selection_Lists.ToString ( ),
                Evado.UniForm.Model.ApplicationMethods.Get_Object );

              pageCommand.SetPageId ( PageId );

              return pageCommand;
            }


          case Evado.Digital.Model.EdStaticPageIds.Record_Layout_View:
            {
              pageCommand = new Evado.UniForm.Model.Command (
                Title,
                EuAdapter.ADAPTER_ID,
                EuAdapterClasses.Record_Layouts.ToString ( ),
                Evado.UniForm.Model.ApplicationMethods.List_of_Objects );

              pageCommand.SetPageId ( PageId );

              return pageCommand;
            }

          case Evado.Digital.Model.EdStaticPageIds.Entity_Layout_View:
            {
              pageCommand = new Evado.UniForm.Model.Command (
                Title,
                EuAdapter.ADAPTER_ID,
                EuAdapterClasses.Entity_Layouts.ToString ( ),
                Evado.UniForm.Model.ApplicationMethods.List_of_Objects );

              pageCommand.SetPageId ( PageId );

              return pageCommand;
            }
        }//END  admin page switch statement

        //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
        #endregion

        #region  analysis and reporting menu items.
        //
        // Project analysis and reporting menu commands.
        //
        switch ( pageId )
        {
          case Evado.Digital.Model.EdStaticPageIds.Data_Charting_Page:
            {
              this.LogValue ( PageId + " ADDED" );
              pageCommand = new Evado.UniForm.Model.Command (
                Title,
                EuAdapter.ADAPTER_ID,
                EuAdapterClasses.Analysis.ToString ( ),
                Evado.UniForm.Model.ApplicationMethods.List_of_Objects );

              pageCommand.SetPageId ( PageId );

              return pageCommand;
            }
          case Evado.Digital.Model.EdStaticPageIds.Record_Query_Page:
            {
              this.LogValue ( PageId + " ADDED" );
              pageCommand = new Evado.UniForm.Model.Command (
                Title,
                EuAdapter.ADAPTER_ID,
                EuAdapterClasses.Analysis.ToString ( ),
                Evado.UniForm.Model.ApplicationMethods.List_of_Objects );

              pageCommand.SetPageId ( PageId );

              return pageCommand;
            }
          case Evado.Digital.Model.EdStaticPageIds.Audit_Configuration_Page:
            {
              pageCommand = new Evado.UniForm.Model.Command (
                Title,
                EuAdapter.ADAPTER_ID,
                EuAdapterClasses.Application_Properties.ToString ( ),
                Evado.UniForm.Model.ApplicationMethods.Get_Object );

              pageCommand.SetPageId ( PageId );

              return pageCommand;
            }
          case Evado.Digital.Model.EdStaticPageIds.Audit_Records_Page:
            {
              pageCommand = new Evado.UniForm.Model.Command (
                Title,
                EuAdapter.ADAPTER_ID,
                EuAdapterClasses.Application_Properties.ToString ( ),
                Evado.UniForm.Model.ApplicationMethods.Get_Object );

              pageCommand.SetPageId ( PageId );

              return pageCommand;
            }
          case Evado.Digital.Model.EdStaticPageIds.Audit_Record_Items_Page:
            {
              pageCommand = new Evado.UniForm.Model.Command (
                Title,
                EuAdapter.ADAPTER_ID,
                EuAdapterClasses.Application_Properties.ToString ( ),
                Evado.UniForm.Model.ApplicationMethods.Get_Object );

              pageCommand.SetPageId ( PageId );

              return pageCommand;
            }
        }

        //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
        #endregion

        #region reporting menu items.
        //
        // Project analysis and reporting menu commands.
        //
        switch ( pageId )
        {
          case Evado.Digital.Model.EdStaticPageIds.Report_Template_View:
            {
              this.LogValue ( PageId + " ADDED" );
              pageCommand = new Evado.UniForm.Model.Command (
                Title,
                EuAdapter.ADAPTER_ID,
                EuAdapterClasses.ReportTemplates.ToString ( ),
                Evado.UniForm.Model.ApplicationMethods.List_of_Objects );

              pageCommand.SetPageId ( PageId );

              return pageCommand;
            }
          case Evado.Digital.Model.EdStaticPageIds.Report_Template_Page:
            {
              this.LogValue ( PageId + " ADDED" );
              pageCommand = new Evado.UniForm.Model.Command (
                Title,
                EuAdapter.ADAPTER_ID,
                EuAdapterClasses.ReportTemplates.ToString ( ),
                Evado.UniForm.Model.ApplicationMethods.Get_Object );

              pageCommand.SetPageId ( PageId );

              return pageCommand;
            }
          case Evado.Digital.Model.EdStaticPageIds.Operational_Report_List:
            {
              this.LogValue ( PageId + " ADDED" );
              pageCommand = new Evado.UniForm.Model.Command (
                Title,
                EuAdapter.ADAPTER_ID,
                EuAdapterClasses.Reports.ToString ( ),
                Evado.UniForm.Model.ApplicationMethods.List_of_Objects );

              pageCommand.SetPageId ( PageId );

              return pageCommand;
            }

          case Evado.Digital.Model.EdStaticPageIds.Operational_Report_Page:
            {
              this.LogValue ( PageId + " ADDED" );
              pageCommand = new Evado.UniForm.Model.Command (
                Title,
                EuAdapter.ADAPTER_ID,
                EuAdapterClasses.Reports.ToString ( ),
                Evado.UniForm.Model.ApplicationMethods.Get_Object );

              pageCommand.SetPageId ( PageId );

              return pageCommand;
            }
        }//END switch statement

        //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
        #endregion

        #region record menu items.
        //
        // Project records menu commands.
        //
        switch ( pageId )
        {

          //  ------------------------------------------------------------------------------
          // milestone ancillary records pages.
          // 
          case Evado.Digital.Model.EdStaticPageIds.Ancillary_Record_View:
            {
              pageCommand = new Evado.UniForm.Model.Command (
                Title,
                EuAdapter.ADAPTER_ID,
                EuAdapterClasses.Ancillary_Record.ToString ( ),
                Evado.UniForm.Model.ApplicationMethods.List_of_Objects );

              pageCommand.SetPageId ( PageId );

              return pageCommand;
            }

          case Evado.Digital.Model.EdStaticPageIds.Records_View:
            {
              pageCommand = new Evado.UniForm.Model.Command (
                Title,
                EuAdapter.ADAPTER_ID,
                EuAdapterClasses.Records.ToString ( ),
                Evado.UniForm.Model.ApplicationMethods.List_of_Objects );

              pageCommand.SetPageId ( PageId );

              return pageCommand;
            }

          case Evado.Digital.Model.EdStaticPageIds.Record_Export_Page:
            {
              pageCommand = new Evado.UniForm.Model.Command (
                Title,
                EuAdapter.ADAPTER_ID,
                EuAdapterClasses.Records.ToString ( ),
                Evado.UniForm.Model.ApplicationMethods.List_of_Objects );

              pageCommand.SetPageId ( PageId );

              return pageCommand;
            }

          case Evado.Digital.Model.EdStaticPageIds.Record_Admin_Page:
            {
              pageCommand = new Evado.UniForm.Model.Command (
                Title,
                EuAdapter.ADAPTER_ID,
                EuAdapterClasses.Records.ToString ( ),
                Evado.UniForm.Model.ApplicationMethods.List_of_Objects );

              pageCommand.SetPageId ( PageId );

              return pageCommand;
            }


          case Evado.Digital.Model.EdStaticPageIds.Record_Page:
            {
              pageCommand = new Evado.UniForm.Model.Command (
                Title,
                EuAdapter.ADAPTER_ID,
                EuAdapterClasses.Records.ToString ( ),
                Evado.UniForm.Model.ApplicationMethods.Get_Object );

              pageCommand.SetPageId ( PageId );

              pageCommand.SetGuid ( this.Session.Record.Guid );

              if ( this.Session.Entity != null )
              {
                pageCommand.AddParameter ( EdRecord.FieldNames.TypeId,
                  this.Session.Entity.TypeId );
              }
              return pageCommand;
            }

          //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
        #endregion

        #region Entity commands
          //
          // Entitity menu commands
          //
          case Evado.Digital.Model.EdStaticPageIds.Entity_View:
          case Evado.Digital.Model.EdStaticPageIds.Entity_Filter_View:
            {
              pageCommand = new Evado.UniForm.Model.Command (
                Title,
                EuAdapter.ADAPTER_ID,
                EuAdapterClasses.Entities.ToString ( ),
                Evado.UniForm.Model.ApplicationMethods.List_of_Objects );

              pageCommand.SetPageId ( PageId );

              return pageCommand;
            }

          case Evado.Digital.Model.EdStaticPageIds.Entity_Export_Page:
            {
              pageCommand = new Evado.UniForm.Model.Command (
                Title,
                EuAdapter.ADAPTER_ID,
                EuAdapterClasses.Entities.ToString ( ),
                Evado.UniForm.Model.ApplicationMethods.List_of_Objects );

              pageCommand.SetPageId ( PageId );

              return pageCommand;
            }

          case Evado.Digital.Model.EdStaticPageIds.Entity_Admin_Page:
            {
              pageCommand = new Evado.UniForm.Model.Command (
                Title,
                EuAdapter.ADAPTER_ID,
                EuAdapterClasses.Entities.ToString ( ),
                Evado.UniForm.Model.ApplicationMethods.List_of_Objects );

              pageCommand.SetPageId ( PageId );

              return pageCommand;
            }

          case Evado.Digital.Model.EdStaticPageIds.Entity_Page:
            {
              pageCommand = new Evado.UniForm.Model.Command (
                Title,
                EuAdapter.ADAPTER_ID,
                EuAdapterClasses.Entities.ToString ( ),
                Evado.UniForm.Model.ApplicationMethods.Get_Object );

              pageCommand.SetPageId ( PageId );

              pageCommand.SetGuid ( this.Session.Entity.Guid );

              if ( this.Session.Entity != null )
              {
                pageCommand.AddParameter ( EdRecord.FieldNames.TypeId,
                  this.Session.Entity.TypeId );
              }
              return pageCommand;
            }

        }//END switch
        //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
        #endregion

      }//END Static page ids.

      //
      // Create the command to to display a page layout..
      //
      if ( PageId.Contains ( EuAdapter.CONST_PAGE_ID_PREFIX ) == true )
      {
        string stPageId = PageId.Replace ( EuAdapter.CONST_PAGE_ID_PREFIX, String.Empty );

        this.LogDebug ( "PAGE: PageId: {0}, Title: {1} StPageId: {2}.", PageId, Title, stPageId );

        pageCommand = new Evado.UniForm.Model.Command (
          Title,
          EuAdapter.ADAPTER_ID,
          EuAdapterClasses.Page.ToString ( ),
          Evado.UniForm.Model.ApplicationMethods.List_of_Objects );

        pageCommand.SetPageId ( stPageId );
        pageCommand.AddParameter ( EuEntities.CONST_HIDE_SELECTION, "Yes" );

        return pageCommand;
      }

      //
      // Create the command to query Entities as a filtered list  
      // i.e. retrieves an organisation's child entity layout.
      //
      if ( PageId.Contains ( EuAdapter.CONST_AUTHOR_PAGE_ID_SUFFIX ) == true )
      {

        string layoutId = PageId.Replace ( EuAdapter.CONST_ENTITY_PREFIX, String.Empty );
        layoutId = layoutId.Replace ( EuAdapter.CONST_AUTHOR_PAGE_ID_SUFFIX, String.Empty );

        this.LogDebug ( "AUTHOR: PageId: {0}, Title: {1} Layout: {2}, Author Query.", PageId, Title, layoutId );

        pageCommand = new Evado.UniForm.Model.Command (
          Title,
          EuAdapter.ADAPTER_ID,
          EuAdapterClasses.Entities.ToString ( ),
          Evado.UniForm.Model.ApplicationMethods.List_of_Objects );

        pageCommand.SetPageId ( Evado.Digital.Model.EdStaticPageIds.Entity_View );
        pageCommand.AddParameter ( EdRecord.FieldNames.Layout_Id, layoutId );
        pageCommand.AddParameter ( EdRecord.FieldNames.Author, this.Session.UserProfile.UserId );
        pageCommand.AddParameter ( EdRecord.FieldNames.ParentUserId, this.Session.UserProfile.UserId );
        pageCommand.AddParameter ( EuEntities.CONST_HIDE_SELECTION, "Yes" );
        pageCommand.AddParameter ( EuEntities.CONST_AUTHOR_SELECTION, "Yes" );
        
        return pageCommand;
      }

      //
      // Create the command to query Entities as a filtered list  
      // i.e. retrieves an organisation's child entity layout.
      //
      if ( PageId.Contains ( EuAdapter.CONST_ENTITY_FILTERED_LIST_SUFFIX ) == true )
      {

        string layoutId = PageId.Replace ( EuAdapter.CONST_ENTITY_PREFIX, String.Empty );
        layoutId = layoutId.Replace ( EuAdapter.CONST_ENTITY_FILTERED_LIST_SUFFIX, String.Empty );

        this.LogDebug ( "FILTERED: PageId: {0}, Title: {1} Layout: {2}, Filtered Query.", PageId, Title, layoutId );

        pageCommand = new Evado.UniForm.Model.Command (
          Title,
          EuAdapter.ADAPTER_ID,
          EuAdapterClasses.Entities.ToString ( ),
          Evado.UniForm.Model.ApplicationMethods.List_of_Objects );

        pageCommand.SetPageId ( Evado.Digital.Model.EdStaticPageIds.Entity_Filter_View );
        pageCommand.AddParameter ( EdRecord.FieldNames.Layout_Id, layoutId );
        pageCommand.AddParameter ( EuEntities.CONST_EMPTY_SELECTION_FIELD, "Yes" ); 

        return pageCommand;
      }

      //
      // Create the command to access a Entity by its organisation parent's identifier.  
      // i.e. retrieves an organisation's child entity layout.
      //
      if ( PageId.Contains ( EuAdapter.CONST_ORG_PARENT_PAGE_ID_SUFFIX2 ) == true )
      {
        string layoutId = PageId.Replace ( EuAdapter.CONST_ENTITY_PREFIX, String.Empty );

        this.LogDebug ( "1 layoutId: {0}.", layoutId );

        layoutId = layoutId.Replace ( EuAdapter.CONST_ORG_PARENT_PAGE_ID_SUFFIX2, String.Empty );

        this.LogDebug ( "2 Template: {0}.", EuAdapter.CONST_ORG_PARENT_PAGE_ID_SUFFIX2 );
        this.LogDebug ( "2 layoutId: {0}.", layoutId );

        this.LogDebug ( "ORG: PageId: {0}, Title: {1} Layout: {2}, Org Parent.", PageId, Title, layoutId );

        pageCommand = new Evado.UniForm.Model.Command (
          Title,
          EuAdapter.ADAPTER_ID,
          EuAdapterClasses.Entities.ToString ( ),
          Evado.UniForm.Model.ApplicationMethods.Get_Object );

        pageCommand.SetPageId ( PageId );
        pageCommand.AddParameter ( EdRecord.FieldNames.Layout_Id, layoutId );
        pageCommand.AddParameter ( EuEntities.CONST_HIDE_SELECTION, "Yes" );
        pageCommand.AddParameter (
          EdRecord.FieldNames.ParentOrgId,
          this.Session.Organisation.OrgId );

        this.LogDebug ( "Command Method: {0}.", pageCommand.Method );

        return pageCommand;
      }

      //
      // Create the command to access a Entity by its organisation parent's identifier.  
      // i.e. retrieves an organisation's child entity layout.
      //
      if ( PageId.Contains ( EuAdapter.CONST_ORG_PARENT_PAGE_ID_SUFFIX ) == true )
      {
        string layoutId = PageId.Replace ( EuAdapter.CONST_ENTITY_PREFIX, String.Empty );

        this.LogDebug ( "1 layoutId: {0}.", layoutId );

        layoutId = layoutId.Replace ( EuAdapter.CONST_ORG_PARENT_PAGE_ID_SUFFIX, String.Empty );

        this.LogDebug ( "2 Template: {0}.", EuAdapter.CONST_ORG_PARENT_PAGE_ID_SUFFIX );
        this.LogDebug ( "2 layoutId: {0}.", layoutId );

        this.LogDebug ( "ORG: PageId: {0}, Title: {1} Layout: {2}, Org Parent.", PageId, Title, layoutId );

        pageCommand = new Evado.UniForm.Model.Command (
          Title,
          EuAdapter.ADAPTER_ID,
          EuAdapterClasses.Entities.ToString ( ),
          Evado.UniForm.Model.ApplicationMethods.List_of_Objects );

        pageCommand.SetPageId ( PageId );
        pageCommand.AddParameter ( EdRecord.FieldNames.Layout_Id, layoutId );
        pageCommand.AddParameter ( EuEntities.CONST_HIDE_SELECTION, "Yes" );
        pageCommand.AddParameter (
          EdRecord.FieldNames.ParentOrgId,
          this.Session.Organisation.OrgId );

        return pageCommand;
      }

      //
      // Create the command to access a Entity by its user parent's identifier.  
      // i.e. retrieves an user's child entity layout.
      //
      else if ( PageId.Contains ( EuAdapter.CONST_USER_PARENT_PAGE_ID_SUFFIX2 ) == true )
      {
        string layoutId = PageId.Replace ( EuAdapter.CONST_ENTITY_PREFIX, String.Empty );

        this.LogDebug ( "1 layoutId: {0}.", layoutId );
        layoutId = layoutId.Replace ( EuAdapter.CONST_USER_PARENT_PAGE_ID_SUFFIX2, String.Empty );

        this.LogDebug ( "2 layoutId: {0}.", layoutId );

        this.LogDebug ( "DEF USR: PageId: {0}, Title: {1} Layout: {2}, User  Parent.", PageId, Title, layoutId );

        pageCommand = new Evado.UniForm.Model.Command (
          Title,
          EuAdapter.ADAPTER_ID,
          EuAdapterClasses.Entities.ToString ( ),
          Evado.UniForm.Model.ApplicationMethods.Get_Object );

        pageCommand.SetPageId ( PageId );
        pageCommand.AddParameter ( EdRecord.FieldNames.Layout_Id, layoutId );
        pageCommand.AddParameter ( EuEntities.CONST_HIDE_SELECTION, "Yes" );
        pageCommand.AddParameter (
          EdRecord.FieldNames.ParentUserId,
          this.Session.UserProfile.UserId );

        return pageCommand;
      }

      //
      // Create the command to access a Entity by its user parent's identifier.  
      // i.e. retrieves an user's child entity layout.
      //
      else if ( PageId.Contains ( EuAdapter.CONST_USER_PARENT_PAGE_ID_SUFFIX ) == true )
      {
        string layoutId = PageId.Replace ( EuAdapter.CONST_ENTITY_PREFIX, String.Empty );
        layoutId = layoutId.Replace ( EuAdapter.CONST_USER_PARENT_PAGE_ID_SUFFIX, String.Empty );

        this.LogDebug ( "USER: PageId: {0}, Title: {1} Layout: {2}, User  Parent.", PageId, Title, layoutId );

        pageCommand = new Evado.UniForm.Model.Command (
          Title,
          EuAdapter.ADAPTER_ID,
          EuAdapterClasses.Entities.ToString ( ),
          Evado.UniForm.Model.ApplicationMethods.List_of_Objects );

        pageCommand.SetPageId ( PageId );
        pageCommand.AddParameter ( EdRecord.FieldNames.Layout_Id, layoutId );
        pageCommand.AddParameter ( EuEntities.CONST_HIDE_SELECTION, "Yes" );
        pageCommand.AddParameter (
          EdRecord.FieldNames.ParentUserId,
          this.Session.UserProfile.UserId );

        return pageCommand;
      }

      //
      // Create the command to access a Entity by its Entity parent.  
      // i.e. retrieves an Entity's child records layout.
      //
      else if ( PageId.Contains ( EuAdapter.CONST_ENTITY_PARENT_PAGE_ID_SUFFIX ) == true )
      {
        this.LogDebug ( "A PageId: {0}, Title: {1} Entity Parent.", PageId, Title ); 

        string layoutId = PageId.Replace ( EuAdapter.CONST_ENTITY_PARENT_PAGE_ID_SUFFIX, String.Empty );

        this.LogDebug ( "1 layoutId: {0}.", layoutId );

        layoutId = layoutId.Replace ( EuAdapter.CONST_ENTITY_PREFIX, String.Empty );

        this.LogDebug ( "2 layoutId: {0}.", layoutId );

        this.LogDebug ( "PARENT: PageId: {0}, Title: {1} Layout: {2}, User  Parent.", PageId, Title, layoutId );
        pageCommand = new Evado.UniForm.Model.Command (
          Title,
          EuAdapter.ADAPTER_ID,
          EuAdapterClasses.Entities.ToString ( ),
          Evado.UniForm.Model.ApplicationMethods.List_of_Objects );

        pageCommand.SetPageId ( PageId );
        pageCommand.AddParameter ( EdRecord.FieldNames.Layout_Id, layoutId );
        pageCommand.AddParameter ( EuEntities.CONST_HIDE_SELECTION, "Yes" );
        pageCommand.AddParameter (
          EdRecord.FieldNames.ParentGuid,
          this.Session.Entity.Guid );
        pageCommand.AddParameter (
          EdRecord.FieldNames.ParentLayoutId,
          this.Session.Entity.LayoutId ); 

        return pageCommand;
      }

      //
      // Create the command to access a Entity by its Entity parent.  
      // i.e. retrieves an Entity's child records layout.
      //
      else if ( PageId.Contains ( EuAdapter.CONST_ENTITY_PARENT_PAGE_ID_SUFFIX ) == true )
      {
        this.LogDebug ( "A PageId: {0}, Title: {1} Entity Parent.", PageId, Title );

        string layoutId = PageId.Replace ( EuAdapter.CONST_ENTITY_PARENT_PAGE_ID_SUFFIX, String.Empty );

        this.LogDebug ( "1 layoutId: {0}.", layoutId );

        layoutId = layoutId.Replace ( EuAdapter.CONST_ENTITY_PREFIX, String.Empty );

        this.LogDebug ( "2 layoutId: {0}.", layoutId );

        pageCommand = new Evado.UniForm.Model.Command (
          Title,
          EuAdapter.ADAPTER_ID,
          EuAdapterClasses.Entities.ToString ( ),
          Evado.UniForm.Model.ApplicationMethods.List_of_Objects );

        pageCommand.SetPageId ( PageId );
        pageCommand.AddParameter ( EdRecord.FieldNames.Layout_Id, layoutId );
        pageCommand.AddParameter ( EuEntities.CONST_HIDE_SELECTION, "Yes" );
        pageCommand.AddParameter (
          EdRecord.FieldNames.ParentGuid,
          this.Session.Entity.Guid );

        return pageCommand;
      }
      //
      // Create the command to access Entities by their layout identifers.
      //
      else if ( PageId.Contains ( EuAdapter.CONST_ENTITY_PREFIX ) == true )
      {
        this.LogDebug ( "PageId: {0}, Title: {1} Layout.", PageId, Title ); 
        string layoutId = PageId.Replace ( EuAdapter.CONST_ENTITY_PREFIX, String.Empty );

        pageCommand = new Evado.UniForm.Model.Command (
          Title,
          EuAdapter.ADAPTER_ID,
          EuAdapterClasses.Entities.ToString ( ),
          Evado.UniForm.Model.ApplicationMethods.List_of_Objects );

        pageCommand.SetPageId ( PageId );
        pageCommand.AddParameter ( EuEntities.CONST_HIDE_SELECTION, "Yes" );
        pageCommand.AddParameter ( EdRecord.FieldNames.Layout_Id, layoutId );

        return pageCommand;

      }

      //
      // Create the command to access records by their layout identifers.
      //
      if ( PageId.Contains ( EuAdapter.CONST_RECORD_PREFIX) == true )
      {
        string layoutId = PageId.Replace ( EuAdapter.CONST_RECORD_PREFIX, String.Empty );

        pageCommand = new Evado.UniForm.Model.Command (
          Title,
          EuAdapter.ADAPTER_ID,
          EuAdapterClasses.Entities.ToString ( ),
          Evado.UniForm.Model.ApplicationMethods.Get_Object );

        pageCommand.SetPageId ( PageId );
        pageCommand.AddParameter ( EdRecord.FieldNames.Layout_Id, layoutId );

        return pageCommand;

      }
      //
      // Create the command to access a record by its organisation parent's identifier.  
      // i.e. retrieves an organisation's child entity layout.
      //
      else if ( PageId.Contains ( EuAdapter.CONST_ORG_PARENT_PAGE_ID_SUFFIX ) == true )
      {
        string layoutId = PageId.Replace ( EuAdapter.CONST_ORG_PARENT_PAGE_ID_SUFFIX, String.Empty );

        pageCommand = new Evado.UniForm.Model.Command (
          Title,
          EuAdapter.ADAPTER_ID,
          EuAdapterClasses.Records.ToString ( ),
          Evado.UniForm.Model.ApplicationMethods.Get_Object );

        pageCommand.SetPageId ( PageId );
        pageCommand.AddParameter ( EdRecord.FieldNames.Layout_Id, layoutId );
        pageCommand.AddParameter (
          EdRecord.FieldNames.ParentOrgId,
          this.Session.Organisation.OrgId );

        return pageCommand;
      }

      //
      // Create the command to access a record by its user parent's identifier.  
      // i.e. retrieves an user's child entity layout.
      //
      else if ( PageId.Contains ( EuAdapter.CONST_ORG_PARENT_PAGE_ID_SUFFIX ) == true )
      {
        string layoutId = PageId.Replace ( EuAdapter.CONST_ORG_PARENT_PAGE_ID_SUFFIX, String.Empty );

        pageCommand = new Evado.UniForm.Model.Command (
          Title,
          EuAdapter.ADAPTER_ID,
          EuAdapterClasses.Records.ToString ( ),
          Evado.UniForm.Model.ApplicationMethods.Get_Object );

        pageCommand.SetPageId ( PageId );
        pageCommand.AddParameter ( EdRecord.FieldNames.Layout_Id, layoutId );
        pageCommand.AddParameter (
          EdRecord.FieldNames.ParentUserId,
          this.Session.UserProfile.UserId );

        return pageCommand;
      }

      //
      // Create the command to access a record by its Entity parent.  
      // i.e. retrieves an Entity's child records layout.
      //
      else if ( PageId.Contains ( EuAdapter.CONST_ENTITY_PARENT_PAGE_ID_SUFFIX ) == true )
      {
        string layoutId = PageId.Replace ( EuAdapter.CONST_ENTITY_PARENT_PAGE_ID_SUFFIX, String.Empty );

        pageCommand = new Evado.UniForm.Model.Command (
          Title,
          EuAdapter.ADAPTER_ID,
          EuAdapterClasses.Records.ToString ( ),
          Evado.UniForm.Model.ApplicationMethods.List_of_Objects );

        pageCommand.SetPageId ( PageId );
        pageCommand.AddParameter ( EdRecord.FieldNames.Layout_Id, layoutId );
        pageCommand.AddParameter ( EuEntities.CONST_HIDE_SELECTION, "Yes" );
        pageCommand.AddParameter (
          EdRecord.FieldNames.ParentGuid,
          this.Session.Entity.Guid );

        return pageCommand;
      }

      return null;

    }//END convertMenuItem method
    // ==============================================================================
    /// <summary>
    /// This method creates the record view pageMenuGroup containing a list of commands to 
    /// open the form record.
    /// </summary>
    /// <param name="PageObject">Evado.Model.Uniform.Page object to add the pageMenuGroup to.</param>
    /// <param name="subjects">EvSubjects subjects to add to selection groups</param>
    /// <param name="subjectVisits">EvSubjectMilestones visits for each subject</param>
    /// <param name="QueryParameters">EvQueryParameters: conting the query parameters</param>
    /// <param name="ApplicationObject">Adapter.ApplicationObjects object.</param>
    //  ------------------------------------------------------------------------------
    private void getFilteredList_SelectionGroup (
      Evado.UniForm.Model.Page PageObject )
    {
      this.LogMethod ( "getFilteredList_SelectionGroup" );
      //
      // Initialise the methods variables and objects.
      //
      Evado.UniForm.Model.Group pageGroup = null;
      Evado.UniForm.Model.Command selectionCommand = null;
      List<EvOption> optionList;
      Evado.UniForm.Model.Field groupField;

      //
      // if hide selection group is enabled exit 
      //
      if ( this._HideSelectionGroup == true )
      {
        return;
      }

      // 
      // Create the new pageMenuGroup for record selection.
      // 
      pageGroup = PageObject.AddGroup (
        EdLabels.Entities_Selection_Group_Title,
        Evado.UniForm.Model.EditAccess.Enabled );
      pageGroup.GroupType = Evado.UniForm.Model.GroupTypes.Default;
      pageGroup.Layout = Evado.UniForm.Model.GroupLayouts.Full_Width;
      pageGroup.AddParameter ( Evado.UniForm.Model.GroupParameterList.Offline_Hide_Group, true );

      //
      // if the entity is not selected display an entity selection field.
      //
      if ( this.Session.Selected_EntityLayoutId == String.Empty )
      {
        // 
        // Add the record state selection option
        //
        optionList = new List<EvOption> ( );
        optionList.Add ( new EvOption ( ) );
        foreach ( EdRecord layout in this.AdapterObjects.IssuedEntityLayouts )
        {
          optionList.Add ( layout.SelectionOption );
        }

        groupField = pageGroup.createSelectionListField (
          EdRecord.FieldNames.Layout_Id,
          EdLabels.Label_Form_Id,
          this.Session.Selected_EntityLayoutId,
          optionList );

        groupField.Layout = EuAdapter.DefaultFieldLayout;
        groupField.AddParameter ( Evado.UniForm.Model.FieldParameterList.Snd_Cmd_On_Change, 1 );

        // 
        // Add the selection groupCommand
        // 
       selectionCommand = pageGroup.addCommand (
          EdLabels.Entities_Selection_Command_Title,
          EuAdapter.ADAPTER_ID,
          EuAdapterClasses.Entities.ToString ( ),
          Evado.UniForm.Model.ApplicationMethods.Custom_Method );

        selectionCommand.setCustomMethod ( Evado.UniForm.Model.ApplicationMethods.List_of_Objects );

        selectionCommand.SetPageId ( Evado.Digital.Model.EdStaticPageIds.Entity_Filter_View );

        this.LogDebug ( "Group Command Count {0}. ", pageGroup.CommandList.Count );
        this.LogMethodEnd ( "getFilteredList_SelectionGroup" );
        return;

      }//END layoutId selection

      //
      // if the entity layout id has been defined display the entity selection fields.
      //
      //
      // retrieve the selected entity layout object
      //
      this.queryLayout = this.AdapterObjects.GetEntityLayout ( this.Session.Selected_EntityLayoutId );

      this.LogDebug ( "E: {0} S: {1}.", queryLayout.LayoutId, queryLayout.State );
      this.LogDebug ( "Entity {0}. ", queryLayout.CommandTitle );

      this.LogDebug ( "StaticQueryFilterOptions {0}. ", this.AdapterObjects.Settings.StaticQueryFilterOptions );

      //
      // Insert the static filter selection for organisation city.
      //
      if ( this.AdapterObjects.Settings.StaticQueryFilterOptions.Contains ( EdOrganisation.FieldNames.Address_Country.ToString ( ) ) == true )
      {
        this.getQueryList_StaticOrgFilter ( pageGroup, EdOrganisation.FieldNames.Address_Country );
      }
      if ( this.AdapterObjects.Settings.StaticQueryFilterOptions.Contains ( EdOrganisation.FieldNames.Address_City.ToString ( ) ) == true )
      {
        this.getQueryList_StaticOrgFilter ( pageGroup, EdOrganisation.FieldNames.Address_City );
      }
      if ( this.AdapterObjects.Settings.StaticQueryFilterOptions.Contains ( EdOrganisation.FieldNames.Address_Post_Code.ToString ( ) ) == true )
      {
        this.getQueryList_StaticOrgFilter ( pageGroup, EdOrganisation.FieldNames.Address_Post_Code );
      }

      //
      // iterate through the filter field ids and display the filter field in the selection group.
      //
      for ( int filterIndex = 0; filterIndex < queryLayout.FilterFieldIds.Length; filterIndex++ )
      {
        string fieldId = queryLayout.FilterFieldIds [ filterIndex ];

        if ( fieldId == String.Empty )
        {
          continue;
        }

        this.LogDebug ( "fieldId {0}. ", fieldId );
        //
        // retrieve the matching field object.
        //
        EdRecordField field = queryLayout.GetFieldObject ( fieldId );

        if ( field == null )
        {
          continue;
        }

        this.LogDebug ( "field.FieldId {0} - {1}. ", field.FieldId, field.Title );

        //
        // retrieve the current selection filter value.
        //
        string selectionFilter = this.Session.EntitySelectionFilters [ filterIndex ];
        this.LogDebug ( "selectionFilter {0}. ", selectionFilter );

        //
        // create the selection field object for the selected field.
        //
        this.getFilteredList_SelectionField (
          pageGroup,
          filterIndex,
          selectionFilter,
          field );
      }//END of the Selection filter iteration loop.

      // 
      // Add the selection groupCommand
      // 
      selectionCommand = pageGroup.addCommand (
        EdLabels.Entities_Selection_Command_Title,
        EuAdapter.ADAPTER_ID,
        EuAdapterClasses.Entities.ToString ( ),
        Evado.UniForm.Model.ApplicationMethods.Custom_Method );

      selectionCommand.setCustomMethod ( Evado.UniForm.Model.ApplicationMethods.List_of_Objects );

      selectionCommand.SetPageId ( Evado.Digital.Model.EdStaticPageIds.Entity_Filter_View );
      ;
      this.LogDebug ( "Group Command Count {0}. ", pageGroup.CommandList.Count );
      this.LogMethodEnd ( "getFilteredList_SelectionGroup" );

    }//ENd getFilteredList_SelectionGroup method
    }//END getFormPropertiesObject method

    // ==============================================================================
    /// <summary>
    /// This method returns a client application ResultData object
    /// </summary>
    /// <param name="ClientDataObject">Evado.UniForm.Model.AppData object.</param>
    //  ------------------------------------------------------------------------------
    private void getPropertiesSectionDataObject (
      Evado.UniForm.Model.AppData ClientDataObject )
    {
      this.LogMethod ( "getPropertiesSectionDataObject" );
      this.LogDebug ( "FormSection.No: " + this.Session.FormSection.No );
      this.LogDebug ( "FormSection.Title: " + this.Session.FormSection.Title );
      this.LogDebug ( "FormSection.DisplayRoles: " + this.Session.FormSection.ReadAccessRoles );
      this.LogDebug ( "FormSection.EditRoles: " + this.Session.FormSection.EditAccessRoles );
      this.LogDebug ( "HasConfigrationEditAccess: " + this.Session.UserProfile.hasManagementAccess );
      // 
      // Initialise the methods variables and objects.
      // 
      Evado.UniForm.Model.Group pageGroup = new Evado.UniForm.Model.Group ( );
      Evado.UniForm.Model.Command pageCommand = new Evado.UniForm.Model.Command ( );
      Evado.UniForm.Model.Field pageField = new Evado.UniForm.Model.Field ( );
      Evado.UniForm.Model.Parameter parameter = new Evado.UniForm.Model.Parameter ( );
      List<EvOption> optionList = new List<EvOption> ( );
      optionList.Add ( new EvOption ( ) );

      foreach ( EdRecordField field in this.Session.EntityLayout.Fields )
      {
        optionList.Add ( new EvOption (
          field.FieldId,
          field.FieldId
          + EdLabels.Space_Hypen
          + field.Title ) );
      }

      // 
      // Initialise the client ResultData object.
      // 
      if ( this.Session.EntityLayout.Guid != Guid.Empty )
      {
        ClientDataObject.Id = Guid.NewGuid ( );
        ClientDataObject.Title =
          String.Format (
          EdLabels.FormProperties_Section_Page_Title,
          this.Session.EntityLayout.LayoutId,
          this.Session.EntityLayout.Title,
          this.Session.FormSection.LinkText );
        ClientDataObject.Page.Id = ClientDataObject.Id;
        ClientDataObject.Page.PageDataGuid = ClientDataObject.Id;
        ClientDataObject.Page.PageId = this.Session.EntityLayout.LayoutId;
      }
      else
      {
        ClientDataObject.Id = Guid.NewGuid ( );
        ClientDataObject.Title = EdLabels.Form_Page_New_Form_Title;
        ClientDataObject.Page.Id = ClientDataObject.Id;
        ClientDataObject.Page.PageDataGuid = ClientDataObject.Id;
      }
      ClientDataObject.Page.EditAccess = Evado.UniForm.Model.EditAccess.Enabled;

      if ( this.Session.UserProfile.hasManagementAccess == true )
      {
        ClientDataObject.Page.EditAccess = Evado.UniForm.Model.EditAccess.Enabled;
      }

      if ( this.Session.EntityLayout.State != EdRecordObjectStates.Form_Issued
        && this.Session.EntityLayout.State != EdRecordObjectStates.Withdrawn )
      {
        ClientDataObject.Page.EditAccess = Evado.UniForm.Model.EditAccess.Disabled;
      }

      //
      // Set the user's edit access if they have configuration edit access.
      //


      if ( this.Session.UserProfile.hasManagementAccess == true )
      {
        ClientDataObject.Page.EditAccess = Evado.UniForm.Model.EditAccess.Enabled;
      }

      pageGroup = ClientDataObject.Page.AddGroup (
        EdLabels.FormProperties_Section_Group_Text,
        Evado.UniForm.Model.EditAccess.Inherited );
      pageGroup.Layout = Evado.UniForm.Model.GroupLayouts.Full_Width;

      //
      // Form No
      //
      pageField = pageGroup.createTextField (
        EdRecordSection.FormSectionClassFieldNames.Sectn_No.ToString ( ),
        EdLabels.Form_Section_No_Field_Label,
        this.Session.FormSection.No.ToString ( ),
        50 );
      pageField.Layout = EuAdapter.DefaultFieldLayout;
      pageField.EditAccess = Evado.UniForm.Model.EditAccess.Enabled;

      //
      // Form title
      //
      pageField = pageGroup.createTextField (
        EdRecordSection.FormSectionClassFieldNames.Sectn_Title.ToString ( ),
        EdLabels.Form_Section_Title_Field_Label,
        this.Session.FormSection.Title,
        50 );
      pageField.Layout = EuAdapter.DefaultFieldLayout;

      //
      // Form Instructions
      //
      pageField = pageGroup.createFreeTextField (
        EdRecordSection.FormSectionClassFieldNames.Sectn_Instructions.ToString ( ),
        EdLabels.Form_Section_Instructions_Field_Label,
        EdLabels.Form_Section_Instructions_Field_Description,
        this.Session.FormSection.Instructions,
        90, 5 );
      pageField.Layout = EuAdapter.DefaultFieldLayout;

      optionList = new List<EvOption> ( );

      this.LogDebug ( "FormSection.Order: " + this.Session.FormSection.Order );
      foreach ( EdRecordSection section in this.Session.EntityLayout.Design.FormSections )
      {
        if ( section.Order < this.Session.FormSection.Order )
        {
          this.LogDebug ( "secttion.Order: " + section.Order + " BEFORE SECTION" );

          var value = String.Format ( EdLabels.Form_Section_Order_Before_Text, section.Title );
          optionList.Add ( new EvOption ( ( section.Order - 1 ).ToString ( ), value ) );
        }
        if ( section.Order == this.Session.FormSection.Order )
        {
          this.LogDebug ( "secttion.Order: " + section.Order + " CURRENT" );
          optionList.Add ( new EvOption (
            this.Session.FormSection.Order.ToString ( ),
            this.Session.FormSection.Title ) );
        }
        if ( section.Order > this.Session.FormSection.Order )
        {
          this.LogDebug ( "secttion.Order: " + section.Order + " AFTER SECTION" );
          var value = String.Format ( EdLabels.Form_Section_Order_After_Text, section.Title );
          optionList.Add ( new EvOption ( ( section.Order + 1 ).ToString ( ), value ) );
        }
      }

      //
      // The form section order 
      //
      pageField = pageGroup.createSelectionListField (
        EdRecordSection.FormSectionClassFieldNames.Sectn_Order.ToString ( ),
        EdLabels.Form_Section_Order_Field_Label,
        this.Session.FormSection.Order.ToString ( ),
        optionList );
      pageField.Layout = EuAdapter.DefaultFieldLayout;

      /*
      //
      // The form section field id 
      //
      pageField = pageGroup.createSelectionListField (
        EvFormSection.FormSectionClassFieldNames.Sectn_Field_Id.ToString ( ),
        EdLabels.Form_Section_Field_ID_Field_Label,
        this.SessionObjects.FormSection.FieldId,
        optionList );
      pageField.Layout = EuPageGenerator.ApplicationFieldLayout;

      //
      // Form Field value
      //
      pageField = pageGroup.createTextField (
        EvFormSection.FormSectionClassFieldNames.Sectn_Field_Value.ToString ( ),
        EdLabels.Form_Section_Field_Value_Field_Label,
        this.SessionObjects.FormSection.FieldValue,
        50 );
      pageField.Layout = EuPageGenerator.ApplicationFieldLayout;
      pageField.EditAccess = Evado.UniForm.Model.EditAccess.Inherited;

      //
      // form secton on open display section.
      //
      pageField = pageGroup.createBooleanField (
        EvFormSection.FormSectionClassFieldNames.Sectn_On_Open_Visible.ToString ( ),
        EdLabels.Form_Section_Visible_On_Open_Field_Label,
        this.SessionObjects.FormSection.OnOpenVisible );
      pageField.Layout = EuPageGenerator.ApplicationFieldLayout;

      //
      // Form on field value match display field field
      //
      pageField = pageGroup.createBooleanField (
        EvFormSection.FormSectionClassFieldNames.Sectn_On_Match_Visible.ToString ( ),
        EdLabels.Form_Section_Visible_Field_Value_Matches_Field_Label,
        this.SessionObjects.FormSection.OnMatchVisible );
      pageField.Layout = EuPageGenerator.ApplicationFieldLayout;
      */
      //
      // get the list of display roles.
      //
      optionList = new List<EvOption> ( );

      optionList = this.AdapterObjects.Settings.GetRoleOptionList ( false );

      //
      // The form section user display roles 
      //
      pageField = pageGroup.createCheckBoxListField (
        EdRecordSection.FormSectionClassFieldNames.Sectn_Display_Roles.ToString ( ),
        EdLabels.Form_Section_User_Display_Roles_Field_Label,
        EdLabels.Form_Section_User_Display_Roles_Field_Description,
        this.Session.FormSection.ReadAccessRoles,
        optionList );
      pageField.Layout = EuAdapter.DefaultFieldLayout;

      //
      // get the list of edit roles.
      //
      pageField = pageGroup.createCheckBoxListField (
        EdRecordSection.FormSectionClassFieldNames.Sectn_Edit_Roles.ToString ( ),
        EdLabels.Form_Section_User_Edit_Roles_Field_Label,
        EdLabels.Form_Section_User_Edit_Roles_Field_Description,
        this.Session.FormSection.EditAccessRoles,
        optionList );
      pageField.Layout = EuAdapter.DefaultFieldLayout;

      //
      // Add the command to save the page content.
      //
      pageCommand = pageGroup.addCommand (
        EdLabels.Form_Properties_Section_Save_Command_Title,
        EuAdapter.ADAPTER_ID,
        EuAdapterClasses.Entity_Layouts.ToString ( ),
        Evado.UniForm.Model.ApplicationMethods.Custom_Method );

      pageCommand.SetPageId ( Evado.Digital.Model.EdStaticPageIds.Form_Properties_Page );
      pageCommand.setCustomMethod ( Evado.UniForm.Model.ApplicationMethods.Get_Object );
      pageCommand.SetGuid ( this.Session.EntityLayout.Guid );
      pageCommand.AddParameter ( EuRecordLayouts.CONST_UPDATE_SECTION_COMMAND_PARAMETER, "1" );


    }//END getPropertiesDataObject Method