public override void update()
 {
     CswNbtMetaDataObjectClass GeneratorClass = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswEnumNbtObjectClass.GeneratorClass );
     foreach( CswNbtObjClassGenerator GeneratorNode in GeneratorClass.getNodes( false, false ) )
     {
         if( GeneratorNode.Enabled.Checked == CswEnumTristate.True )
         {
             if( GeneratorNode.NextDueDate.DateTimeValue != DateTime.MinValue )
             {
                 CswNbtView GeneratorTasksView = GeneratorNode.GetGeneratedTargetsView( DateTime.MinValue );
                 ICswNbtTree TasksTree = _CswNbtSchemaModTrnsctn.getTreeFromView( GeneratorTasksView, false );
                 int NumTasks = TasksTree.getChildNodeCount();
                 if( NumTasks > 0 )
                 {
                     DateTime LastTaskDueDate = DateTime.MinValue;
                     for( int i = 0; i < NumTasks; i++ )
                     {
                         TasksTree.goToNthChild(i);
                         CswNbtPropertySetGeneratorTarget TaskNode = TasksTree.getNodeForCurrentPosition();
                         if( TaskNode.DueDate.DateTimeValue > LastTaskDueDate )
                         {
                             LastTaskDueDate = TaskNode.DueDate.DateTimeValue;
                         }
                         TasksTree.goToParentNode();
                     }
                     DateTime ExpectedNextDueDate = GeneratorNode.DueDateInterval.getNextOccuranceAfter( LastTaskDueDate );
                     if( ExpectedNextDueDate != GeneratorNode.NextDueDate.DateTimeValue )
                     {
                         GeneratorNode.NextDueDate.DateTimeValue = ExpectedNextDueDate;
                         GeneratorNode.postChanges( true );
                     }
                 }
                 else
                 {
                     GeneratorNode.NextDueDate.DateTimeValue = DateTime.MinValue;
                     GeneratorNode.updateNextDueDate( ForceUpdate: true, DeleteFutureNodes: false );
                     GeneratorNode.postChanges( true );
                 }
             }
             else
             {
                 GeneratorNode.updateNextDueDate( ForceUpdate: true, DeleteFutureNodes: false );
                 GeneratorNode.postChanges( true );
             }
         }
     }
 } // update()
Exemplo n.º 2
0
 public override void update()
 {
     // Reset warning days
     CswNbtMetaDataObjectClass GeneratorOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( NbtObjectClass.GeneratorClass );
     
     foreach( CswNbtObjClassGenerator GeneratorNode in GeneratorOC.getNodes( forceReInit: false,
                                                                             includeSystemNodes: true, 
                                                                             IncludeDefaultFilters: false, 
                                                                             IncludeHiddenNodes: true ) )
     {
         Int32 max = GeneratorNode.DueDateInterval.getMaximumWarningDays();
         if(GeneratorNode.WarningDays.Value > max)
         {
             GeneratorNode.WarningDays.Value = max;
         }
         GeneratorNode.postChanges( false );
     } // foreach
 } // update()