lazhen
2025-01-09 8afe90b633046db39042aada36b88193062f8cff
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
Quintiq file version 2.0
#parent: #root
Method InitializeRecurrencePeriod (
  shadow[LibCal_RecurrencePeriod] sRecurrencePeriod_i
) id:Method_LibCal_dlgEvent_InitializeRecurrencePeriod
{
  #keys: '[131092.0.2141066155]'
  Body:
  [*
    // Take over the existing period (if applicable)
    if( not isnull( sRecurrencePeriod_i ) )
    {
      dsStartOfPeriod.Date( sRecurrencePeriod_i.StartDate() );
      dhStartOfPeriod.Data( sRecurrencePeriod_i.StartDate() );
      
      // NoEnd
      if( sRecurrencePeriod_i.istype( shadow[LibCal_RecurrencePeriodWithoutEnd] ) )
      {
        // Is already initialized
      }
    
      // NrOfOccurrences
      else if( sRecurrencePeriod_i.istype( shadow[LibCal_RecurrencePeriodNrOfOccurrences] ) )
      {
        period := sRecurrencePeriod_i.astype( shadow[LibCal_RecurrencePeriodNrOfOccurrences] );
    
        ckbNoEndDate.Checked( false );
        ckbEndAfter. Checked(  true );
    
        edtNrOfOccurrences.Text( [String]period.NrOfOccurrences() );
      }
      
      // WithEndDate
      else if( sRecurrencePeriod_i.istype( shadow[LibCal_RecurrencePeriodWithEndDate] ) )
      {
        period := sRecurrencePeriod_i.astype( shadow[LibCal_RecurrencePeriodWithEndDate] );
    
        ckbEndBy.Checked( true );
        dsEndOfPeriod.Date( period.EndDate() );
      }
    }
    
    // Workaround for the fact that setting ckbEndOfPeriod.Checked() is not noticed during the first execution
    // of response dsStartOfPeriod.OnChanged(). See method SetEndOfPeriod() of the dialog for more information.
    lblWorkaround.Text( "initialized" );
    
    this.InitializeDuration();  // Explicitly initialize the duration
    this.SetEndOfPeriod();
  *]
}