Quintiq file version 2.0
#parent: #root
Method UpdateTextualInfo () id:Method_LibCal_dlgEvent_UpdateTextualInfo
{
  #keys: '[146730.0.1532612650]'
  Body:
  [*
    // Skip if the StartDate is not initialized yet.
    if( dsStartDate.Date().IsFinite() )
    {
      value       := "";
      patternType := this.GetPatternType();
      periodType  := this.GetPeriodType();
      timezone    := this.GetCalendarTimeZone();
      
      if( patternType = LibCal_RecurrencePattern::TYPE_NONE() )
      {
        // No recurrence
        value := LibCal_Participation::GetInfoNonRecurring( dsStartDate.Date(), durStartTimeOfDay.Duration(),
                                                            dsEndDate  .Date(), durEndTimeOfDay  .Duration(),
                                                            timezone, dhDuration.Data() );
      }
      
      else
      {
        // RecurrencePattern
        if( patternType = LibCal_RecurrencePattern::TYPE_DAILY() )
        {
          value := LibCal_RecurrencePatternDaily::GetInfo( this.GetRecurrenceInterval(),
                                                           ckbEveryWeekday.Checked() );
        }
      
        else if( patternType = LibCal_RecurrencePattern::TYPE_WEEKLY() )
        {
          value := LibCal_RecurrencePatternWeekly::GetInfo( this.GetRecurrenceInterval(),
                                                            btnMonday  .IsPressed(), btnTuesday.IsPressed(), btnWednesday.IsPressed(),
                                                            btnThursday.IsPressed(), btnFriday .IsPressed(), btnSaturday .IsPressed(), btnSunday.IsPressed() );
        }
      
        else if( patternType = LibCal_RecurrencePattern::TYPE_MONTHLY() )
        {
          value := LibCal_RecurrencePatternMonthly::GetInfo( this.GetRecurrenceInterval(), ckbMonthlyDay.Checked(),
                                                             [Number]edtMonthlyDay.Text(),
                                                             lblMonthlyPatternWeekOfMonth.Text(), lblMonthlyPatternDayOfWeek.Text() );
        
        }
      
        else if( patternType = LibCal_RecurrencePattern::TYPE_YEARLY() )
        {
          yearly_IsDate := ckbYearlyDay.Checked();
          month         := ifexpr( yearly_IsDate, lblYearlyMonth.Text(), lblYearlyPatternMonth.Text() );
          
          value := LibCal_RecurrencePatternYearly::GetInfo( this.GetRecurrenceInterval(), yearly_IsDate,
                                                            this.GetNrOfMonth( month ), [Number]lblYearlyDayOfMonth.Text(),
                                                            lblYearlyPatternWeekOfMonth.Text(),  lblYearlyPatternDayOfWeek.Text() );
        }
      
        fromTo := " from  " + durStartTimeOfDay.Duration().Format( "H:m" )
                + " to "    + durEndTimeOfDay.Duration()  .Format( "H:m" );
      
        value := value + fromTo;
      
        // RecurrencePeriod
        periodText      := "";
        periodStartDate := dsStartOfPeriod.Date();
        periodEndDate   := dsEndOfPeriod.Date();
        nrOfOccurrences := [Number]edtNrOfOccurrences.Text();
        
        if( periodType = LibCal_RecurrencePeriod::TYPE_WITHOUTEND() )
        {
          periodText := LibCal_RecurrencePeriodWithoutEnd::GetInfo( periodStartDate );
        }  
        
        else if( periodType = LibCal_RecurrencePeriod::TYPE_NROFOCCURRENCES() )
        {
          periodText := LibCal_RecurrencePeriodNrOfOccurrences::GetInfo( periodStartDate, nrOfOccurrences, periodEndDate );
        }  
      
        else if( periodType = LibCal_RecurrencePeriod::TYPE_WITHENDDATE() )
        {
          periodText := LibCal_RecurrencePeriodWithEndDate::GetInfo( periodStartDate, periodEndDate );
        }
        
        value := value + ", " + periodText;
      }
      
      lblInformation.Text( "Occurs " + value );
    }
  *]
}
