}//END getProjectPage_SignoffLog Method

    // ==================================================================================
    /// <summary>
    /// THis method saves the ResultData object updating the field values contained in the 
    /// parameter list.
    /// </summary>
    /// <param name="Command">Evado.Model.UniForm.Command object.</param>
    /// <returns>Application Data object</returns>
    //  ----------------------------------------------------------------------------------
    private Evado.Model.UniForm.AppData createObject (
      Evado.Model.UniForm.Command Command )
    {
      try
      {
        this.LogMethod ( "createObject" );
        // 
        // Initialise the methods variables and objects.
        //      
        Evado.Model.UniForm.AppData data = new Evado.Model.UniForm.AppData ( );
        this.Session.AncillaryRecord = new EvAncillaryRecord ( );
        this.Session.AncillaryRecord.Guid =  Evado.Model.Clinical.EvcStatics.CONST_NEW_OBJECT_ID;
        this.Session.AncillaryRecord.State = EvFormObjectStates.Draft_Record;
        this.Session.AncillaryRecord.RecordDate = DateTime.Now;

        // 
        // Log access to page.
        // 
        this.LogPageAccess (
          "Evado.UniForm.Clinical.SubjectRecords.createObject",
          this.Session.UserProfile );

        this.getClientDataObject ( data );


        this.LogValue ( "Exit createObject method. ID: " + data.Id + ", Title: " + data.Title );

        return data;

      }
      catch ( Exception Ex )
      {
        // 
        // Create the error message to be displayed to the user.
        // 
        this.ErrorMessage = "Error raised when creating a subject record.";

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

      return null;

    }//END method
    }//END getTrialAlertObject method

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

    #region Class private methods

    // ==============================================================================
    /// <summary>
    /// This method returns a client application ResultData object
    /// </summary>
    /// <param name="ClientDataObject">Evado.Model.UniForm.AppData object.</param>
    /// <remarks>
    /// This method consists of following steps:
    /// 
    /// 1. Based on the selection of ALert Type, redirect the user to the specific object
    /// </remarks>
    //  ------------------------------------------------------------------------------
    private void generateRedirection ( 
      Evado.Model.UniForm.AppData ClientDataObject )
    {
      this.LogMethod ( "generateRedirectionCommand" );
      //
      // If the save action is not acknowledgement exit.
      //
      if ( this.Session.Alert.Action != EvAlert.AlertSaveActionCodes.Acknowledge_Alert )
      {
        this.LogMethodEnd ( "generateRedirectionCommand" );
        return;
      }

      this.LogValue ( "Alert.TypeId: " + this.Session.Alert.TypeId );
      this.LogValue ( "Alert.RecordId: " + this.Session.Alert.RecordId );

      //
      // Initialise the methods variables and objects.
      //
      Evado.Model.UniForm.Command groupCommand =  ClientDataObject.Page.Exit;

      //
      // based on the alert type redirect the user to the relevant object.
      switch ( this.Session.Alert.TypeId )
      {
        case EvAlert.AlertTypes.Trial_Record:
          {
            groupCommand = new Model.UniForm.Command (
              EvLabels.Label_Record,
              EuAdapter.APPLICATION_ID,
              EuAdapterClasses.Records.ToString ( ),
              Model.UniForm.ApplicationMethods.Get_Object );

            groupCommand.AddParameter ( EvIdentifiers.RECORD_ID, this.Session.Alert.RecordId );

            break;
          }

      }//END alert type switch

      ClientDataObject.Page.Exit = groupCommand;

      this.LogMethodEnd ( "generateRedirectionCommand" );

    }//ENd generateRedirectionCommand method
    // ==================================================================================
    /// <summary>
    /// THis method saves the ResultData object updating the field values contained in the 
    /// parameter list.
    /// </summary>
    /// <param name="Command">Evado.Model.UniForm.Command object.</param>
    /// <returns>Application Data object</returns>
    //  ----------------------------------------------------------------------------------
    private Evado.Model.UniForm.AppData createObject ( Evado.Model.UniForm.Command Command )
    {
      try
      {
        this.LogMethod ( "createObject" );

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

        // 
        // Initialise the methods variables and objects.
        //      
        Evado.Model.UniForm.AppData data = new Evado.Model.UniForm.AppData ( );
        this.Session.Alert = new EvAlert ( );
        this.Session.Alert.Guid =  Evado.Model.Digital.EvcStatics.CONST_NEW_OBJECT_ID;

        this.getClientDataObject ( data );


        this.LogDebug ( "Exit createObject method. ID: " + data.Id + ", Title: " + data.Title );

        return data;

      }
      catch ( Exception Ex )
      {
        // 
        // Create the error message to be displayed to the user.
        // 
        this.ErrorMessage = "Error raised when creating a trial site.";

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

      return this.Session.LastPage;

    }//END method
    }//END createRecordSaveCommand method

    // ==============================================================================
    /// <summary>
    /// This method returns a client application ResultData object
    /// </summary>
    /// <param name="ClientDataObject">Evado.Model.UniForm.AppData object.</param>
    /// <returns>Evado.Model.UniForm.AppData object</returns>
    //  ------------------------------------------------------------------------------
    private void getClientDataObject (
      Evado.Model.UniForm.AppData ClientDataObject )
    {
      this.LogMethod ( "getClientDataObject" );
      // 
      // Initialise the methods variables and objects.
      // 
      ClientDataObject.Id = this.Session.AncillaryRecord.Guid;
      ClientDataObject.Title = EvLabels.Ancillary_Record_Object_Page_Title
        + this.Session.AncillaryRecord.RecordId;

      ClientDataObject.Page.Id = ClientDataObject.Id;
      ClientDataObject.Page.Title = ClientDataObject.Title;
      ClientDataObject.Page.EditAccess = Evado.Model.UniForm.EditAccess.Enabled;

      // 
      // Define the save and delete groupCommand parameters
      // 
      Evado.Model.UniForm.Parameter parameter = new Evado.Model.UniForm.Parameter (
        "Guid", ClientDataObject.Id.ToString ( ) );

      //
      // get the page commands.
      //
      this.getClientDataObject_PageCommands ( ClientDataObject.Page );

      // 
      // create the page pageMenuGroup
      // 
      this.getClientDataObject_FieldGroup ( ClientDataObject.Page );

      // 
      // create the page pageMenuGroup
      // 
      this.getClientDataObject_BinaryFileGroup ( ClientDataObject.Page );

      this.getClientDataObject_SignoffLog_Group ( ClientDataObject.Page );

      this.LogMethodEnd ( "getClientDataObject" );

    }//END getClientDataObject Method
