// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    #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 getDataObject_ExitPage (
      Evado.UniForm.Model.Command PageCommand )
    {
      this.LogMethod ( "getDataObject_ExitPage" );
      this.LogValue ( "Parameter: " + PageCommand.getAsString ( false, false ) );
      // 
      // Initialise the methods variables and objects.
      //      
      Evado.UniForm.Model.AppData clientDataObject = new Evado.UniForm.Model.AppData ( );
      EvEventCodes result;

      //
      // register the user details.
      //
      result = this.RegisterUserDetails ( PageCommand );

      //
      // create the registration exit page.

      clientDataObject = this.GetUserRegistrationExitPage ( result );

      this.LogMethodEnd ( "getDataObject_ExitPage" );
      return clientDataObject;

    }//END getDataObject_ExitPage method
예제 #2
0
    // ==================================================================================
    /// <summary>
    /// This method appendes the page command to the debug log for the class and adds
    /// a new line at the end of the text.
    /// </summary>
    /// <param name="Value">String:  debug text.</param>
    // ----------------------------------------------------------------------------------
    public void LogAction ( Evado.UniForm.Model.Command PageCommand, bool WithParameters )
    {
      //
      // get the command values.
      //
      string Value = "PageCommand: " + PageCommand.getAsString ( false, WithParameters );

      //
      // Append the value to the text log.
      //
      this._AdapterLog.AppendLine (
        DateTime.Now.ToString ( "dd-MM-yy hh:mm:ss" ) + " ACTION:  " + Value );

      //
      // create the aplplication event
      //
      EvApplicationEvent applicationEvent = new EvApplicationEvent (
        EvApplicationEvent.EventType.Action,
        EvEventCodes.Ok,
        this.ClassNameSpace,
        Value,
        this.Session.UserProfile.UserId );

      //
      // Log the application event.
      //
      this.AddEvent ( applicationEvent );
    }
