}//END getProperties_SectionsPageGroup Method

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

    #region Form properties Section page.

    // ==============================================================================
    /// <summary>
    /// This method returns a client application ResultData object
    /// </summary>
    /// <param name="PageCommand">Evado.UniForm.Model.Command object.</param>
    /// <returns>Evado.UniForm.Model.AppData object</returns>
    //  ------------------------------------------------------------------------------
    private Evado.UniForm.Model.AppData getPropertiesSectionObject (
      Evado.UniForm.Model.Command PageCommand )
    {
      this.LogMethod ( "getFormPropertiesSection" );

      // 
      // Initialise the methods variables and objects.
      // 
      Evado.UniForm.Model.AppData clientDataObject = new Evado.UniForm.Model.AppData ( );
      Guid formGuid = Guid.Empty;
      int SectionNo = 0;

      try
      {
        string value = PageCommand.GetParameter ( EdRecordSection.FormSectionClassFieldNames.Sectn_No.ToString ( ) );
        this.LogDebug ( "Parameter value: " + value );

        if ( value != String.Empty )
        {
          if ( int.TryParse ( value, out SectionNo ) == false )
          {
            SectionNo = 0;
          }
        }

        if ( this.getSection ( SectionNo ) == false )
        {
          return null;
        }

        // 
        // Generate the client ResultData object for the UniForm client.
        // 
        this.getPropertiesSectionDataObject ( clientDataObject );

        this.LogMethodEnd ( "getFormPropertiesSection" );
        // 
        // Return the client ResultData object to the calling method.
        // 
        return clientDataObject;
      }
      catch ( Exception Ex )
      {
        // 
        // On an exception raised create the error message to be displayed to the user.
        // 
        this.ErrorMessage = EdLabels.Form_Retrieve_Error_Message;

        // 
        // Generate the log the error event.
        // 
        this.LogException ( Ex );
      }
      this.LogMethodEnd ( "getFormPropertiesSection" );
      return null;

    }//END getFormPropertiesObject method
    }//END updateObjectValue method.

    // ==================================================================================
    /// <summary>
    /// THis method saves the ResultData object updating the field values contained in the 
    /// parameter list.
    /// </summary>
    /// <param name="PageCommand">Evado.UniForm.Model.Command updated.</param>
    /// <returns></returns>
    //  ----------------------------------------------------------------------------------
    private void updateUserAddressValue (
      Evado.UniForm.Model.Command PageCommand )
    {
      this.LogMethod ( "updateAddressValue" );
      this.LogDebug ( "Parameters.Count: " + PageCommand.Parameters.Count );

      //
      // Get the organisation's address 
      //
      String stAddress = PageCommand.GetParameter ( EuUserProfiles.CONST_ADDRESS_FIELD_ID );

      //
      // If there is no address object exit.
      //
      if ( stAddress == String.Empty )
      {
        this.LogDebug ( "Address string empty" );
        this.LogMethodEnd ( "updateAddressValue" );
        return;
      }

      if ( stAddress.Contains ( ";" ) == false )
      {
        this.LogDebug ( "Address missing delimiters." );
        this.LogMethodEnd ( "updateAddressValue" );
        return;
      }

      String [ ] arAddress = stAddress.Split ( ';' );

      this.LogDebug ( "Address array length is {0}.", arAddress.Length );
      if ( arAddress.Length > 5 )
      {
        this.Session.UserProfile.Address_1 = arAddress [ 0 ];
        this.Session.UserProfile.Address_2 = arAddress [ 1 ];
        this.Session.UserProfile.AddressCity = arAddress [ 2 ];
        this.Session.UserProfile.AddressState = arAddress [ 3 ];
        this.Session.UserProfile.AddressPostCode = arAddress [ 4 ];
        this.Session.UserProfile.AddressCountry = arAddress [ 5 ];
      }
      this.LogMethodEnd ( "updateAddressValue" );

    }//END updateAddressValue Method
    }//END method


    // ==================================================================================
    /// <summary>
    /// THis method updates the organisation object.
    /// </summary>
    //  ----------------------------------------------------------------------------------
    private EvEventCodes saveUserProfile ( Evado.UniForm.Model.Command PageCommand )
    {
      this.LogMethod ( "saveUserProfile" );
      //
      // Initialise the methods variables and objecs.
      //

      // 
      // Get the save action message value.
      // 
      String stSaveAction = PageCommand.GetParameter ( Evado.Digital.Model.EvcStatics.CONST_SAVE_ACTION );

      // 
      // update the object.
      // 
      var result = this._Bll_UserProfiles.saveItem ( this.Session.UserProfile );

      // 
      // get the debug ResultData.
      // 
      this.LogDebugClass ( this._Bll_UserProfiles.Log );

      // 
      // if an error state is returned create log the event.
      //
      if ( result != EvEventCodes.Ok )
      {
        string StEvent = this._Bll_UserProfiles.Log + " returned error message: " + Evado.Digital.Model.EvcStatics.getEventMessage ( result );
        this.LogError ( EvEventCodes.Database_Record_Update_Error, StEvent );

        this.ErrorMessage = EdLabels.User_Profile_Save_Error_Message;

        return result;
      }

      this.LogMethodEnd ( "saveUserProfile" );
      return EvEventCodes.Ok;
    }//ENd saveUserProfile method
    // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    #endregion

    #region Class public methods

    // ==================================================================================
    /// <summary>
    /// This method gets the trial site object
    /// </summary>
    /// <param name="PageCommand">ClientPateEvado.UniForm.Model.Command object</param>
    /// <returns>ClientApplicationData</returns>
    //  ----------------------------------------------------------------------------------
    public override Evado.UniForm.Model.AppData getDataObject (
      Evado.UniForm.Model.Command PageCommand )
    {
      this.LogMethod ( "getDataObject" );
      this.LogValue ( "PageCommand Content: " + PageCommand.getAsString ( false, false ) );
      try
      {
        // 
        // Initialise the methods variables and objects.
        // 
        Evado.UniForm.Model.AppData clientDataObject = new Evado.UniForm.Model.AppData ( );

        if ( PageCommand.hasParameter ( EdOrganisation.FieldNames.Org_Type ) == true )
        {
          this.Session.SelectedOrganisationType = PageCommand.GetParameter ( EdOrganisation.FieldNames.Org_Type );
        }
        if ( PageCommand.hasParameter ( Evado.UniForm.Model.CommandParameters.Custom_Method ) == true )
        {
          this.Session.AdminOrganisationList = new List<EdOrganisation> ( );
        }
        this.LogValue ( "SelectedOrganisationType: " + this.Session.SelectedOrganisationType );

        // 
        // Determine the method to be called
        // 
        switch ( PageCommand.Method )
        {
          case Evado.UniForm.Model.ApplicationMethods.List_of_Objects:
            {
              clientDataObject = this.getListObject ( PageCommand );
              break;
            }
          case Evado.UniForm.Model.ApplicationMethods.Get_Object:
            {
              clientDataObject = this.getObject ( PageCommand );
              break;
            }
          case Evado.UniForm.Model.ApplicationMethods.Create_Object:
            {
              clientDataObject = this.createObject ( PageCommand );
              break;
            }
          case Evado.UniForm.Model.ApplicationMethods.Save_Object:
          case Evado.UniForm.Model.ApplicationMethods.Delete_Object:
            {
              // 
              // Update the object values
              // 
              clientDataObject = this.updateObject ( PageCommand );
              break;
            }

        }//END Switch

        // 
        // Handle returned exceptions.
        // 
        if ( clientDataObject == null )
        {
          this.LogDebug ( " null application data returned." );
          clientDataObject = this.Session.LastPage;
        }

        //
        // If an errot message exist display it.
        //
        if ( this.ErrorMessage != String.Empty )
        {
          clientDataObject.Message = this.ErrorMessage;
        }

        // 
        // return the client ResultData object.
        // 
        this.LogMethodEnd ( "getDataObject" );
        return clientDataObject;
      }
      catch ( Exception Ex )
      {
        this.LogException ( Ex );
      }
      this.LogMethodEnd ( "getDataObject" );
      return this.Session.LastPage;

    }//END getDataObject method
    }//END method

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

    #region Class update object methods

    // ==================================================================================
    /// <summary>
    /// THis method saves the ResultData object updating the field values contained in the 
    /// parameter list.
    /// </summary>
    /// <param name="PageCommand">Evado.UniForm.Model.ClientClientDataObjectEvado.UniForm.Model.Command object.</param>
    /// <remarks>
    /// This method has following steps:
    /// 
    /// 1. Update the object values from command parameter values.
    /// 
    /// 2. Update the address fields of the customer.
    /// 
    /// 3. Save the updated fields to the respective tables in Evado Database.
    /// </remarks>
    /// <returns>Application Data object</returns>
    //  ----------------------------------------------------------------------------------
    private Evado.UniForm.Model.AppData updateObject ( Evado.UniForm.Model.Command PageCommand )
    {
      try
      {
        this.LogMethod ( "updateObject" );
        this.LogDebug ( "PageCommand: " + PageCommand.getAsString ( false, true ) );

        this.LogDebug ( "AdminOrganisation" );
        this.LogDebug ( "-Guid: " + this.Session.AdminOrganisation.Guid );
        this.LogDebug ( "-OrgId: " + this.Session.AdminOrganisation.OrgId );
        this.LogDebug ( "-Title: " + this.Session.AdminOrganisation.Name );
        EdOrganisation.ActionCodes saveAction = EdOrganisation.ActionCodes.Save;
        this._CurrentFileName = this.Session.AdminOrganisation.ImageFileName;

        // 
        // Log access to page.
        // 
        this.LogPageAccess (
          this.ClassNameSpace + "updateObject",
          this.Session.UserProfile );

        // 
        // Initialise the update variables.
        // 
        this.Session.AdminOrganisationList = new List<EdOrganisation> ( );

        // 
        // IF the guid is new object id  alue then set the save object for adding to the database.
        // 
        if ( this.Session.AdminOrganisation.Guid == Evado.Digital.Model.EvcStatics.CONST_NEW_OBJECT_ID )
        {
          this.Session.AdminOrganisation.Guid = Guid.Empty;
        }

        // 
        // Delete the object.
        // 
        if ( PageCommand.Method == Evado.UniForm.Model.ApplicationMethods.Delete_Object )
        {
          return new Evado.UniForm.Model.AppData ( );
        }

        // 
        // Update the object.
        // 
        this.updateObjectValue ( PageCommand.Parameters );


        //
        // check that the mandatory fields have been filed.
        //
        if ( this.updateCheckMandatory ( ) == false )
        {
          return this.Session.LastPage;
        }

        //
        // copy the image file to the image directory.
        //
        this.saveImageFile ( );

        this.LogDebug ( "AddressStreet_1: " + this.Session.AdminOrganisation.AddressStreet_1 );
        this.LogDebug ( "AddressStreet_2: " + this.Session.AdminOrganisation.AddressStreet_2 );
        this.LogDebug ( "AddressCity: " + this.Session.AdminOrganisation.AddressCity );
        this.LogDebug ( "AddressState: " + this.Session.AdminOrganisation.AddressState );
        this.LogDebug ( "AddressCountry: " + this.Session.AdminOrganisation.AddressCountry );
        this.LogDebug ( "AddressPostCode: " + this.Session.AdminOrganisation.AddressPostCode );

        // 
        // Get the save action message value.
        // 
        String stSaveAction = PageCommand.GetParameter ( Evado.Digital.Model.EvcStatics.CONST_SAVE_ACTION );

        // 
        // Resets the save action to the parameter passed in the page groupCommand.
        // 
        if ( stSaveAction != String.Empty )
        {
          saveAction = Evado.Model.EvStatics.parseEnumValue<EdOrganisation.ActionCodes> ( stSaveAction );
        }
        this.Session.AdminOrganisation.Action = saveAction;


        // 
        // update the object.
        // 
        EvEventCodes result = this._Bll_Organisations.saveItem ( this.Session.AdminOrganisation );

        // 
        // get the debug ResultData.
        // 
        this.LogValue ( this._Bll_Organisations.Log );

        // 
        // if an error state is returned create log the event.
        // 
        if ( result != EvEventCodes.Ok )
        {
          string StEvent = this._Bll_Organisations.Log + " returned error message: " + Evado.Digital.Model.EvcStatics.getEventMessage ( result );
          this.LogError ( EvEventCodes.Database_Record_Update_Error, StEvent );

          switch ( result )
          {
            case EvEventCodes.Data_Duplicate_Id_Error:
              {
                this.ErrorMessage =
                  String.Format (
                    EdLabels.Organisation_Duplicate_Error_Message,
                    this.Session.AdminOrganisation.OrgId );
                break;
              }
            case EvEventCodes.Identifier_Org_Id_Error:
              {
                this.ErrorMessage = EdLabels.Organisation_Identifier_Empty_Error_Message;
                break;
              }
            default:
              {
                this.ErrorMessage = EdLabels.Organisation_Update_Error_Message;
                break;
              }
          }
          return this.Session.LastPage;
        }//END save error returned.

        this.Session.AdminOrganisationList = new List<EdOrganisation> ( );
        this.AdapterObjects.OrganisationList = new List<EdOrganisation> ( );

        return new Evado.UniForm.Model.AppData ( );

      }
      catch ( Exception Ex )
      {
        // 
        // Create the error message to be displayed to the user.
        // 
        this.ErrorMessage = EdLabels.Organisation_Update_Error_Message;

        // 
        // Generate the log the error event.
        // 
        this.LogException ( Ex );
      }
      return this.Session.LastPage;

    }//END method
    }//END getDataObject_ExitPage method

    // ==================================================================================
    /// <summary>
    /// THis method saves the ResultData object updating the field values contained in the 
    /// parameter list.
    /// </summary>
    /// <param name="PageCommand">Evado.UniForm.Model.ClientClientDataObjectEvado.UniForm.Model.Command object.</param>
    /// <returns>Application Data object</returns>
    //  ----------------------------------------------------------------------------------
    private EvEventCodes RegisterUserDetails (
      Evado.UniForm.Model.Command PageCommand )
    {
      this.LogMethod ( "RegisterUserDetails" );
      try
      {
        // 
        // Initialise the methods variables and objects.
        //      
        Evado.UniForm.Model.AppData clientDataObject = new Evado.UniForm.Model.AppData ( );
        EvEventCodes result;

        // 
        // Update the object.
        // 
        if ( this.updateObjectValue ( PageCommand ) == false )
        {
          this.ErrorMessage = EdLabels.UserProfile_Value_Update_Error_Message;

          this.LogMethodEnd ( "RegisterUserDetails" );
          return EvEventCodes.Value_Update_Processing_Error;
        }

        this.LogValue ( "Guid: " + this.Session.AdminUserProfile.Guid );
        this.LogValue ( "UserId: " + this.Session.AdminUserProfile.UserId );
        this.LogValue ( "CommonName: " + this.Session.AdminUserProfile.CommonName );

        this.Session.AdminUserProfile.UserId = EvStatics.CleanSamUserId (
          this.Session.AdminUserProfile.UserId );

        if ( PageCommand.hasParameter ( EuUserRegistration.CONST_NEW_PASSWORD_PARAMETER ) == true )
        {
          this.LogValue ( "Creating a new password." );
          this.createDefaultPassword ( );
        }

        this.LogValue ( "AdminUserProfile.Password: "******"RegisterUserDetails" );
          return result;
        }

        this.LogMethodEnd ( "RegisterUserDetails" );

        return EvEventCodes.Ok;

      }
      catch ( Exception Ex )
      {
        // 
        // Create the error message to be displayed to the user.
        // 
        this.ErrorMessage = EdLabels.User_Profile_Save_Error_Message;

        // 
        // Generate the log the error event.
        // 
        this.LogException ( Ex );
      }

      this.LogMethodEnd ( "RegisterUserDetails" );
      return EvEventCodes.Database_Record_Update_Error;

    }//END RegisterUserDetails method
