Beispiel #1
0
        public void TestInheritedDependencies()
        {
            var week = new Week();

            week.AddShift(DayOfWeek.Monday, 9, 30, 0, 0, TimeSpan.FromHours(4));
            week.AddShift(DayOfWeek.Monday, 14, 30, 0, 0, TimeSpan.FromHours(3));

            DateTime end = week.DateAdd(new DateTime(2011, 11, 1, 9, 30, 0), TimeSpan.FromHours(7));

            Console.WriteLine(end);

            var project = new Project("Some project", new DateTime(2011, 11, 1, 9, 30, 0), week);

            project.AddTask(new Task("Phase 1"));
            project.Tasks[0].AddChild(new Task("Task 1", TimeSpan.FromHours(10)));
            project.Tasks[0].AddChild(new Task("Task 2", TimeSpan.FromHours(15)));

            project.AddTask(new Task("Phase 2"));
            project.Tasks[1].AddChild(new Task("Task 1", TimeSpan.FromHours(12)));

            project.Tasks[1].AddDependency(new FinishToStartDependency(project.Tasks[0]));
            project.RecalculateDates();

            Assert.AreNotEqual(project.Tasks[0].StartDate, project.Tasks[1].StartDate);
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            Week week = new Week();

            week.AddShift(DayOfWeek.Monday, 9, 30, 0, 0, TimeSpan.FromHours(2));
            week.AddShift(DayOfWeek.Monday, 12, 30, 0, 0, TimeSpan.FromHours(2));
            week.AddShift(DayOfWeek.Monday, 15, 30, 0, 0, TimeSpan.FromHours(2));

            week.AddShift(DayOfWeek.Tuesday, 9, 30, 0, 0, TimeSpan.FromHours(2));
            week.AddShift(DayOfWeek.Tuesday, 12, 30, 0, 0, TimeSpan.FromHours(2));
            week.AddShift(DayOfWeek.Tuesday, 15, 30, 0, 0, TimeSpan.FromHours(2));

            week.AddShift(DayOfWeek.Wednesday, 9, 30, 0, 0, TimeSpan.FromHours(2));
            week.AddShift(DayOfWeek.Wednesday, 12, 30, 0, 0, TimeSpan.FromHours(2));
            week.AddShift(DayOfWeek.Wednesday, 15, 30, 0, 0, TimeSpan.FromHours(2));

            week.RemoveShift(DayOfWeek.Tuesday, 12, 30, 0, 0);

            foreach (Shift shift in week.AscendingShifts(new DateTime(2010, 6, 28, 0, 0, 0), new DateTime(2010, 6, 30, 0, 0, 0)))
            {
                System.Diagnostics.Debug.WriteLine(shift.StartTime);
            }

            foreach (Shift shift in week.DescendingShifts(new DateTime(2010, 6, 30, 0, 0, 0), new DateTime(2010, 6, 28, 0, 0, 0)))
            {
                System.Diagnostics.Debug.WriteLine(shift.StartTime);
            }

            System.Diagnostics.Debug.WriteLine("");

            System.Diagnostics.Debug.WriteLine(week.DateAdd(new DateTime(2010, 6, 30, 0, 0, 0), new TimeSpan(29, 2, 3, 0)));

            System.Diagnostics.Debug.WriteLine("");
            System.Diagnostics.Debug.WriteLine(week.DateAdd(new DateTime(2010, 6, 30, 0, 0, 0), new TimeSpan(-29, 2, 0, 0)));

            System.Diagnostics.Debug.WriteLine("");
            System.Diagnostics.Debug.WriteLine(week.DateDiff(new DateTime(2010, 6, 30, 0, 0, 0), new DateTime(2010, 7, 1, 0, 0, 0)));

            System.Diagnostics.Debug.WriteLine("");
            System.Diagnostics.Debug.WriteLine(week.DateDiff(new DateTime(2010, 7, 1, 0, 0, 0), new DateTime(2010, 6, 30, 0, 0, 0)));

            System.Diagnostics.Debug.WriteLine("");
            System.Diagnostics.Debug.WriteLine(week.Duration);
        }