Exemple #1
0
        public void ProcessRequest(HttpContext context)
        {
            DateTime dtS = DateTime.Now;
            ObservableCollection<Resources> Resources = new ObservableCollection<Resources>();
            Resources res = new Resources() { RName = "JohnH", StartTime = dtS + TimeSpan.FromDays(1), EndTime = dtS + TimeSpan.FromDays(8) };
            res.Tasks.Add(new Task() { StartTime = dtS, EndTime = dtS + TimeSpan.FromDays(6), TaskName = "Task 1", Progress = 20 });
            res.Tasks.Add(new Task() { StartTime = dtS + TimeSpan.FromDays(5), EndTime = dtS + TimeSpan.FromDays(9), TaskName = "Task 2", Progress = 50 });
            Resources.Add(res);

            res = new Resources() { RName = "VictorG", StartTime = dtS + TimeSpan.FromDays(5), EndTime = dtS + TimeSpan.FromDays(10) };
            res.Tasks.Add(new Task() { StartTime = dtS, EndTime = dtS + TimeSpan.FromDays(7), TaskName = "Task 1", Progress = 20 });
            res.Tasks.Add(new Task() { StartTime = dtS + TimeSpan.FromDays(3), EndTime = dtS + TimeSpan.FromDays(7), TaskName = "Task 2", Progress = 50 });
            res.Tasks.Add(new Task() { StartTime = dtS + TimeSpan.FromDays(3), EndTime = dtS + TimeSpan.FromDays(7), TaskName = "Task 3", Progress = 50 });
            Resources.Add(res);

            res = new Resources() { RName = "JasonS", StartTime = dtS + TimeSpan.FromDays(3), EndTime = dtS + TimeSpan.FromDays(9) };
            res.Tasks.Add(new Task() { StartTime = dtS + TimeSpan.FromDays(2), EndTime = dtS + TimeSpan.FromDays(5), TaskName = "Task 1", Progress = 20 });
            res.Tasks.Add(new Task() { StartTime = dtS + TimeSpan.FromDays(8), EndTime = dtS + TimeSpan.FromDays(13), TaskName = "Task 2", Progress = 50 });
            Resources.Add(res);

            JavaScriptSerializer serializer = new JavaScriptSerializer();
            context.Response.Write(serializer.Serialize(Resources));
        }
        public void ProcessRequest(HttpContext context)
        {
            DateTime dtS = DateTime.Now;

            ObservableCollection<Team> Groups = new ObservableCollection<Team>();
            Groups.Add(new Team() { ResourceGroupName = "Group1", ResourceGroupID="Grp1" });

            Groups[0].Tasks = new ObservableCollection<Task>();
            Task task = new Task() { TaskName = "Task 1", StartTime = dtS, EndTime = dtS + TimeSpan.FromDays(3), Type = "ProductionOrder" };
            Groups[0].Tasks.Add(task);
            task = new Task() { TaskName = "Task 2", StartTime = dtS + TimeSpan.FromDays(4), EndTime = dtS + TimeSpan.FromDays(9), Type = "Order" };
            Groups[0].Tasks.Add(task);
            task = new Task() { TaskName = "Task 3", StartTime = dtS + TimeSpan.FromDays(10), EndTime = dtS + TimeSpan.FromDays(25), Type = "StockOrder" };
            Groups[0].Tasks.Add(task);

            Groups[0].Resources = new ObservableCollection<Resources>();
            Resources resource1 = new Resources() { RName = "Resource1", ResoucesID = "Res1" };
            Task task1 = new Task() { TaskName = "Task 4", StartTime = dtS + TimeSpan.FromDays(8), EndTime = dtS + TimeSpan.FromDays(12), Type = "ProductionOrder" };
            resource1.Tasks.Add(task1);
            task1 = new Task() { TaskName = "Task 5", StartTime = dtS + TimeSpan.FromDays(13), EndTime = dtS + TimeSpan.FromDays(20), Type = "Maintenance" };
            resource1.Tasks.Add(task1);
            Groups[0].Resources.Add(resource1);

            Resources resource2 = new Resources() { RName = "Resource2", ResoucesID = "Res2" };
            Task task2 = new Task() { TaskName = "Task 6", StartTime = dtS, EndTime = dtS + TimeSpan.FromDays(3), Type = "StockOrder" };
            resource2.Tasks.Add(task2);
            task2 = new Task() { TaskName = "Task 7", StartTime = dtS + TimeSpan.FromDays(4), EndTime = dtS + TimeSpan.FromDays(10), Type = "ProductionOrder" };
            resource2.Tasks.Add(task2);
            task2 = new Task() { TaskName = "Task 8", StartTime = dtS + TimeSpan.FromDays(11), EndTime = dtS + TimeSpan.FromDays(15), Type = "Order" };
            resource2.Tasks.Add(task2);
            Groups[0].Resources.Add(resource2);

            Resources resource3 = new Resources() { RName = "Resource3", ResoucesID = "Res3" };
            Task task3 = new Task() { TaskName = "Task 9", StartTime = dtS + TimeSpan.FromDays(8), EndTime = dtS + TimeSpan.FromDays(12), Type = "Order" };
            resource3.Tasks.Add(task3);
            Groups[0].Resources.Add(resource3);

            Groups.Add(new Team() { ResourceGroupName = "Group2", ResourceGroupID = "Grp2" });
            Groups[1].Tasks = new ObservableCollection<Task>();
            Task task4 = new Task() { TaskName = "Task 10", StartTime = dtS, EndTime = dtS + TimeSpan.FromDays(3), Type = "ProductionOrder" };
            Groups[1].Tasks.Add(task4);
            task4 = new Task() { TaskName = "Task 11", StartTime = dtS + TimeSpan.FromDays(6), EndTime = dtS + TimeSpan.FromDays(11), Type = "Order" };
            Groups[1].Tasks.Add(task4);
            task4 = new Task() { TaskName = "Task 12", StartTime = dtS + TimeSpan.FromDays(15), EndTime = dtS + TimeSpan.FromDays(25), Type = "StockOrder" };
            Groups[1].Tasks.Add(task4);

            Groups[1].Resources = new ObservableCollection<Resources>();
            Resources resource4 = new Resources() { RName = "Resource4", ResoucesID = "Res4" };
            Task task5 = new Task() { TaskName = "Task 13", StartTime = dtS + TimeSpan.FromDays(6), EndTime = dtS + TimeSpan.FromDays(12), Type = "ProductionOrder" };
            resource4.Tasks.Add(task5);
            Task task6 = new Task() { TaskName = "Task 14", StartTime = dtS + TimeSpan.FromDays(14), EndTime = dtS + TimeSpan.FromDays(20), Type = "Order" };
            resource4.Tasks.Add(task6);
            Groups[1].Resources.Add(resource4);

            Resources resource5 = new Resources() { RName = "Resource5", ResoucesID = "Res5" };
            Task task7 = new Task() { TaskName = "Task 15", StartTime = dtS + TimeSpan.FromDays(6), EndTime = dtS + TimeSpan.FromDays(12), Type = "ProductionOrder" };
            resource5.Tasks.Add(task7);
            Task task8 = new Task() { TaskName = "Task 16", StartTime = dtS + TimeSpan.FromDays(14), EndTime = dtS + TimeSpan.FromDays(18), Type = "Order" };
            resource5.Tasks.Add(task8);
            Task task9 = new Task() { TaskName = "Task 17", StartTime = dtS + TimeSpan.FromDays(19), EndTime = dtS + TimeSpan.FromDays(24), Type = "Maintenance" };
            resource5.Tasks.Add(task9);
            Groups[1].Resources.Add(resource5);

            Resources resource6 = new Resources() { RName = "Resource6", ResoucesID = "Res6" };
            Task task10 = new Task() { TaskName = "Task 18", StartTime = dtS + TimeSpan.FromDays(6), EndTime = dtS + TimeSpan.FromDays(12), Type = "Order" };
            resource6.Tasks.Add(task10);
            Groups[1].Resources.Add(resource6);

            JavaScriptSerializer serializer = new JavaScriptSerializer();
            context.Response.Write(serializer.Serialize(Groups));
        }