コード例 #1
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>
    //  ----------------------------------------------------------------------------------
    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
コード例 #2
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>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