Пример #7
0
    }//END getListObject method.


    // ==================================================================================
    /// <summary>
    /// This methods saves the event log selection parameters to the session object.
    /// </summary>
    //  ---------------------------------------------------------------------------------
    private void saveEventLogSelectionParameters (
      Evado.UniForm.Model.Command PageCommand )
    {
      this.LogMethod ( "saveEventLogSelectionParameters" );
      //
      // Retrieve the selection options.
      //
      String value = String.Empty;
      this.Session.EventId = EvEventCodes.Null;

      //
      // Start date selection
      //
      if ( PageCommand.hasParameter ( EuApplicationEvents.CONST_START_DATE_FIELD_ID ) == true )
      {
        var startDate = EvStatics.getDateTime ( PageCommand.GetParameter ( EuApplicationEvents.CONST_START_DATE_FIELD_ID ) );

        this.LogValue ( "startDate: " + startDate );

        if ( this.Session.EventStartDate != startDate )
        {
          this.Session.EventStartDate = startDate;
          this.Session.ApplicationEventList = new List<EvApplicationEvent> ( );
        }
      }

      //
      // finish data selection.
      //
      if ( PageCommand.hasParameter ( EuApplicationEvents.CONST_FINISH_DATE_FIELD_ID ) == true )
      {
        var finishDate = EvStatics.getDateTime ( PageCommand.GetParameter ( EuApplicationEvents.CONST_FINISH_DATE_FIELD_ID ) );

        if ( this.Session.EventFinishDate != finishDate )
        {
          this.Session.EventFinishDate = finishDate;
          this.Session.ApplicationEventList = new List<EvApplicationEvent> ( );
        }
      }

      //
      // Event Identifier selection.
      //
      if ( PageCommand.hasParameter ( EuApplicationEvents.CONST_EVENT_FIELD_ID ) == true )
      {
        var eventId = PageCommand.GetParameter<EvEventCodes> ( EuApplicationEvents.CONST_EVENT_FIELD_ID );

        if ( eventId != this.Session.EventId )
        {
          this.Session.EventId = eventId;
          this.Session.ApplicationEventList = new List<EvApplicationEvent> ( );
        }
      }

      //
      // Event type selection.
      //
      this.Session.EventType = PageCommand.GetParameter ( EuApplicationEvents.CONST_TYPE_FIELD_ID );

      if ( PageCommand.hasParameter ( EuApplicationEvents.CONST_TYPE_FIELD_ID ) == true )
      {
        var eventId = PageCommand.GetParameter ( EuApplicationEvents.CONST_TYPE_FIELD_ID );

        if ( eventId != this.Session.EventType )
        {
          this.Session.EventType = eventId;
          this.Session.ApplicationEventList = new List<EvApplicationEvent> ( );
        }
      }

      //
      // user selection
      //
      this.Session.EventUserName = PageCommand.GetParameter ( EuApplicationEvents.CONST_USER_FIELD_ID );

      //
      // set the minimium event range.
      //
      if ( this.Session.EventStartDate == Evado.Digital.Model.EvcStatics.CONST_DATE_MIN_RANGE )
      {
        this.Session.EventStartDate =
         Evado.Digital.Model.EvcStatics.getDateTime ( DateTime.Now.ToString ( "dd MMM yyyy" ) );
        this.Session.EventFinishDate = this.Session.EventStartDate.AddDays ( 1 );
      }

      this.LogValue ( "EventId: " + this.Session.EventId );
      this.LogValue ( "EventType: " + this.Session.EventType );
      this.LogValue ( "EventUserName: "******"EventStartDate: " + this.Session.EventStartDate );
      this.LogValue ( "EventFinishDate: " + this.Session.EventFinishDate );
      this.LogValue ( "ApplicationEventList.Count: " + this.Session.ApplicationEventList.Count );
      this.LogMethodEnd ( "saveEventLogSelectionParameters" );

    }//END Method
    // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    #endregion

    #region Class public methods

    // ==================================================================================
    /// <summary>
    /// This method gets the trial site object.
    /// 
    /// </summary>
    /// <param name="PageCommand">ClientPateEvado.UniForm.Model.Command object</param>
    /// <returns>Evado.UniForm.Model.AppData</returns>
    //  ----------------------------------------------------------------------------------
    override public Evado.UniForm.Model.AppData getDataObject (
      Evado.UniForm.Model.Command PageCommand )
    {
      this.LogMethod ( "getClientDataObject" );

      this.LogValue ( "PageCommand Content: " + PageCommand.getAsString ( false, false ) );
      try
      {
        // 
        // Initialise the methods variables and objects.
        // 
        bool bResult = true;
        Evado.UniForm.Model.AppData clientDataObjectObject = new Evado.UniForm.Model.AppData ( );

        //
        // Determine if the user has access to this page and log and error if they do not.
        //
        if ( this.Session.UserProfile.hasAdministrationAccess == false )
        {
          this.LogIllegalAccess (
            this.ClassNameSpace + "getListObject",
            this.Session.UserProfile );

          this.ErrorMessage = EdLabels.Illegal_Page_Access_Attempt;

          return null;
        }

        // 
        // Log access to page.
        // 
        this.LogPageAccess (
          this.ClassNameSpace + "getObject",
          this.Session.UserProfile );

        if ( this.AdapterObjects.ContentTemplates == null )
        {
          this.AdapterObjects.ContentTemplates = new EvStaticContentTemplates ( );

          this.AdapterObjects.ContentTemplates =
            EvStatics.Files.readXmlFile<EvStaticContentTemplates> (
            this.AdapterObjects.ApplicationPath, EuStaticContentTemplates.CONST_EMAIL_TEMPLATE_FILENAME );
        }

        if ( this.AdapterObjects.ContentTemplates == null )
        {
          this.AdapterObjects.ContentTemplates = new EvStaticContentTemplates ( );
        }
        if ( this.AdapterObjects.ContentTemplates.IntroductoryEmail_Title == null )
        {
          this.AdapterObjects.ContentTemplates.IntroductoryEmail_Title = String.Empty;
          this.AdapterObjects.ContentTemplates.IntroductoryEmail_Body = String.Empty;
          this.AdapterObjects.ContentTemplates.UpdatePasswordEmail_Title = String.Empty;
          this.AdapterObjects.ContentTemplates.UpdatePasswordEmail_Body = String.Empty;
          this.AdapterObjects.ContentTemplates.ResetPasswordEmail_Body = String.Empty;
          this.AdapterObjects.ContentTemplates.ResetPasswordEmail_Body = String.Empty;
          this.AdapterObjects.ContentTemplates.PasswordConfirmationEmail_Title = String.Empty;
          this.AdapterObjects.ContentTemplates.PasswordConfirmationEmail_Body = String.Empty;
        }

        _displayPage = false;
        string value = PageCommand.GetParameter ( EuStaticContentTemplates.CONST_DISPLAY_PAGE );

        if ( true == EvStatics.getBool ( value ) )
        {
          _displayPage = true;
        }

        // 
        // Set the page type to control the DB query type.
        // 
        string pageType = PageCommand.GetPageId ( );

        this.Session.setPageId ( pageType );

        this.LogValue ( "PageId: " + this.Session.PageId );

        // 
        // Determine the method to be called
        // 
        switch ( PageCommand.Method )
        {
          case Evado.UniForm.Model.ApplicationMethods.Get_Object:
            {
              clientDataObjectObject = this.getObject ( PageCommand );
              break;
            }
          case Evado.UniForm.Model.ApplicationMethods.Save_Object:
            {
              this.LogValue ( " Save Object method" );

              // 
              // Update the object values
              // 
              bResult = this.updateObject ( PageCommand );

              // 
              // Process an update error result.
              // 
              if ( bResult == false )
              {
                this.LogValue ( " Save method failed" );

                // 
                // Return the generated ResultData object.
                // 
                clientDataObjectObject = null;
              }
              break;
            }

        }//END Swith

        // 
        // Handle returned exceptions.
        // 
        if ( clientDataObjectObject == null )
        {
          this.LogValue ( " null application data returned." );
        }

        // 
        // Return the last client ResultData object.
        // 
        return clientDataObjectObject;

      }
      catch ( Exception Ex )
      {
        this.LogException ( Ex );
      }
      return new Evado.UniForm.Model.AppData ( );

    }//END getClientDataObject method
