haorenhui
2023-10-30 6d6cc10d9e8e242661da7fd655dec155a09d676c
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
Quintiq file version 2.0
#parent: #root
Method UpdateRecurrencePattern (
  Boolean isRecurring_i,
  String patternType_i,
  Number recurrenceInterval_i,
  Boolean daily_IsEveryDay_i,
  String weekly_Weekdays_i,
  Boolean monthly_IsDay_i,
  Number monthly_Day_i,
  String monthly_WeekOfMonth_i,
  String monthly_DayOfWeek_i,
  Boolean yearly_IsDate_i,
  Number yearly_Month_i,
  Number yearly_Day_i,
  String yearly_WeekOfMonth_i,
  String yearly_DayOfWeek_i
)
{
  TextBody:
  [*
    if( not isRecurring_i )
    {
      // Remove the RecurrencePattern.
      this.RemoveRecurrencePattern();
    }
    else
    {
      // Set a RecurrencePattern of the applicable type.
      
      if( patternType_i = LibCal_RecurrencePattern::TYPE_DAILY() )
      {
        this.SetRecurrencePatternDaily( daily_IsEveryDay_i );
      }
    
      else if( patternType_i = LibCal_RecurrencePattern::TYPE_WEEKLY() )
      {
        this.SetRecurrencePatternWeekly( weekly_Weekdays_i );
      }
      
      else if( patternType_i = LibCal_RecurrencePattern::TYPE_MONTHLY() )
      {
        if( monthly_IsDay_i )
        {
          this.SetRecurrencePatternMonthly( monthly_Day_i );
        }
        else
        {
          this.SetRecurrencePatternMonthly( monthly_WeekOfMonth_i, monthly_DayOfWeek_i );
        }
      }
      
      else if( patternType_i = LibCal_RecurrencePattern::TYPE_YEARLY() )
      {
        if( yearly_IsDate_i )
        {
          this.SetRecurrencePatternYearly( yearly_Month_i, yearly_Day_i );
        }
        else
        {
          this.SetRecurrencePatternYearly( yearly_Month_i, yearly_WeekOfMonth_i, yearly_DayOfWeek_i );
        }
      }
      
      else
      {
        LibCal_Util::Info( "LibCal_Event.UpdateRecurrencePattern() : unexpected PatternType '" + patternType_i + "' encountered." ); 
      }
      
      // Finally, set the recurrence interval.
      this.SetRecurrenceInterval( recurrenceInterval_i );
    }
    
    // Directly update the relation from the Participations to the RecurrencePattern.
    Transaction::Transaction().Propagate( relation( LibCal_Participation, RecurrencePattern ) );
  *]
  InterfaceProperties { Accessibility: 'Module' }
}