| Quintiq file version 2.0 | 
| #parent: #root | 
| Method CalculateEventType () const declarative as String | 
| { | 
|   TextBody: | 
|   [* | 
|     // rislai Jun-19-2024 (created) | 
|     values := construct( Strings ); | 
|      | 
|     traverse( this.UnitPeriodTime().Unit().UnitCalendar(),Participation,participation,participation.Event().Type() = LibCal_Event::TYPE_UNAVAILABLE()){ | 
|         event := participation.Event(); | 
|          | 
|         if( this.UnitPeriodTime().Start().Date() >= event.EarliestStart() and this.UnitPeriodTime().End().Date() <= event.LatestEnd() ){ | 
|           intervals := selectset( event,LeadingParticipation.ExplicitTimeInterval,interval,LocalTool::IsAnyDurationContained( interval.Start(),interval.End(),this.UnitPeriodTime().Start(),this.UnitPeriodTime().End())); | 
|          | 
|           traverse( intervals,Elements,interval){ | 
|             values.Add( ifexpr( isnull( interval.Participation().Event().EventType().Parent()),interval.Participation().Event().EventType().ID(),interval.Participation().Event().EventType().Parent().ID() )); | 
|           } | 
|         } | 
|     } | 
|     values := selectuniquevalues( values,Elements,value,true,value ); | 
|      | 
|     result := ""; | 
|     flag := true; | 
|     traverse( values,Elements,value ,flag){ | 
|       if( value = "调休" and result <> "法定节假日"){ | 
|         result := "调休";  | 
|       }else if( value = "法定节假日" and result <> "法定节假日"){ | 
|         result := "法定节假日"; | 
|       }else if( value = "周六" and result <> "法定节假日"){ | 
|         result := "周六"; | 
|       }else if( value = "周日" and result <> "法定节假日"){ | 
|         result := "周日"; | 
|       }else if( value = "周末" and result <> "法定节假日"){ | 
|         result := "周末"; | 
|       } | 
|     } | 
|      | 
|     return result; | 
|   *] | 
| } |