Пример #9
0
    }//END getClientDataObject method
    
    // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    #endregion

    #region Class private list methods

    // ==============================================================================
    /// <summary>
    /// This method returns a client application ResultData object
    /// </summary>
    /// <param name="PageCommand">Evado.UniForm.Model.Command object.</param>
    /// <returns>ClientApplicationData object</returns>
    //  ------------------------------------------------------------------------------
    private Evado.UniForm.Model.AppData getListObject (
      Evado.UniForm.Model.Command PageCommand )
    {
      this.LogMethod ( "getListObject" );
      this.LogDebug ( "MenuPlatformId: " + this.Session.MenuPlatformId );
      this.LogDebug ( "MenuGroupIdentifer: " + this.Session.MenuGroupIdentifier );
      try
      {
        // 
        // Initialise the methods variables and objects.
        //      
        Evado.UniForm.Model.AppData clientDataObject = new Evado.UniForm.Model.AppData ( );

        //
        // Determine if the user has access to this page and log and error if they do not.
        //
        if ( this.Session.UserProfile.hasAdministrationAccess == false )
        {
          this.LogIllegalAccess (
            this.ClassNameSpace + "getListObject",
            this.Session.UserProfile );

          this.ErrorMessage = EdLabels.Illegal_Page_Access_Attempt;

          return this.Session.LastPage;
        }

        // 
        // Log access to page.
        // 
        this.LogPageAccess (
          this.ClassNameSpace + "getListObject",
          this.Session.UserProfile );

        //
        // if the customer command has been executed then refresh the menu list.
        //
        if ( PageCommand.hasParameter ( Evado.UniForm.Model.CommandParameters.Custom_Method ) == true )
        {
          this.AdapterObjects.MenuList = new List<EvMenuItem> ( );
        }

        // 
        // Get the selected pageMenuGroup identifier.
        // 
        if ( PageCommand.hasParameter ( EuSession.CONST_MENU_GROUP_ID ) == true )
        {
          this.Session.MenuGroupIdentifier = PageCommand.GetParameter ( EuSession.CONST_MENU_GROUP_ID );
        }
        this.LogValue ( "UPDATED: MenuGroupIdentifer: " + this.Session.MenuGroupIdentifier );

        // 
        // Get the selected pageMenuGroup identifier.
        // 
        if ( PageCommand.hasParameter ( EvMenuItem.MenuFieldNames.Platform.ToString ( ) ) == true )
        {
          this.Session.MenuPlatformId = PageCommand.GetParameter ( EvMenuItem.MenuFieldNames.Platform.ToString ( ) );
        }
        this.LogValue ( "UPDATED: MenuPlatformId: " + this.Session.MenuPlatformId );

        //
        // Update the global menu list, to pick up any changes that where made during an audit cycle.
        //
        this.loadGlobalMenu ( );

        //
        // ensure that all page layouts have menu groups headers.
        //
        this.updatePageLayoutGroups ( );

        //
        // Initialise the ResultData object.
        //
        clientDataObject.Title = EdLabels.Menu_Item_List;
        clientDataObject.Page.Title = clientDataObject.Title;
        clientDataObject.Id = Guid.NewGuid ( );

        // 
        // Add the save groupCommand
        // 
        clientDataObject.Page.addCommand (
          EdLabels.Menu_New_Item_Command_Title,
          EuAdapter.ADAPTER_ID,
          EuAdapterClasses.Menu.ToString ( ),
          Evado.UniForm.Model.ApplicationMethods.Create_Object );

        // 
        // add the selection pageMenuGroup.
        // 
        this.getSelectionListGroup ( clientDataObject.Page );

        // 
        // Add the Menu Field list to the page.
        // 
        this.getList_Menu_List_Group (
          clientDataObject.Page,
          this.Session.MenuGroupIdentifier );

        this.LogDebug ( "Page.Title: " + clientDataObject.Page.Title );
        this.LogDebug ( "Page.CommandList.Count: " + clientDataObject.Page.CommandList.Count );

        //
        // Return the client ResultData object.
        //
        return clientDataObject;

      }
      catch ( Exception Ex )
      {
        // 
        // Create the error message to be displayed to the user.
        // 
        this.ErrorMessage = EdLabels.Menu_List_Error_Message;

        // 
        // Generate the log the error event.
        // 
        this.LogException ( Ex );
      }

      return this.Session.LastPage;

    }//END getListObject method.
