Quintiq file version 2.0
#parent: #root
Method EditEvent (
  LibCal_LeadingParticipation leadPart_i
) id:Method_LibCal_dlgEvent_EditEvent #extension
{
  Body:
  [*
    // Set the Event and the related controls.
    // The values are explicitly assigned here 'at the beginning' to the controls,
    // so that the values can be used by the rest of the logic. Databinding is executed too late for that.
    // Further initialization is done in the OnCreated of the Dialog.
    sEvent := shadow( leadPart_i.Event() );
    dhEvent.Data( &sEvent );
    this.SetEventData();
    
    // Set the Participation and the related controls
    // (only the DataHolders, the Date-controls are set later on, after the recurrence has been initialized)
    sLeadPart := shadow( leadPart_i );
    dhStartDate.Data( sLeadPart.StartDate() );
    dhEndDate.Data(   sLeadPart.EndDate()   );
    dhLeadingParticipation.Data( &sLeadPart );
    
    // Initialize the capacity here, when done in the OnCreated() edtCapacity is not enabled correctly when the type is Capacity.
    this.InitializeCapacity();
    
    // Must be done here, when done in the OnCreated() there is no selection in the DropDownList.
    this.InitializeCategories();
    this.InitializeEventTypes();
    // Must be done here, when done in the OnCreated() the checkmarks are not always set.
    this.InitializeSubscribers();
    if( guard( sEvent.EventCategory().Name() = LibCal_Event::TYPE_UNAVAILABLE(), false ) )
    {
      pnlEventType.Visible( true );
    }else
    {
      pnlEventType.Visible( false );
    }
    // Open the dialog.
    this.Show( "modal" );
  *]
}
