コード例 #1
0
        public List <TaskInformation> GetTasksWithHierarhy()
        {
            List <TaskInformation> taskList = new List <TaskInformation>();
            string levelStr = string.Empty;

            int level = 0;

            //First item in hierarhy is project file first name, so we need to ignore it
            foreach (Task firstOrderTask in project.getChildTasks().toArray())
            {
                foreach (Task normalTask in firstOrderTask.getChildTasks().toArray())
                {
                    level++;
                    var             assigments = normalTask.getResourceAssignments().toArray();
                    List <Resource> list       = new List <Resource>();
                    for (int i = 0; i < assigments.Length; ++i)
                    {
                        list.Add((assigments[i] as ResourceAssignment).getResource());
                    }
                    TaskInformation task = new TaskInformation(normalTask, list);
                    GetTaskHierarhy(ref task);
                    taskList.Add(task);
                }
            }

            return(taskList);
        }
コード例 #2
0
        List <TaskInformation> GetFinalTasks(TaskInformation taskInf)
        {
            List <TaskInformation> result = new List <TaskInformation>();

            if (taskInf.ChildTasks.Count == 0)
            {
                result.Add(taskInf);
            }
            else
            {
                foreach (TaskInformation t in taskInf.ChildTasks)
                {
                    result.AddRange(GetFinalTasks(t));
                }
            }
            return(result);
        }
コード例 #3
0
 private void GetTaskHierarhy(ref TaskInformation task)
 {
     if (task.GetChildTasks() != null && task.GetChildTasks().Length > 0)
     {
         foreach (Task t in task.GetChildTasks())
         {
             var             assigments = t.getResourceAssignments().toArray();
             List <Resource> list       = new List <Resource>();
             for (int i = 0; i < assigments.Length; ++i)
             {
                 list.Add((assigments[i] as ResourceAssignment).getResource());
             }
             TaskInformation taskInf = new TaskInformation(t, list);
             GetTaskHierarhy(ref taskInf);
             task.ChildTasks.Add(taskInf);
         }
     }
 }
コード例 #4
0
 public void AddTask(TaskInformation t)
 {
     Tasks.Add(t);
 }