Пример #1
0
    }//END method

    // ==================================================================================
    /// <summary>
    /// This methods returns a pageMenuGroup object contains a selection of applicationEvents.
    /// </summary>
    /// <param name="PageObject">Evado.UniForm.Model.Page object</param>
    /// <returns>Evado.UniForm.Model.Group object</returns>
    //  ---------------------------------------------------------------------------------
    public void getSelectionGroup (
      Evado.UniForm.Model.Page PageObject )
    {
      this.LogMethod ( "getSelectionGroup" );

      this.LogValue ( "EventStartDate: " + this.Session.EventStartDate );
      this.LogValue ( "EventFinishDate: " + this.Session.EventFinishDate );

      // 
      // initialise the methods variables and objects.
      // 
      Evado.UniForm.Model.Field groupField = new Evado.UniForm.Model.Field ( );
      DateTime rangeStartDate = EvStatics.getDateTime ( "1 jan 2020" );
      DateTime rangeFinishDate = DateTime.Now.AddDays ( 1 );

      //
      // create the selection group.
      //
      Evado.UniForm.Model.Group selectionGroup = PageObject.AddGroup (
        EdLabels.ApplicationEvent_Selection_Group_Title,
        Evado.UniForm.Model.EditAccess.Enabled );
      selectionGroup.Layout = Evado.UniForm.Model.GroupLayouts.Full_Width;

      // 
      // Set the selection to the start date
      // 
      groupField = selectionGroup.createDateField (
        EuApplicationEvents.CONST_START_DATE_FIELD_ID,
        EdLabels.ApplicationEvent_Start_Date_Selection_Field_Label,
        this.Session.EventStartDate,
        rangeStartDate, rangeFinishDate );
      groupField.Layout = EuAdapter.DefaultFieldLayout;

      groupField.AddParameter ( Evado.UniForm.Model.FieldParameterList.Snd_Cmd_On_Change, 1 );

      // 
      // Set the selection to the start date
      // 
      groupField = selectionGroup.createDateField (
        EuApplicationEvents.CONST_FINISH_DATE_FIELD_ID,
        EdLabels.ApplicationEvent_Finish_Date_Selection_Field_Label,
        this.Session.EventFinishDate,
        rangeStartDate, rangeFinishDate );
      groupField.Layout = EuAdapter.DefaultFieldLayout;

      groupField.AddParameter ( Evado.UniForm.Model.FieldParameterList.Snd_Cmd_On_Change, 1 );

      //
      // get the list of event codes.
      //
      if ( this.AdapterObjects.EventCodeSelectionList.Count == 0 )
      {
        this.AdapterObjects.EventCodeSelectionList = Evado.Model.EvStatics.getOptionsFromEnum ( typeof ( EvEventCodes ), true );

        Evado.Digital.Model.EvcStatics.sortOptionListValues ( this.AdapterObjects.EventCodeSelectionList );
      }

      // 
      // Set the selection to the event id
      // 
      groupField = selectionGroup.createSelectionListField (
        EuApplicationEvents.CONST_EVENT_FIELD_ID,
        EdLabels.ApplicationEvent_Event_Id_Selection_Field_Label,
        this.Session.EventId.ToString ( ),
        this.AdapterObjects.EventCodeSelectionList );
      groupField.Layout = EuAdapter.DefaultFieldLayout;

      groupField.AddParameter ( Evado.UniForm.Model.FieldParameterList.Snd_Cmd_On_Change, 1 );


      //
      // get the list of event ids.
      //
      List<EvOption> optionList = Evado.Model.EvStatics.getOptionsFromEnum ( typeof ( EvApplicationEvent.EventType ), true );
      // 
      // Set the selection to the type id
      // 
      groupField = selectionGroup.createSelectionListField (
        EuApplicationEvents.CONST_TYPE_FIELD_ID,
        EdLabels.ApplicationEvent_Type_Selection_Field_Label,
        this.Session.EventType,
        optionList );
      groupField.Layout = EuAdapter.DefaultFieldLayout;

      groupField.AddParameter ( Evado.UniForm.Model.FieldParameterList.Snd_Cmd_On_Change, 1 );

      // 
      // Set the selection to the USER Name
      // 
      Evado.Digital.Model.EvcStatics.sortOptionListValues ( this.Session.EventUserSelectionList );

      groupField = selectionGroup.createSelectionListField (
        EuApplicationEvents.CONST_USER_FIELD_ID,
        EdLabels.ApplicationEvent_UserName_Selection_Field_Label,
        this.Session.EventUserName,
        this.Session.EventUserSelectionList );
      groupField.Layout = EuAdapter.DefaultFieldLayout;

      groupField.AddParameter ( Evado.UniForm.Model.FieldParameterList.Snd_Cmd_On_Change, 1 );


      // 
      // Create a custom groupCommand to process the selection.
      // 
      Evado.UniForm.Model.Command customCommand = selectionGroup.addCommand (
        EdLabels.ApplicationEvent_Selection_Command_Title,
        EuAdapter.ADAPTER_ID,
        EuAdapterClasses.Events.ToString ( ),
        Evado.UniForm.Model.ApplicationMethods.Custom_Method );

      // 
      // Set the custom groupCommand parameter.
      // 
      customCommand.setCustomMethod ( Evado.UniForm.Model.ApplicationMethods.List_of_Objects );

    }//END getSelectionGroup method
Пример #2
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