Exemplo n.º 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