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
Quintiq file version 2.0
#parent: #root
StaticMethod GetInfoNonRecurring (
  Date startDate_i,
  Duration startTimeOfDay_i,
  Date endDate_i,
  Duration endTimeOfDay_i,
  TimeZone timezone_i,
  Duration duration_i
) const declarative remote as String
{
  Description:
  [*
    Get information about the Participation in textual format.
    Is implemented as a static method so it can also be called from the UI when there is no instance available yet.
  *]
  TextBody:
  [*
    value   := "";
    convOps := ConversionOptions::ISO();
    
    // 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.
    startTime      := LibCal_Util::CalculateStartTime( timezone_i, startDate_i, startTimeOfDay_i );
    startDate      := startTime.Date(      timezone_i );
    startTimeOfDay := startTime.TimeOfDay( timezone_i );
    
    endTime        := LibCal_Util::CalculateEndTime( timezone_i, startDate_i, startTimeOfDay_i, duration_i );
    endDate        := endTime  .Date(      timezone_i );
    endTimeOfDay   := endTime  .TimeOfDay( timezone_i );
     
    if( endDate_i = startDate_i )
    {
      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 );
    }
    
    return value;
  *]
}