Aspose.Tasks.Examples.CSharp.WorkingWithTasks.WorkingWithTaskConstraints.GetConstraints.Run C# (CSharp) Method

Run() public static method

public static Run ( ) : void
return void
        public static void Run()
        {
            // ExStart:GetConstraints
            string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.FullName);
            Project project1 = new Project(dataDir + "Project2.mpp");

            // Create a ChildTasksCollector instance
            ChildTasksCollector collector = new ChildTasksCollector();

            // Collect all the tasks from RootTask using TaskUtils
            TaskUtils.Apply(project1.RootTask, collector, 0);

            // Parse through all the collected tasks
            foreach (Aspose.Tasks.Task tsk1 in collector.Tasks)
            {
                if (tsk1.Get(Tsk.ConstraintDate).ToShortDateString() == "1/1/2000")
                    Console.WriteLine("NA");
                else
                    Console.WriteLine(tsk1.Get(Tsk.ConstraintDate).ToShortDateString());

                Console.WriteLine(tsk1.Get(Tsk.ConstraintType).ToString());
            }
            // ExEnd:GetConstraints
        }
    }
GetConstraints