Quintiq file version 2.0
#parent: #root
Method CreateUpdateEventAndParticipation () as LibCal_Event id:Method_LibCal_dlgMultipleEvent_CreateUpdateEventAndParticipation
{
  #keys: '[415136.0.649421703]'
  Body:
  [*
    sEvent    := dhEvent.Data();
    sLeadPart := dhLeadingParticipation.Data();
    
    // Get the values from the controls.
    
    // Event and LeadingParticipation
    subject        := edtName.Text();
    description    := edtDescription.Text();
    eventTypeList  := ddlEventType.Data();
    category       := sEvent.EventCategory(); 
    isDefault      := ckbApplyToNewResources.Checked();
    startDate      := dsStartDate.Date();
    startTimeOfDay := durStartTimeOfDay.Duration();
    endDate        := dsStartDate.Date();
    endTimeOfDay   := durEndTimeOfDay.Duration();
    isAllDay       := false;
    
    eventType := ddslType.Text();
    capacity  := Real::MinReal();  // Always fill the capacity.
    
    // RecurrencePattern
    isRecurring        := false;
    recurrenceInterval := 1;
    patternType        := LibCal_RecurrencePeriod::TYPE_WITHOUTEND();
    
    // Daily
    daily_IsEveryWeekday := false;
    
    // Weekly
    weekly_Weekdays := "";
    
    // Monthly
    monthly_IsDay       := false;
    monthly_Day         := 0;
    monthly_WeekOfMonth := '';
    monthly_DayOfWeek   := '';
    
    // Yearly
    yearly_IsDate      := false;
    //month              := '';
    yearly_Month       := 0;
    yearly_Day         := 0;
    yearly_WeekOfMonth := '';
    yearly_DayOfWeek   := '';
    
    // RecurrencePeriod
    periodType      := LibCal_RecurrencePeriod::TYPE_WITHOUTEND();
    periodStartDate := Date::MinDate();
    periodEndDate   := Date::MinDate();
    nrOfOccurrences := 0;
    
    // All values are passed to the Server, only the relevant values are used there.
    event := LibCal_Event::CreateUpdateFromUI( sEvent.Calendar(), sLeadPart.WrappedInstance(),
                                               subject, description, eventType, eventTypeList, capacity, category, isDefault,
                                               startDate, startTimeOfDay, endDate, endTimeOfDay, isAllDay,
                                               // RecurrencePattern
                                               isRecurring, recurrenceInterval, patternType,
                                               daily_IsEveryWeekday,
                                               weekly_Weekdays,
                                               monthly_IsDay, monthly_Day,  monthly_WeekOfMonth, monthly_DayOfWeek,
                                               yearly_IsDate, yearly_Month, yearly_Day, yearly_WeekOfMonth, yearly_DayOfWeek,
                                               // RecurrencePeriod
                                               periodType, periodStartDate, nrOfOccurrences, periodEndDate,
                                               // Subscribers
                                               dhSubscribers.Data() );
    
    return event;
  *]
}