Beispiel #5
0
    // ==============================================================================
    /// <summary>
    /// This method returns a client application ResultData object
    /// </summary>
    /// <param name="ClientDataObject">Evado.Model.UniForm.AppData object.</param>
    //  ------------------------------------------------------------------------------
    private void getDataObject_RegistrationPage (
      Evado.Model.UniForm.AppData ClientDataObject )
    {
      this.LogMethod ( "getDataObject_RegistrationPage" );
      //
      // set the client ResultData object properties
      //
      ClientDataObject.Id = this.Session.AdminUserProfile.Guid;
      ClientDataObject.Page.Id = this.Session.AdminUserProfile.Guid;
      ClientDataObject.Title = EdLabels.User_Profile_Page_Title
        + this.Session.AdminUserProfile.CommonName;

      ClientDataObject.Page.Title = ClientDataObject.Title;
      ClientDataObject.Page.PageId = EdStaticPageIds.User_Profile_Page.ToString ( );
      ClientDataObject.Page.EditAccess = Evado.Model.UniForm.EditAccess.Enabled;


      this.getDataObject_Debug_Group ( ClientDataObject.Page );

      //
      // Display the instructions 
      //
      this.getDataObject_InstructionsGroup ( ClientDataObject.Page );

      //
      // Add the page commands to the page.
      //
      this.getDataObject_PageCommands ( ClientDataObject.Page );

      //
      // Add the field pageMenuGroup to the page.
      //
      this.getDataObject_FieldGroup ( ClientDataObject.Page );

      this.LogMethodEnd ( "getDataObject_RegistrationPage" );

    }//END getDataObject_RegistrationPage Method
    }//END getListObject method.

    // ==============================================================================
    /// <summary>
    /// This method returns a client application ResultData object
    /// </summary>
    /// <param name="PageCommand">Evado.Model.UniForm.Command object.</param>
    /// <returns>Evado.Model.UniForm.AppData object</returns>
    //  ------------------------------------------------------------------------------
    private Evado.Model.UniForm.AppData getObject (
      Evado.Model.UniForm.Command PageCommand )
    {
      this.LogMethod ( "getObject" );
      // 
      // Initialise the methods variables and objects.
      // 
      Evado.Model.UniForm.AppData clientDataObject = new Evado.Model.UniForm.AppData ( );
      Guid RecordGuid = Guid.Empty;
      this.Session.FileMetaDataList = new List<EvBinaryFileMetaData> ( );

      //
      // Determine if the user has access to this page and log and error if they do not.
      //
      if ( this.Session.UserProfile.hasRecordAccess == false )
      {
        this.LogIllegalAccess (
          "Evado.UniForm.Clinical.AncilliaryRecords.getObject",
          this.Session.UserProfile );

        this.ErrorMessage = EvLabels.Illegal_Page_Access_Attempt;

        return null;
      }

      // 
      // Log access to page.
      // 
      this.LogPageAccess (
        "Evado.UniForm.Clinical.AncilliaryRecords.getObject",
        this.Session.UserProfile );

      // 
      // if the parameter value exists then set the customerId
      // 
      RecordGuid = PageCommand.GetGuid ( );
      this.LogValue ( "RecordGuid: " + RecordGuid );

      // 
      // return if not trial id
      // 
      if ( RecordGuid == Guid.Empty )
      {
        this.LogValue ( "Record GUID is empty." );
        return null;
      }

      this.LogValue ( "Record exists" );

      try
      {
        // 
        // Retrieve the customer object from the database via the DAL and BLL layers.
        // 
        this.Session.AncillaryRecord = this._Bll_AncillaryRecords.getRecord ( RecordGuid );

        this.LogValue ( this._Bll_AncillaryRecords.DebugLog );

        this.LogValue ( "SubjectRecord.RecordId: "
          + this.Session.AncillaryRecord.RecordId );

        // 
        // return the client ResultData object for the customer.
        // 
        this.getClientDataObject ( clientDataObject );

        this.LogMethodEnd ( "getObject" );

        return clientDataObject;
      }
      catch ( Exception Ex )
      {
        // 
        // Create the error message to be displayed to the user.
        // 
        this.ErrorMessage = EvLabels.Ancillary_Record_Page_Error_Message;

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

      this.LogMethodEnd ( "getObject" );
      return null;

    }//END getObject method
    }//END getClientDataObject method

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

    #region Class private methods

    // ==============================================================================
    /// <summary>
    /// This method returns a client application ResultData object
    /// </summary>
    /// <param name="PageCommand">Evado.Model.UniForm.Command object.</param>
    /// <returns>Evado.Model.UniForm.AppData object</returns>
    //  ------------------------------------------------------------------------------
    private Evado.Model.UniForm.AppData getListObject (
      Evado.Model.UniForm.Command PageCommand )
    {
      try
      {
        this.LogMethod ( "getListObject" );
        this.LogValue ( "UserProfile.CommonName: " + this.Session.UserProfile.CommonName );

        //
        // Determine if the user has access to this page and log and error if they do not.
        //
        if ( this.Session.UserProfile.hasRecordAccess == false )
        {
          this.LogIllegalAccess (
            "Evado.UniForm.Clinical.AncilliaryRecords.getObject",
            this.Session.UserProfile );

          this.ErrorMessage = EvLabels.Illegal_Page_Access_Attempt;

          return null;
        }

        // 
        // Log access to page.
        // 
        this.LogPageAccess (
          "Evado.UniForm.Clinical.AncilliaryRecords.getListObject",
          this.Session.UserProfile );

        // 
        // Initialise the methods variables and objects.
        //      
        Evado.Model.UniForm.AppData clientDataObject = new Evado.Model.UniForm.AppData ( );
        Evado.Model.UniForm.Command groupCommand = new Model.UniForm.Command ( );
        Evado.Model.UniForm.Group pageGroup = new Model.UniForm.Group ( );

        clientDataObject.Title = EvLabels.Ancillary_Record_List_Page_Title;
        clientDataObject.Page.Title = clientDataObject.Title;
        clientDataObject.Id = Guid.NewGuid ( );
        this.LogValue ( "data.Page.Title: " + clientDataObject.Page.Title );

        // 
        // Create the new pageMenuGroup.
        // 
        pageGroup = clientDataObject.Page.AddGroup (
        EvLabels.Ancillary_Record_List_Page_Group_Title,
        Evado.Model.UniForm.EditAccess.Enabled );
        pageGroup.CmdLayout = Evado.Model.UniForm.GroupCommandListLayouts.Vertical_Orientation;
        pageGroup.Layout = Evado.Model.UniForm.GroupLayouts.Full_Width;

        if ( this.Session.UserProfile.hasRecordEditAccess == true )
        {
          groupCommand = pageGroup.addCommand ( 
            EvLabels.Ancillary_Record_Add_Record_Command_Title, 
            EuAdapter.APPLICATION_ID, 
            EuAdapterClasses.Ancillary_Record.ToString ( ),
            Model.UniForm.ApplicationMethods.Create_Object );

          groupCommand.SetBackgroundColour (
            Model.UniForm.CommandParameters.BG_Default,
            Model.UniForm.Background_Colours.Purple );
        }

        // 
        // get the list of customers.
        // 
        List<EvAncillaryRecord> siteList = this._Bll_AncillaryRecords.getView (
          this.Session.Trial.TrialId,
          this.Session.Subject.SubjectId,
          String.Empty,
         String.Empty );

        this.LogValue ( this._Bll_AncillaryRecords.DebugLog );
        this.LogValue ( "list count: " + siteList.Count );

        // 
        // generate the page links.
        // 
        foreach ( EvAncillaryRecord ancillaryRecord in siteList )
        {

          groupCommand = pageGroup.addCommand(
            ancillaryRecord.RecordId, 
            EuAdapter.APPLICATION_ID,
            EuAdapterClasses.Ancillary_Record.ToString ( ),
            Evado.Model.UniForm.ApplicationMethods.Get_Object );

          groupCommand.SetGuid(  ancillaryRecord.Guid );

          groupCommand.Title = ancillaryRecord.Subject
            + EvLabels.Space_Open_Bracket
            + EvLabels.Label_Date
            + ancillaryRecord.stRecordDate
            + EvLabels.Space_Close_Bracket;
        }//END ancillary command iteration loop.

        if ( pageGroup.CommandList.Count == 0 )
        {
          pageGroup.Description = EvLabels.Ancillary_Record_List_Page_No_Records_Label ;
        }


        this.LogValue ( "command object count: " + pageGroup.CommandList.Count );

        return clientDataObject;

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

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

      return null;

    }//END getListObject method.
    // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    #endregion

    #region Class public methods

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

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

        String stViewType = PageCommand.GetParameter ( Evado.Model.UniForm.CommandParameters.Page_Id.ToString ( ) );

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

        // 
        // Determine the method to be called
        // 
        switch ( PageCommand.Method )
        {
          case Evado.Model.UniForm.ApplicationMethods.List_of_Objects:
            {
              clientDataObject = this.getListObject ( PageCommand ); 
              
              break;
            }
          case Evado.Model.UniForm.ApplicationMethods.Get_Object:
            {
              clientDataObject = this.getObject ( PageCommand );

              break;
            }
          case Evado.Model.UniForm.ApplicationMethods.Create_Object:
            {
              clientDataObject = this.createObject ( PageCommand );

              break;
            }
          case Evado.Model.UniForm.ApplicationMethods.Save_Object:
          case Evado.Model.UniForm.ApplicationMethods.Delete_Object:
            {
              this.LogValue ( " Save Object method" );
              // 
              // Update the object values
              // 
              clientDataObject = this.updateObject ( PageCommand );

              break;
            }

        }//END Switch

        // 
        // 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.
        // 
        return clientDataObject;

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

    }//END getClientDataObject method
    // ==============================================================================
    /// <summary>
    /// This method returns a client application ResultData object
    /// </summary>
    /// <param name="ClientClientDataObjectObject">The customer object.</param>
    //  ------------------------------------------------------------------------------
    private void getClientDataObject ( Evado.Model.UniForm.AppData ClientClientDataObjectObject )
    {
      this.LogMethod ( "getClientClientDataObjectObject" );
      // 
      // Initialise the methods variables and objects.
      // 
      Evado.Model.UniForm.Command pageCommand = new Evado.Model.UniForm.Command ( );
      Evado.Model.UniForm.Field pageField = new Evado.Model.UniForm.Field ( );
      bool userHasEditAccess = this.UserHasEditAccess ( );

      //
      // Initialise the client ResultData object.
      //
      ClientClientDataObjectObject.Id = this.Session.Alert.Guid;
      ClientClientDataObjectObject.Title = EvLabels.Alert_Page_Title;

      ClientClientDataObjectObject.Page.Id = ClientClientDataObjectObject.Id;
      ClientClientDataObjectObject.Page.Title = ClientClientDataObjectObject.Title;
      ClientClientDataObjectObject.Page.EditAccess = Evado.Model.UniForm.EditAccess.Enabled;

      //
      // If the user has edit access enable the page for the user.
      //
      if ( userHasEditAccess == true )
      {
        ClientClientDataObjectObject.Page.EditAccess = Evado.Model.UniForm.EditAccess.Enabled;
      }

      // 
      // create the general page pageMenuGroup
      // 
      Evado.Model.UniForm.Group pageGroup = ClientClientDataObjectObject.Page.AddGroup (
        EvLabels.Alert_Page_Header_Group_Title,
        String.Empty,
        Evado.Model.UniForm.EditAccess.Inherited );
      pageGroup.Layout = Model.UniForm.GroupLayouts.Full_Width;

      // 
      // Create the customer id object
      // 
      pageField = pageGroup.createReadOnlyTextField (
        EvAlert.AlertFieldNames.Alert_Id.ToString ( ),
        EvLabels.Label_Alert_Id,
        this.Session.Alert.ToOrgId );
      pageField.Layout = EuRecordGenerator.ApplicationFieldLayout;

      // 
      // Add from user name
      // 
      pageField = pageGroup.createReadOnlyTextField (
        EvAlert.AlertFieldNames.From_User.ToString ( ),
        EvLabels.Alert_Page_From_Label,
        this.Session.Alert.FromUser );
      pageField.Layout = EuRecordGenerator.ApplicationFieldLayout;

      // 
      // Add to user name
      // 
      if ( this.Session.Alert.ToUser != String.Empty )
      {
        pageField = pageGroup.createReadOnlyTextField (
          EvAlert.AlertFieldNames.To_User.ToString ( ),
          EvLabels.Alert_Page_To_Label,
          this.Session.Alert.ToUser );
        pageField.Layout = EuRecordGenerator.ApplicationFieldLayout;
      }

      // 
      // Add alert milestone name
      // 
      pageField = pageGroup.createReadOnlyTextField (
        EvAlert.AlertFieldNames.Alert_Subject.ToString ( ),
        EvLabels.Alert_Page_Subject_Label,
        this.Session.Alert.Subject );
      pageField.Layout = EuRecordGenerator.ApplicationFieldLayout;

      // 
      // Add alert message name
      // 
      pageField = pageGroup.createReadOnlyTextField (
        EvAlert.AlertFieldNames.Message.ToString ( ),
        EvLabels.Alert_Page_Message_Label,
        this.Session.Alert.Message );
      pageField.Layout = EuRecordGenerator.ApplicationFieldLayout;

      // 
      // Add alert message name
      // 
      pageField = pageGroup.createReadOnlyTextField (
        EvAlert.AlertFieldNames.Alert_State.ToString ( ),
        EvLabels.Alert_Page_Status,
        this.Session.Alert.StateDesc );

      pageField.Layout = EuRecordGenerator.ApplicationFieldLayout;

      // 
      // include the acknowledged content if it exists.
      // 
      if ( this.Session.Alert.Acknowledged !=  Evado.Model.Digital.EvcStatics.CONST_DATE_NULL )
      {
        pageField = pageGroup.createReadOnlyTextField (
          EvAlert.AlertFieldNames.Acknowledged_Date.ToString ( ),
          EvLabels.Alert_Page_Acknowledged_Date_Label,
          this.Session.Alert.Acknowledged.ToString ( "dd MMM yyy HH:mm" ) );

        pageField.Layout = EuRecordGenerator.ApplicationFieldLayout;

        pageField = pageGroup.createReadOnlyTextField (
          EvAlert.AlertFieldNames.Acknowledged_By.ToString ( ),
          EvLabels.Alert_Page_Acknowledged_By_Label,
          this.Session.Alert.AcknowledgedBy );

        pageField.Layout = EuRecordGenerator.ApplicationFieldLayout;
      }

      // 
      // include the clodes content if it exists.
      // 
      if ( this.Session.Alert.Closed !=  Evado.Model.Digital.EvcStatics.CONST_DATE_NULL )
      {

        pageField = pageGroup.createReadOnlyTextField (
          EvAlert.AlertFieldNames.Closed_Date.ToString ( ),
          EvLabels.Alert_Page_Closed_Date_Label,
          this.Session.Alert.Closed.ToString ( "dd MMM yyy HH:mm" ) );

        pageField.Layout = EuRecordGenerator.ApplicationFieldLayout;

        pageField = pageGroup.createReadOnlyTextField (
          EvAlert.AlertFieldNames.Closed_By.ToString ( ),
          EvLabels.Alert_Page_Closed_By_Label,
          this.Session.Alert.ClosedBy );

        pageField.Layout = EuRecordGenerator.ApplicationFieldLayout;
      }

      this.LogValue ( "Edit Access: " + userHasEditAccess );
      this.LogValue ( "Alert.Status: " + this.Session.Alert.State );

      //
      // Add the record access command.
      //
      pageGroup.addCommand ( this.getRecordCommand ( ) );
      
      // 
      // Add page commands if the user has edit access to them.
      // 
      if ( userHasEditAccess == true )
      {
        this.LogValue ( "User has edit access" );

        switch ( this.Session.Alert.State )
        {
          case EvAlert.AlertStates.Raised:
            {
              this.LogValue ( "Alert.Status: Raised" );
              // 
              // Add the save groupCommand
              // 
              pageCommand = pageGroup.addCommand (
                EvLabels.Alert_Save_Command_Title,
                EuAdapter.APPLICATION_ID,
                EuAdapterClasses.Alert.ToString ( ),
                Evado.Model.UniForm.ApplicationMethods.Save_Object );

              pageCommand.AddParameter (
                 Evado.Model.Digital.EvcStatics.CONST_SAVE_ACTION,
                EvAlert.AlertSaveActionCodes.Save_Alert.ToString ( ));

              pageCommand.SetGuid( ClientClientDataObjectObject.Id );

              // 
              // Add acknowledge groupCommand.
              // 
              pageCommand = pageGroup.addCommand (
                EvLabels.Alert_Page_Acknowledge_Command,
                EuAdapter.APPLICATION_ID,
                EuAdapterClasses.Alert.ToString ( ),
                Evado.Model.UniForm.ApplicationMethods.Save_Object );

              pageCommand.SetGuid ( ClientClientDataObjectObject.Id );

              pageCommand.AddParameter (
                 Evado.Model.Digital.EvcStatics.CONST_SAVE_ACTION,
                EvAlert.AlertSaveActionCodes.Acknowledge_Alert.ToString ( ) );

              // 
              // Add the close groupCommand.
              // 
              pageCommand = pageGroup.addCommand (
                EvLabels.Alert_Page_Close_Command,
                EuAdapter.APPLICATION_ID,
                EuAdapterClasses.Alert.ToString ( ),
                Evado.Model.UniForm.ApplicationMethods.Save_Object );

              pageCommand.SetGuid ( ClientClientDataObjectObject.Id );

              pageCommand.AddParameter (
                 Evado.Model.Digital.EvcStatics.CONST_SAVE_ACTION,
                EvAlert.AlertSaveActionCodes.Close_Alert.ToString ( ));

              break;
            }//END raised state.

          case EvAlert.AlertStates.Acknowledged:
            {
              this.LogValue ( "Alert.Status: Acknowledged" );
              // 
              // Add the save groupCommand
              // 
              pageCommand = pageGroup.addCommand (
                EvLabels.Alert_Save_Command_Title,
                EuAdapter.APPLICATION_ID,
                EuAdapterClasses.Alert.ToString ( ),
                Evado.Model.UniForm.ApplicationMethods.Save_Object );

              pageCommand.AddParameter (
                 Evado.Model.Digital.EvcStatics.CONST_SAVE_ACTION,
                EvAlert.AlertSaveActionCodes.Save_Alert.ToString ( ));

              pageCommand.SetGuid ( ClientClientDataObjectObject.Id );

              // 
              // Add the close groupCommand.
              // 
              pageCommand = pageGroup.addCommand (
                EvLabels.Alert_Page_Close_Command,
                EuAdapter.APPLICATION_ID,
                EuAdapterClasses.Alert.ToString ( ),
                Evado.Model.UniForm.ApplicationMethods.Save_Object );

              pageCommand.SetGuid (  ClientClientDataObjectObject.Id );

              pageCommand.AddParameter (
                 Evado.Model.Digital.EvcStatics.CONST_SAVE_ACTION,
                EvAlert.AlertSaveActionCodes.Close_Alert.ToString ( ) );
              break;
            }//END acknowledge state.

        }//END Alert State switch

      }//END user edit access.

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

    // ==============================================================================
    /// <summary>
    /// This method returns a client application ResultData object
    /// </summary>
    /// <param name="PagCommand">Evado.Model.UniForm.Command object.</param>
    /// <returns>Evado.Model.UniForm.AppData object</returns>
    //  ------------------------------------------------------------------------------
    private Evado.Model.UniForm.AppData getObject (
      Evado.Model.UniForm.Command PagCommand )
    {
      this.LogMethod ( "getObject" );
      // 
      // Initialise the methods variables and objects.
      // 
      Evado.Model.UniForm.AppData clientDataObject = new Evado.Model.UniForm.AppData ( );
      Guid alertGuid = Guid.Empty;

      // 
      // If the user does not have monitor or ResultData manager roles exit the page.
      // 
      if ( this.Session.UserProfile.hasMultiSiteAccess == false
        && this.Session.UserProfile.hasRecordAccess == false )
      {
        this.LogIllegalAccess (
          this.ClassNameSpace + "getObject",
          this.Session.UserProfile );

        this.ErrorMessage = EvLabels.Record_Access_Error_Message;

        return this.Session.LastPage;
      }

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

      // 
      // if the parameter value exists then set the customerId
      // 
      alertGuid = PagCommand.GetGuid();
      this.LogValue ( "alertGuid: " + alertGuid );

      // 
      // return if not trial id
      // 
      if ( alertGuid == Guid.Empty )
      {
        return clientDataObject;
      }

      this.LogValue ( "Alert Guid: " + alertGuid );

      try
      {
        // 
        // Retrieve the customer object from the database via the DAL and BLL layers.
        // 
        if ( this.Session.Alert.Guid != alertGuid )
        {
          this.Session.Alert = this._Bll_Alerts.getItem ( alertGuid );

          this.LogValue ( this._Bll_Alerts.Log );
        }
        this.LogValue ( "SessionObjects.Alert.AlertId: " + this.Session.Alert.AlertId );

        // 
        // return the client ResultData object for the customer.
        // 
        this.getClientDataObject ( clientDataObject );

        return clientDataObject;
      }
      catch ( Exception Ex )
      {
        // 
        // Create the error message to be displayed to the user.
        // 
        this.ErrorMessage = EvLabels.Alert_Page_Error_Mesage;

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

      return this.Session.LastPage;

    }//END getObject method
    }//ENd generateRedirectionCommand method

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

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

          this.ErrorMessage = EvLabels.Record_Access_Error_Message;

          return this.Session.LastPage;
        }

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

        //
        // Initialise the client ResultData object.
        //
        clientDataObject.Title = EvLabels.Alert_View_Page_Title;
        clientDataObject.Page.Title = clientDataObject.Title;
        clientDataObject.Id = Guid.NewGuid ( );
        this.Session.AlertType = EvAlert.AlertTypes.Null;
        this.Session.AlertState = EvAlert.AlertStates.Not_Closed;
        string stValue = String.Empty;

        this.LogValue ( "data.Title: " + clientDataObject.Title );
        this.LogValue ( "data.Page.Title: " + clientDataObject.Page.Title );
        // 
        // get the groupCommand parameters.
        // 
        stValue = PageCommand.GetParameter ( EuAlerts.CONST_ALERT_TYPE );
        this.Session.AlertType =  Evado.Model.Digital.EvcStatics.Enumerations.parseEnumValue<EvAlert.AlertTypes> ( stValue );

        stValue = PageCommand.GetParameter ( EuAlerts.CONST_ALERT_STATE );
        this.Session.AlertState =  Evado.Model.Digital.EvcStatics.Enumerations.parseEnumValue<EvAlert.AlertStates> ( stValue );

        // 
        // Query and database.
        // 
        this._AlertView = this._Bll_Alerts.getView (
          this.Session.Application,
          new EvOrganisation(),
          this.Session.UserProfile,
          this.Session.AlertState,
          this.Session.AlertType);

        this.LogValue ( this._Bll_Alerts.Log );

        // 
        // bind output to the datagrid.
        // 
        if ( _AlertView.Count == 0 )  // If nothing returned create a blank row.
        {
          _AlertView.Add ( new EvAlert ( ) );
        }

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

        // 
        // Add the alert list to the page.
        // 
        this.getListObject_List_Group ( clientDataObject.Page );


        return clientDataObject;

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

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

      return this.Session.LastPage;

    }//END getListObject method.
    // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    #endregion

    #region Class public methods

    // ==================================================================================
    /// <summary>
    /// This method gets the trial site object.
    /// 
    /// </summary>
    /// <param name="PageCommand">Evado.Model.UniForm.Command object</param>
    /// <returns>Evado.Model.UniForm.AppData</returns>
    //  ----------------------------------------------------------------------------------
    public Evado.Model.UniForm.AppData getClientDataObject ( Evado.Model.UniForm.Command PageCommand )
    {
      this.LogMethod ( "getTrialAlertObject" );
      this.LogValue ( "UserProfile.CommonName: " + this.Session.UserProfile.CommonName );
      this.LogValue ( "PageCommand " + PageCommand.getAsString ( false, false ) );

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

        // 
        // Determine the method to be called
        // 
        switch ( PageCommand.Method )
        {
          case Evado.Model.UniForm.ApplicationMethods.List_of_Objects:
            {
              clientDataObject = this.getListObject ( PageCommand );

              break;
            }
          case Evado.Model.UniForm.ApplicationMethods.Get_Object:
            {
              clientDataObject = this.getObject ( PageCommand );

              break;
            }
          case Evado.Model.UniForm.ApplicationMethods.Create_Object:
            {
              clientDataObject = this.createObject ( PageCommand );

              break;
            }
          case Evado.Model.UniForm.ApplicationMethods.Save_Object:
          case Evado.Model.UniForm.ApplicationMethods.Delete_Object:
            {
              // 
              // Update the object values
              // 
              clientDataObject = this.updateObject ( PageCommand );

              //
              // if the alert is acknowledged the user needs to be diverted to the 
              // relevant object.
              //
              this.generateRedirection ( clientDataObject );

              break;
            }

        }//END Switch

        // 
        // 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.
        // 
        return clientDataObject;

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

    }//END getTrialAlertObject method
Beispiel #13
0
    // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    #endregion

    #region Class public methods

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

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

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

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

        // 
        // Determine the method to be called
        // 
        switch ( PageCommand.Method )
        {
          case Evado.Model.UniForm.ApplicationMethods.List_of_Objects:
          case Evado.Model.UniForm.ApplicationMethods.Get_Object:
          case Evado.Model.UniForm.ApplicationMethods.Create_Object:
          case Evado.Model.UniForm.ApplicationMethods.Save_Object:
          case Evado.Model.UniForm.ApplicationMethods.Delete_Object:
            {
              switch ( pageId )
              {
                case EdStaticPageIds.User_Registration_Page:
                default:
                  {
                    clientDataObject = this.getDataObject_RegistrationPage ( PageCommand );
                    break;
                  }
                case 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