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
51
52
Quintiq file version 2.0
#parent: #root
Method SetTimeIntervalData () id:Method_LibCal_dlgEditTimeInterval_SetTimeIntervalData
{
  #keys: '[131094.0.2073189978]'
  Body:
  [*
    // Initialize the DataHolders that are related to the TimeInterval.
    sTimeInterval := dhExplicitTimeInterval.Data();
    timezone      := Form.GetCalendarTimeZone();
    
    // Split the date and the time.
    // Start
    date      := sTimeInterval.Start().Date( timezone );
    timeOfDay := sTimeInterval.Start().TimeOfDay( timezone );
    
    dhStartDate.Data( date );
    dhStartTimeOfDay.Data( timeOfDay );
    
    dsStartDate.Date( date );
    durStartTimeOfDay.Duration( timeOfDay );
    
    // End
    date      := sTimeInterval.End().Date( timezone );
    timeOfDay := sTimeInterval.End().TimeOfDay(  timezone );
    
    dhEndDate.Data( date );
    dhEndTimeOfDay.Data( timeOfDay );
    
    dsEndDate.Date( date );
    durEndTimeOfDay.Duration( timeOfDay );
    
    // In principle the dialog can also be used for 'generic' ExplicitTimeIntervals;
    // in that case there is no participation available.
    if( sTimeInterval.istype( shadow[LibCal_ExplicitTimeInterval] ) )
    {
      event := sTimeInterval.astype( shadow[LibCal_ExplicitTimeInterval] ).Participation().Event();
      lblSubject.Text( event.Subject() );
      lblSubject.Tooltip( event.Info() );
      
      isAllDay := sTimeInterval.Start().TimeOfDay( timezone ) = Duration::Zero()
              and sTimeInterval.End()  .TimeOfDay( timezone ) = Duration::Zero();    
      ckbIsAllDay.Checked( isAllDay );
    }
    
    durationInDays := ( sTimeInterval.End() - sTimeInterval.Start() ).Ceil( Duration::Days( 1 ) );
    npDuration.Number( durationInDays.Days() );  // Is only used when running in days only mode,
                                                 // but set it anyway.
    
    edtComment.Text( sTimeInterval.Comment() );
  *]
}