yanweiyuan3
2023-08-09 588bc7829387dfc761cc25f06f77d4c81818bd10
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
Quintiq file version 2.0
#parent: #root
MethodOverride Synchronize (
  String participationID_i,
  String calendarType_i,
  String calendarID_i,
  Boolean eventIsRecurring_i,
  Boolean eventIsAllDay_i,
  Duration eventStartTimeOfDay_i,
  Duration eventDuration_i,
  Date startDate_i,
  Boolean hasSpecificPeriod_i,
  String periodType_i,
  Date periodStartDate_i,
  Number periodNrOfOccurrences_i,
  Date periodEndDate_i
)
{
  TextBody:
  [*
    // Don't update in case of IsAllDay.
    // In that case the StartDate and EndDate will be updated by SetIsAllDay.
    // Unless the participation has just been created; in that case it must be updated to initialize it.
    // Or unless the StartDate has changed.
    if( not eventIsAllDay_i
        or this.StartDate().IsInfinite()
        or this.StartDate() <> startDate_i )
    {
      // Calculate startTime and endTime, taking timezone and DSL into account.
      timezone  := this.Calendar().GetTimeZone();
      startTime := LibCal_Util::CalculateStartTime( timezone, startDate_i, eventStartTimeOfDay_i );
      endTime   := LibCal_Util::CalculateEndTime(   timezone, startDate_i, eventStartTimeOfDay_i, eventDuration_i );
      this.Update( startTime.Date( timezone ), endTime.Date( timezone ) );
    }
    
    // Also synchronize the RecurrencePeriod.
    super.Synchronize( participationID_i,
                       calendarType_i,
                       calendarID_i,
                       eventIsRecurring_i,
                       eventIsAllDay_i,
                       eventStartTimeOfDay_i,
                       eventDuration_i,
                       startDate_i,
                       hasSpecificPeriod_i,
                       periodType_i,
                       periodStartDate_i,
                       periodNrOfOccurrences_i,
                       periodEndDate_i );
  *]
}