10068 : Complete iteration GTP.NET Gantt

This article describes a complete iteration of all important data carriers of the Gantt in GTP.NET:

 

   private void buttonCompleteIteration_Click(object sender, System.EventArgs e)< ?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

    {

      // The root-level of the grid nodes you access this way;

      for(int i=0;i<gantt1.Grid.RootNodes.Count;i++)

      {

        DoCompleteIterationForOneNode(gantt1.Grid.RootNodes[i]);

      }     

    }

   

    private void DoCompleteIterationForOneNode(GridNode gn)

    {

      // Each gridnode has one cell per column

      for(int i=0;i<gn.GridStructure.Columns.Count;i++)

      {

       Object o=gn.GetCell(i).Content.Value;

      }

     

      // Each gridnode that is part of a gantt-grid has a GanttRow

      GanttRow gr=GanttRow.FromGridNode(gn);

     

      // Each GanttRow has layers, the normal scenario is that the GanttRow only has one layer

      for(int i=0;i<gr.Layers.Count;i++)

      {

        // Each Layer has time items

        for(int ii=0;ii<gr.Layers[i].Count;ii++)

        {

          // Each Layer has time items

          TimeItem ti=gr.Layers[i][ii];

          

          //a Time item can have time item texts

          for(int iii=0;iii<ti.TimeItemTexts.Count;iii++)

          {

            ti.TimeItemTexts[iii].Text=””;

          }

         

          // and a time item can also have links….         

          ArrayList links=gantt1.TimeItemLinks.GetLinksFromStart(ti);

         

          for(int iii=0;iii<links.Count;iii++)

          {

            TimeItemLink til=links[iii] as TimeItemLink;

            // Once you have a link you can access the seperate time items

            TimeItem ti1=til.Target;

            TimeItem ti2=til.Start;

          }

         

        }

       

      }

     

      // A grid node may have sub-nodes….

      for(int i=0;i<gn.SubNodes.Count;i++)

      {

        DoCompleteIterationForOneNode(gn.SubNodes[i]);

      }

     

    }