lazhen
2024-12-18 32f0336643e045587fca0b513564ee68f6f801ab
_Main/BL/Type_LibCal_SubscriberEventTable/Method_InitializeTable.qbl
@@ -7,27 +7,21 @@
  TextBody:
  [*
    // 甄兰鸽 May-28-2024 (created)
    rownr                 := this.LibCal_SubscriberEventRow( relsize );
    traverse( subscribers, Elements, subscriber ){
      traverse( subscriber,Participation.astype( LibCal_Subscription ).LeadingParticipation, participation, participation.Event().EventCategory().Name() = 'Unavailable' ){
        event := participation.Event();
        row := selectobject( this, LibCal_SubscriberEventRow, row, row.Subscriber() = subscriber.CalendarID()
                             and row.Event() = event.Subject()
                             and row.EventType() = guard( event.EventType().Name(), '' )
                             );
    //rownr                 := this.LibCal_SubscriberEventRow( relsize );
    traverse( this.LibCal_Calendar(), Event.LeadingParticipation, lp, lp.Event().EventCategory().Name() = 'Unavailable' ){
      event               := lp.Event();
      rows                := selectset( this, LibCal_SubscriberEventRow, row, row.Event() = event.Subject() and row.EventType() = guard( event.EventType().Name(), '' ) );
      traverse( lp, Subscription, subscription ){
        row               := selectobject( rows, Elements, row, row.Subscriber() = subscription.Calendar().CalendarID() );
        
        if( isnull( row ) ){
          row := this.LibCal_SubscriberEventRow( relnew, RowNr := rownr, Subscriber := subscriber.CalendarID(),
                                                 Event := event.Subject(),
                                                 EventType := guard( event.EventType().Name(), '' ) );
          row             := this.LibCal_SubscriberEventRow( relnew, Subscriber   := subscription.Calendar().CalendarID()
                                                             , Event              := event.Subject()
                                                             , EventType          := guard( event.EventType().Name(), '' ) );
          
          rownr := rownr + 1;
        }
        
        traverse( participation, ExplicitTimeInterval, eti ){
        traverse( subscription, ExplicitTimeInterval, eti ){
          row.InitializeDate( this, eti.Start(), eti.End(), event.Description() );
        }
    
@@ -37,13 +31,13 @@
    //traverse( this, LibCal_SubscriberEventColumn, column ){
    //  info( '------------------------', column.Name(), column.Period(), column.TimeUnit() );
    //}
    Transaction::Transaction().Propagate( attribute( LibCal_SubscriberEventTable, MaxDayDate ) );
    Transaction::Transaction().Propagate( attribute( LibCal_SubscriberEventTable, MaxWeekDate ) );
    Transaction::Transaction().Propagate( attribute( LibCal_SubscriberEventTable, MaxMonthDate ) );
    Transaction::Transaction().Propagate( attribute( LibCal_SubscriberEventTable, MinDayDate ) );
    Transaction::Transaction().Propagate( attribute( LibCal_SubscriberEventTable, MinWeekDate ) );
    Transaction::Transaction().Propagate( attribute( LibCal_SubscriberEventTable, MinMonthDate ) );
    //
    //Transaction::Transaction().Propagate( attribute( LibCal_SubscriberEventTable, MaxDayDate ) );
    //Transaction::Transaction().Propagate( attribute( LibCal_SubscriberEventTable, MaxWeekDate ) );
    //Transaction::Transaction().Propagate( attribute( LibCal_SubscriberEventTable, MaxMonthDate ) );
    //Transaction::Transaction().Propagate( attribute( LibCal_SubscriberEventTable, MinDayDate ) );
    //Transaction::Transaction().Propagate( attribute( LibCal_SubscriberEventTable, MinWeekDate ) );
    //Transaction::Transaction().Propagate( attribute( LibCal_SubscriberEventTable, MinMonthDate ) );
    this.ProcessColumnDay();
    this.ProcessColumnWeek();
    this.ProcessColumnMonth();