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
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
79
80
81
82
83
84
85
86
87
88
89
90
91
Quintiq file version 2.0
#parent: #root
Method GetInfo () declarative as String
{
  Description: 'Get information about the Event and the RecurrencePattern in textual format.'
  TextBody:
  [*
    value   := "";
    event   := this.Event();
    
    if( this.IsRecurring() )
    { 
      fromTo := " from  " + event.StartTimeOfDay().Format( "H:m" )
              + " to "    + event.EndTimeOfDay()  .Format( "H:m" );
    
      value := this.RecurrencePattern().Info() + fromTo;
    }
    else
    {
      timezone := event.Calendar().GetTimeZone();
      value    := LibCal_Participation::GetInfoNonRecurring( this.StartDate(), event.StartTimeOfDay(),
                                                             this.EndDate(),   event.EndTimeOfDay(),
                                                             timezone,         event.Duration() );
    }
    
    // Add the duration, except when it concerns event "Always available".
    if( not event.IsAlwaysAvailableEvent() )
    {
      value := value + LibCal_Participation::GetInfoDuration( event.Duration() );
    }
      
    return value;
    
    /* @PvG
    value   := "";
    event   := this.Event();
    convOps := ConversionOptions::ISO();
    
    if( this.IsRecurring() )
    { 
      fromTo := " from  " + event.StartTimeOfDay().Format( "H:m" )
              + " to "    + event.EndTimeOfDay()  .Format( "H:m" );
    
      value := this.RecurrencePattern().Info() + fromTo;
    }
    else
    {
      // No RecurrencePattern, only from and to.
      // Format depending on whether the participation is on one day or not.
      // Show the info using the timezone of the calendar instead of in GMT.
      timezone       := this.Event().Calendar().GetTimeZone();
      startDate      := this.StartTime().Date(      timezone );
      startTimeOfDay := this.StartTime().TimeOfDay( timezone );
      endDate        := this.EndTime()  .Date(      timezone );
      endTimeOfDay   := this.EndTime()  .TimeOfDay( timezone );
       
      if( this.EndDate() = this.StartDate() )
      {
        value :=             startDate.Format( "dd D-MM-Y" )
               + " from  " + startTimeOfDay.Format( "H:m", convOps )
               + " to "    + endTimeOfDay  .Format( "H:m", convOps );
      }
      else
      {
        value := "from  " + startDate.Format( "dd D2-MM-Y", convOps ) + startTimeOfDay.Format( "  H:m", convOps )
               + " to "   + endDate  .Format( "dd D2-MM-Y", convOps ) + endTimeOfDay  .Format( "  H:m", convOps );
      }
    }
    
    // Don't show the duration for event "Always available".
    if( not event.IsAlwaysAvailableEvent() )
    {
      // Format the duration depending on its value.
      dur  := event.Duration();
      mask := "h:m";
      
      if( dur >= Duration::Days( 1 ) )
      {
        days := "d 'day" + ifexpr( dur >= Duration::Days( 2 ), "s'", "'" );
        mask := days     + ifexpr( dur  = dur.StartOfDay()   , ""  , "  " + mask );
      }
      
      duration := "  (duration = " + dur.Format( mask ) + ")";
        
      value := value + duration;
    }
      
    return value;
  *]
  InterfaceProperties { Accessibility: 'Module' }
}