chenqinghong
2024-05-07 3ec06a830367465068963156dcc1d8e522571c13
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
Quintiq file version 2.0
#parent: #root
Method SetParticipationData () id:Method_LibCal_dlgEvent_SetParticipationData
{
  #keys: '[131094.1.110552282]'
  Body:
  [*
    sParticipation := dhLeadingParticipation.Data();
    
    // If the StartDate is earlier than the start of the CalendarWindow, then set the StartDate
    // to the date of the first recurrence within the CalendarWindow.
    // This prevents showing dates from potentially long in the past.
    startDate := sParticipation.StartDate();
    if( sParticipation.IsRecurring() and
        startDate < sParticipation.Calendar().StartDate() )
    {
      dateOfFirstRecurrence := this.GetDateOfFirstRecurrence( sParticipation.Calendar().StartDate() );
      startDate             := this.GetDateOfNextOccurrence( dateOfFirstRecurrence, dateOfFirstRecurrence );
    }
    
    delta := startDate - sParticipation.StartDate();
    
    // Only the value of the following two controls have to be set explicitly (in this order!),
    // the value of the other controls are then set via the responses of these controls.
    dhEndDate  .Data( sParticipation.EndDate() + delta );
    dsStartDate.Date( startDate );
    
    // Directly initialize the Duration
    this.InitializeDuration();
  *]
}