예제 #3
0
    //private Evado.Digital.Bll.EvApplicationEvents _Bll_ApplicationEvents = newEvado.Digital.Bll.EvApplicationEvents ( );
   
    // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    #endregion

    #region Class public methods

    /// <summary>
    /// This method gets the application object from the list.
    /// 
    /// </summary>
    /// <param name="PageCommand">ClientPateEvado.UniForm.Model.Command object</param>
    /// <returns>ClientApplicationData</returns>
    //  ----------------------------------------------------------------------------------
    public virtual Evado.UniForm.Model.AppData getDataObject (
      Evado.UniForm.Model.Command PageCommand )
    {
      this.LogMethod ( "getDataObject" );
      this.LogValue ( "Parameter PageCommand " + PageCommand.getAsString ( false, false ) );

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

    }//END getSubjectObject 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>
    /// <returns>Application Data object</returns>
    //  ----------------------------------------------------------------------------------
    private bool updateObject ( Evado.UniForm.Model.Command PageCommand )
    {
      try
      {
        this.LogMethod ( "updateObject" );
        this.LogValue ( "Parameter PageEvado.UniForm.Model.Command: " + PageCommand.getAsString ( false, true ) );

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

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

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




        bool result = EvStatics.Files.saveFile<EvStaticContentTemplates> (
          this.AdapterObjects.ApplicationPath,
          EuStaticContentTemplates.CONST_EMAIL_TEMPLATE_FILENAME,
          this.AdapterObjects.ContentTemplates );

        return true;

      }
      catch ( Exception Ex )
      {
        // 
        // Create the error message to be displayed to the user.
        // 
        this.ErrorMessage = "Error raised saving the email template page..";

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

    }//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>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
    // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    #endregion

    #region Class public methods

    /// <summary>
    /// This method gets the application object from the list.
    /// 
    /// </summary>
    /// <param name="PageCommand">ClientPateEvado.UniForm.Model.Command object</param>
    /// <returns>ClientApplicationData</returns>
    //  ----------------------------------------------------------------------------------
    override public Evado.UniForm.Model.AppData getDataObject (
      Evado.UniForm.Model.Command PageCommand )
    {
      this.LogMethod ( "getClientDataObject" );
      this.LogValue ( "Parameter PageCommand " + PageCommand.getAsString ( false, false ) );

      try
      {
        // 
        // Initialise the methods variables and objects.
        // 
        Evado.UniForm.Model.AppData clientDataObject = new Evado.UniForm.Model.AppData ( );

        var pageId = PageCommand.GetPageId<Evado.Digital.Model.EdStaticPageIds> ( );

        this.LogDebug ( "Page Id {0}.", pageId );
        //
        // Load the customer group.
        //
        this.getAdsCustomerGroup ( );

        // 
        // Determine the method to be called
        // 
        switch ( PageCommand.Method )
        {
          case Evado.UniForm.Model.ApplicationMethods.List_of_Objects:
          case Evado.UniForm.Model.ApplicationMethods.Get_Object:
          case Evado.UniForm.Model.ApplicationMethods.Create_Object:
          case Evado.UniForm.Model.ApplicationMethods.Save_Object:
          case Evado.UniForm.Model.ApplicationMethods.Delete_Object:
            {
              switch ( pageId )
              {
                case Evado.Digital.Model.EdStaticPageIds.User_Registration_Page:
                default:
                  {
                    clientDataObject = this.getDataObject_RegistrationPage ( PageCommand );
                    break;
                  }
                case Evado.Digital.Model.EdStaticPageIds.Demo_User_Exit_Page:
                  {
                    this.LogValue ( " Save Object method" );

                    clientDataObject = this.getDataObject_ExitPage ( PageCommand );
                    break;
                  }
              }
              break;
            }
        }//END Switch

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

        if ( this.ErrorMessage != String.Empty )
        {
          this.LogDebug ( "Append error message" );
          clientDataObject.Message = this.ErrorMessage;
        }

        // 
        // return the client ResultData object.
        // 
        this.LogMethodEnd ( "getClientDataObject" );
        return clientDataObject;

      }
      catch ( Exception Ex )
      {
        this.LogException ( Ex );
      }

      this.LogMethodEnd ( "getClientDataObject" );
      return this.Session.LastPage;

    }//END updateObject method
예제 #8
0
    // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    #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 Evado.UniForm.Model.AppData getClientDataObject (
      Evado.UniForm.Model.Command PageCommand )
    {
      this.LogMethod ( "getClientDataObject" );
      this.LogValue ( "PageCommand Content: " + PageCommand.getAsString ( false, true ) );
      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 + "getClientDataObject",
            this.Session.UserProfile );

          this.ErrorMessage = EdLabels.Illegal_Page_Access_Attempt;

          return this.Session.LastPage;
        }

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

        //
        // save the event selection parameters.
        //
        this.saveEventLogSelectionParameters ( PageCommand );

        // 
        // 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;
            }

        }//END Swith

        // 
        // Handle returned exceptions.
        // 
        if ( clientDataObject == null )
        {
          this.LogValue ( " 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 ( "getClientDataObject" );
        return clientDataObject;

      }
      catch ( Exception Ex )
      {
        this.LogException ( Ex );
      }
      this.LogMethodEnd ( "getClientDataObject" );
      return this.Session.LastPage;

    }//END getClientDataObject 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
예제 #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
    // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    #endregion

    #region Class public methods

    // ==================================================================================
    /// <summary>
    /// This method gets the application object from the list.
    /// 
    /// </summary>
    /// <param name="PageCommand">ClientPateEvado.UniForm.Model.Command object</param>
    /// <returns>ClientApplicationData</returns>
    //  ----------------------------------------------------------------------------------
    public Evado.UniForm.Model.AppData getClientDataObject (
      Evado.UniForm.Model.Command PageCommand )
    {
      this.LogMethod ( "getClientDataObject" );
      this.LogValue ( "Parameter PageCommand " + PageCommand.getAsString ( false, true ) );

      try
      {
        // 
        // Initialise the methods variables and objects.
        // 
        Evado.UniForm.Model.AppData clientDataObject = new Evado.UniForm.Model.AppData ( );

        //
        // Initialise the menu platformID value.
        //
        if ( this.Session.MenuPlatformId == null )
        {
          this.Session.MenuPlatformId = this.AdapterObjects.PlatformId;
        }

        // 
        // 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:
            {
              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 getClientDataObject 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