Пример #10
0
    }//END method

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

    #region Class private update object methods

    // ==================================================================================
    /// <summary>
    /// THis method saves the ResultData object updating the field values contained in the 
    /// parameter list.
    /// </summary>
    /// <param name="PageCommand">Evado.UniForm.Model.ClientClientDataObjectEvado.UniForm.Model.Command object.</param>
    /// <returns>Application Data object</returns>
    //  ----------------------------------------------------------------------------------
    private Evado.UniForm.Model.AppData updateObject ( Evado.UniForm.Model.Command PageCommand )
    {
      try
      {
        this.LogMethod ( "updateObject" );
        this.LogDebug ( "Command: " + PageCommand.getAsString ( false, true ) );

        this.LogDebug ( "eClinical.MenuItem" );
        this.LogDebug ( "Guid: " + this.Session.MenuItem.Guid );
        this.LogDebug ( "PageId: " + this.Session.MenuItem.PageId );
        this.LogDebug ( "Title: " + this.Session.MenuItem.Title );
        this.LogDebug ( "Platform: " + this.Session.MenuItem.Platform );


        //
        // Determine if the user has access to this page and log and error if they do not.
        //
        if ( this.Session.UserProfile.hasAdministrationAccess == false )
        {
          this.LogIllegalAccess (
            this.ClassNameSpace + "updateObject",
            this.Session.UserProfile );

          this.ErrorMessage = EdLabels.Illegal_Page_Access_Attempt;

          return this.Session.LastPage;
        }

        // 
        // Log access to page.
        // 
        this.LogPageAccess (
          this.ClassNameSpace + "updateObject",
          this.Session.UserProfile );

        // 
        // Update the object.
        // 
        this.updateObjectValue ( PageCommand );

        //
        // Validate that all of the mandatory values exist.
        //
        if ( this.validateValues ( ) == false )
        {
          return this.Session.LastPage;
        }

        // 
        // Initialise the update variables.
        //  
        if ( this.Session.MenuItem.Guid == Evado.Digital.Model.EvcStatics.CONST_NEW_OBJECT_ID )
        {
          this.Session.MenuItem.Guid = Guid.Empty;
        }

        this.Session.MenuItem.UserId = this.Session.UserProfile.UserId;

        // 
        // Get the save action message value.
        // 
        String stSaveAction = PageCommand.GetParameter ( Evado.Digital.Model.EvcStatics.CONST_SAVE_ACTION );

        this.LogDebug ( "SaveAction: " + stSaveAction );

        // 
        // Resets the save action to the parameter passed in the page groupCommand.
        // 
        if ( stSaveAction == EuMenus.CONST_DELETE_ACTION )
        {
          this.LogDebug ( "DELETING MENU ITEM" );
          this.Session.MenuItem.Title = String.Empty;
          this.Session.MenuItem.PageId = String.Empty;
        }

        // 
        // update the object.
        // 
        EvEventCodes result = this._Bll_Menus.saveItem ( this.Session.MenuItem );

        // 
        // get the debug ResultData.
        // 
        this.LogClass ( this._Bll_Menus.Log );

        // 
        // if an error state is returned create log the event.
        // 
        if ( result != EvEventCodes.Ok )
        {
          string StEvent = this._Bll_Menus.Log + " returned error message: " + Evado.Digital.Model.EvcStatics.getEventMessage ( result );
          this.LogError ( EvEventCodes.Database_Record_Update_Error, StEvent );

          this.ErrorMessage = EdLabels.MenuItem_Update_Error_Message;

          this.LogMethodEnd ( "updateObject" );
          return this.Session.LastPage;
        }

        this.AdapterObjects.MenuList = new List<EvMenuItem> ( );

        this.LogMethodEnd ( "updateObject" );
        return new Evado.UniForm.Model.AppData ( );

      }
      catch ( Exception Ex )
      {
        // 
        // Create the error message to be displayed to the user.
        // 
        this.ErrorMessage = EdLabels.MenuItem_Update_Error_Message;

        // 
        // Generate the log the error event.
        // 
        this.LogException ( Ex );
      }
      this.LogMethodEnd ( "updateObject" );
      return this.Session.LastPage;

    }//END method
Пример #11
0
    // ==============================================================================
    /// <summary>
    /// This method returns a client application ResultData object
    /// </summary>
    /// <param name="PageCommand">Evado.UniForm.Model.Command object.</param>
    /// <returns>ClientApplicationData object</returns>
    //  -----------------------------------------------------------------------------
    private Evado.UniForm.Model.AppData getListObject (
      Evado.UniForm.Model.Command PageCommand )
    {
      this.LogMethod ( "getListObject" );
      this.LogDebug ( "Selected_EntityLayoutId: " + this.Session.Selected_EntityLayoutId );
      this.LogDebug ( "EntitySelectionState: " + this.Session.EntityStateSelection );
      this.LogDebug ( "EntitySelectionLayoutId: " + this.Session.Selected_EntityLayoutId );
      try
      {
        // 
        // Initialise the methods variables and objects.
        // 
        Evado.UniForm.Model.AppData clientDataObject = new Evado.UniForm.Model.AppData ( );
        this.EnableEntityEditButtonUpdate = false; 
        //
        // get the selected entity.
        //
        this.Session.EntityLayout = this.AdapterObjects.GetEntityLayout ( this.Session.Selected_EntityLayoutId );

        this.LogDebug ( "EntityLayout.ReadAccessRoles: " + this.Session.EntityLayout.Design.ReadAccessRoles );
        this.LogDebug ( "UserProfile.Roles: " + this.Session.UserProfile.Roles );

        // 
        // If the user does not have monitor or ResultData manager roles exit the page.
        // 
        if ( this.Session.EntityLayout.hasReadAccess ( this.Session.UserProfile.Roles ) == false )
        {
          this.LogIllegalAccess (
            this.ClassNameSpace + "getListObject",
            this.Session.UserProfile );

          this.ErrorMessage = EdLabels.Record_Access_Error_Message;

          return this.Session.LastPage; ;
        }
        // 
        // Log the user's access to page.
        // 
        this.LogPageAccess (
          this.ClassNameSpace + "getListObject",
          this.Session.UserProfile );

        this.LogDebug ( "LayoutId {0}", this.Session.EntityLayout.LayoutId );

        //
        // Set the parent entity variables.
        //
        this.ParentLayoutId = this.Session.Entity.LayoutId;
        this.ParentGuid = this.Session.Entity.Guid;
        if ( PageCommand.hasParameter ( EdRecord.FieldNames.ParentGuid ) == true )
        {
          this.ParentGuid = PageCommand.GetParameterAsGuid ( EdRecord.FieldNames.ParentGuid );
        }
        if ( PageCommand.hasParameter ( EdRecord.FieldNames.ParentLayoutId ) == true )
        {
          this.ParentLayoutId = PageCommand.GetParameter ( EdRecord.FieldNames.ParentLayoutId );
        }

        //
        // Execute the monitor list record query.
        //
        this.executeRecordQuery ( );

        // 
        // Initialise the client ResultData object.
        // 
        clientDataObject.Id = Guid.NewGuid ( );
        clientDataObject.Page.Id = clientDataObject.Id;
        clientDataObject.Page.PageDataGuid = clientDataObject.Id;
        clientDataObject.Title = EdLabels.Entity_View_Page_Title;

        if ( this.AdapterObjects.Settings.UseHomePageHeaderOnAllPages == true )
        {
          clientDataObject.Title = this.AdapterObjects.Settings.HomePageHeaderText;
        }
        else
        {
          clientDataObject.Title = this.Session.EntityLayout.Title;
        }

        clientDataObject.Page.Title = clientDataObject.Title;
        clientDataObject.Page.PageId = Evado.Digital.Model.EdStaticPageIds.Records_View.ToString ( );

        if ( this.Session.Entity.hasEditAccess ( this.Session.UserProfile.Roles ) == true )
        {
          clientDataObject.Page.EditAccess = Evado.UniForm.Model.EditAccess.Enabled;
        }
        this.LogValue ( "Page.EditAccess: " + clientDataObject.Page.EditAccess );

        // 
        // Create the new pageMenuGroup for query selection.
        // 
        this.getList_SelectionGroup ( clientDataObject.Page );

        // 
        // Create the pageMenuGroup containing commands to open the records.
        //         
        this.getEntity_ListGroup ( clientDataObject.Page );

        this.LogValue ( "data.Page.Title: " + clientDataObject.Page.Title );


        return clientDataObject;

      }
      catch ( Exception Ex )
      {
        // 
        // Create the error message to be displayed to the user.
        // 
        this.ErrorMessage = EdLabels.Record_View_Error_Message;

        // 
        // Generate the log the error event.
        // 
        this.LogException ( Ex );
      }

      return this.Session.LastPage; ;

    }//END getListObject method.
    }//END getPropertiesDataObject Method

    // ==================================================================================
    /// <summary>
    /// Ttis method updates the form record values with the groupCommand parameter values.
    /// </summary>
    /// <param name="PageCommand">Evado.UniForm.Model.Command objects.</param>
    //  ----------------------------------------------------------------------------------
    private void updateSectionValues (
      Evado.UniForm.Model.Command PageCommand )
    {
      this.LogInitMethod ( "updateSectionValues" );
      this.LogDebug ( "PageCommand.Parameters.Count: " + PageCommand.Parameters.Count );

      //
      // Exit if update section not set.
      //
      string value = PageCommand.GetParameter ( EuRecordLayouts.CONST_UPDATE_SECTION_COMMAND_PARAMETER );
      if ( value != "1" )
      {
        return;
      }

      // 
      // Iterate through the parameter values updating the ResultData object
      // 
      foreach ( Evado.UniForm.Model.Parameter parameter in PageCommand.Parameters )
      {
        if ( parameter.Name.Contains ( "Sectn_" ) == false )
        {
          this.LogDebug ( parameter.Name + " > " + parameter.Value + " >> SKIPPED" );
          continue;
        }

        this.LogDebug ( parameter.Name + " > " + parameter.Value + " >> UPDATED" );

        try
        {
          EdRecordSection.FormSectionClassFieldNames fieldName = Evado.Model.EvStatics.parseEnumValue<EdRecordSection.FormSectionClassFieldNames> ( parameter.Name );

          this.Session.FormSection.setValue ( fieldName, parameter.Value );
        }
        catch ( Exception Ex )
        {
          LogValue ( "updateSectionValues method exception: \r\n"
            + Evado.Digital.Model.EvcStatics.getException ( Ex ) );
        }

      }// End iteration loop

      this.LogDebug ( "FormSection.No: " + this.Session.FormSection.No );
      this.LogDebug ( "FormSection.Title: " + this.Session.FormSection.Title );
      this.LogDebug ( "FormSection.Instructions: " + this.Session.FormSection.Instructions );
      this.LogDebug ( "FormSection.UserDisplayRoles: " + this.Session.FormSection.ReadAccessRoles );
      this.LogDebug ( "FormSection.UserEditRoles: " + this.Session.FormSection.EditAccessRoles );

      //
      // Update teh common form section object.
      //
      if ( this.Session.EntityLayout.Design.FormSections.Count > 0
        && this.Session.FormSection.No > 0 )
      {
        this.LogDebug ( "Updating the section values" );

        for ( int index = 0; index < this.Session.EntityLayout.Design.FormSections.Count; index++ )
        {
          if ( this.Session.EntityLayout.Design.FormSections [ index ].No == this.Session.FormSection.No )
          {
            this.Session.EntityLayout.Design.FormSections [ index ] = this.Session.FormSection;

            this.LogDebug ( this.Session.FormSection.LinkText + " >> UPDATED" );
          }
        }
      }

      //
      // Remove empty sections, i.e. section without a title.
      //
      for ( int index = 0; index < this.Session.EntityLayout.Design.FormSections.Count; index++ )
      {
        if ( this.Session.EntityLayout.Design.FormSections [ index ].Title == String.Empty )
        {
          this.Session.EntityLayout.Design.FormSections.RemoveAt( index );
          index--;

        }
      }



      //
      // Sort the section based on the current secton order.
      //
      this.Session.EntityLayout.Design.FormSections.Sort (
          delegate ( EdRecordSection p1, EdRecordSection p2 )
          {
            return p1.Order.CompareTo ( p2.Order );
          }
      );

      this.LogDebug ( "EntityLayout.Design.FormSections.Count.Count: " + this.Session.EntityLayout.Design.FormSections.Count );
      this.LogMethodEnd ( "updateSectionValues" );

    }//END updateObjectValue method.
    }//END getDataObject_GroupCommands method.

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


    #region Update User methods
    // ==================================================================================
    /// <summary>
    /// THis method saves the ResultData object updating the field values contained in the 
    /// parameter list.
    /// </summary>
    /// <param name="PageCommand">Evado.UniForm.Model.ClientClientDataObjectEvado.UniForm.Model.Command object.</param>
    /// <returns>Application Data object</returns>
    //  ----------------------------------------------------------------------------------
    private Evado.UniForm.Model.AppData updateUserObject ( Evado.UniForm.Model.Command PageCommand )
    {
      this.LogMethod ( "updateUserObject" );
      this.LogDebug ( "Parameter: " + PageCommand.getAsString ( false, false ) );

      this.LogDebug ( "eClinical.AdminUserProfile:" );
      this.LogDebug ( "Guid: " + this.Session.UserProfile.Guid );
      this.LogDebug ( "UserId: " + this.Session.UserProfile.UserId );
      this.LogDebug ( "CommonName: " + this.Session.UserProfile.CommonName );

      try
      {
        // 
        // Initialise the methods variables and objects.
        //      
        Evado.UniForm.Model.AppData clientDataObject = new Evado.UniForm.Model.AppData ( );
        EvEventCodes result;
        // 
        // Log access to page.
        // 
        this.LogPageAccess (
          this.ClassNameSpace + "updateObject",
          this.Session.UserProfile );


        if ( this.Session.UserProfile.Parameters != null )
        {
          this.LogDebug ( "Parameters.Count: " + this.Session.UserProfile.Parameters.Count );

          foreach ( EvObjectParameter parm in this.Session.UserProfile.Parameters )
          {
            if ( parm != null )
            {
              this.LogDebug ( "Name: " + parm.Name + " value: " + parm.Value );
            }
          }
        }

        // 
        // Update the object.
        // 
        if ( this.updateUserObjectValue ( PageCommand ) == false )
        {
          this.ErrorMessage = EdLabels.UserProfile_Value_Update_Error_Message;

          return this.Session.LastPage;
        }


        //
        // Update the address field.
        //
        this.updateUserAddressValue ( PageCommand );

        this.updateOrganisationValues ( PageCommand );

        //
        // save the image file if it exists.
        //
        this.saveUserImageFile ( );


        this.LogDebug ( "DelimitedName: " + this.Session.UserProfile.DelimitedName );
        this.LogDebug ( "GivenName: " + this.Session.UserProfile.GivenName );
        this.LogDebug ( "MiddleName: " + this.Session.UserProfile.MiddleName );
        this.LogDebug ( "FamilyName: " + this.Session.UserProfile.FamilyName );

        // 
        // Get the save action message value.
        // 
        String stSaveAction = PageCommand.GetParameter ( Evado.Digital.Model.EvcStatics.CONST_SAVE_ACTION );

        // 
        // update the object.
        // 
        result = saveUserProfile ( PageCommand );

        // 
        // if an error state is returned create log the event.
        //
        if ( result != EvEventCodes.Ok )
        {
          return this.Session.LastPage;
        }

        //
        // Update the organisation.
        //
        result = this.saveOrganisationValue ( );

        // 
        // if an error state is returned create log the event.
        //
        if ( result != EvEventCodes.Ok )
        {
          return this.Session.LastPage;
        }

        this.LogMethodEnd ( "updateUserObject" );

        this.Session.UserProfile = new EdUserProfile ( );

        return new Evado.UniForm.Model.AppData ( );

      }
      catch ( Exception Ex )
      {
        // 
        // Create the error message to be displayed to the user.
        // 
        this.ErrorMessage = EdLabels.User_Profile_Save_Error_Message;

        // 
        // Generate the log the error event.
        // 
        this.LogException ( Ex );
      }
      this.LogMethodEnd ( "updateUserObject" );
      return this.Session.LastPage; ;

    }//END method