コード例 #1
0
ファイル: MyViewModel.cs プロジェクト: jigjosh/xaml-sdk
        public MyViewModel()
        {
            var date = DateTime.Now;
            var ganttAPI = new GanttTask(date, date.AddDays(2), "Design public API") { Description = "Description: Design public API" };

            var ganttRendering = new GanttTask(date.AddDays(2).AddHours(8), date.AddDays(4), "Gantt Rendering") { Description = "Description: Gantt Rendering" };

            var ganttDemos = new GanttTask(date.AddDays(4.5), date.AddDays(7), "Gantt Demos") { Description = "Description: Gantt Demos" };

            var milestone = new GanttTask(date.AddDays(7), date.AddDays(7).AddHours(1), "Review") { Description = "Review", IsMilestone = true };

            ganttRendering.Dependencies.Add(new Dependency { FromTask = ganttAPI });
            ganttDemos.Dependencies.Add(new Dependency { FromTask = ganttRendering });

            var iterationTask = new GanttTask(date, date.AddDays(7), "Iteration 1")
            {
                Children = { ganttAPI, ganttRendering, ganttDemos, milestone }
            };

            this.tasks = new ObservableCollection<GanttTask>() { iterationTask };
            this.visibleTime = new DateRange(date.AddDays(-1), date.AddDays(9));
            this.timeLineDeadlineBehavior = new TimeLineDeadlineBehavior();

            this.ProjectDeadline = date.AddDays(8);
        }
コード例 #2
0
 public JsonResult actualizaFechas(GanttTask ganttTask)
 {
     try
     {
         SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString);
         SqlCommand    cmd = new SqlCommand("UPDATE_CAPPERDRAG", con);
         cmd.CommandType = CommandType.StoredProcedure;
         cmd.Parameters.Add("INTID", SqlDbType.Int);
         cmd.Parameters.Add("STRFECHAINI", SqlDbType.DateTime);
         cmd.Parameters.Add("STRFECHAFIN", SqlDbType.DateTime);
         cmd.Parameters.Add("STRFECHA", SqlDbType.DateTime);
         cmd.Parameters.Add("INTREALIZO", SqlDbType.Int);
         cmd.Parameters["INTID"].Value       = ganttTask.id;
         cmd.Parameters["STRFECHAINI"].Value = DateTime.Parse(ganttTask.start_date).ToShortDateString();
         cmd.Parameters["STRFECHAFIN"].Value = DateTime.Parse(ganttTask.end_date).ToShortDateString();
         cmd.Parameters["STRFECHA"].Value    = DateTime.Now.ToString();
         cmd.Parameters["INTREALIZO"].Value  = Session["intID"].ToString();
         con.Open();
         cmd.ExecuteNonQuery();
         con.Close();
         return(Json(new { success = true }));
     }
     catch (Exception X)
     {
         return(Json(new { success = false, mensaje = X.Message }));
     }
 }
コード例 #3
0
        public override object ConvertTo(object data, string format)
        {
            if (format == typeof(IDateRange).FullName)
            {
                var draggedProjectItem = (DataObjectHelper.GetData(data, typeof(Project), true) as List <object>).First() as Project;
                var task = new GanttTask {
                    Title = draggedProjectItem.Name, Start = draggedProjectItem.Start, End = draggedProjectItem.End
                };

                return(task);
            }
            else if (DataObjectHelper.GetDataPresent(data, typeof(ScheduleViewDragDropPayload), false))
            {
                ScheduleViewDragDropPayload payload = (ScheduleViewDragDropPayload)DataObjectHelper.GetData(data, typeof(ScheduleViewDragDropPayload), false);
                if (payload != null)
                {
                    return(payload.DraggedAppointments);
                }
            }
            else if (format == typeof(ScheduleViewDragDropPayload).FullName)
            {
                var customers = DataObjectHelper.GetData(data, typeof(Project), true) as IEnumerable;
                if (customers != null)
                {
                    return(customers.OfType <Project>().Select(c => new Appointment {
                        Subject = c.Name
                    }).ToList());
                }
            }

            return(null);
        }
コード例 #4
0
        public override ITask InsertTask(ITask task)
        {
            using (var db = new GanttResourcesEntities())
            {
                int?pId = null;
                int id  = string.IsNullOrEmpty(task.ID.ToString()) ? 0 : int.Parse(task.ID.ToString());
                task.ID = null;

                if (task.ParentID != null)
                {
                    pId = int.Parse(task.ParentID.ToString());
                }

                GanttTask result = new GanttTask
                {
                    ID              = id,
                    ParentID        = pId,
                    OrderID         = int.Parse(task.OrderID.ToString()),
                    Start           = task.Start,
                    End             = task.End,
                    PercentComplete = task.PercentComplete,
                    Summary         = task.Summary,
                    Title           = task.Title,
                    Expanded        = task.Expanded
                };
                db.GanttTasks.Add(result);
                db.SaveChanges();
                task.ID       = result.ID;
                task.ParentID = result.ParentID;
                task.OrderID  = result.OrderID;
            }

            return(task);
        }
コード例 #5
0
        private void SetUpGanttData()
        {
            this.VisibleRange = new DateRange(DateTime.Today, DateTime.Today.AddDays(15));
            this.Tasks = new ObservableCollection<IGanttTask>();

            var start = DateTime.Today;
            var end = start.AddDays(3);

            var testingTaskChild1 = new GanttTask(start, end, "Unit test planning");
            var testingTaskChild2 = new GanttTask(start.AddDays(1), end.AddDays(2), "Integration test planning");

            start = start.AddDays(3);
            end = start.AddDays(4);
            var testingTaskChild3 = new GanttTask(start, end, "Unit testing");

            start = end.Date.AddHours(1);
            end = start.AddDays(2);
            var testingTaskChild4 = new GanttTask(start, end, "Integration Testing");

            testingTaskChild2.Dependencies.Add(new Dependency { FromTask = testingTaskChild1 });
            testingTaskChild3.Dependencies.Add(new Dependency { FromTask = testingTaskChild2 });
            testingTaskChild4.Dependencies.Add(new Dependency { FromTask = testingTaskChild3 });

            start = DateTime.Today;
            end = start.AddDays(4);

            var testingTask = new GanttTask(start, end, "Testing")
            {
                Children = { testingTaskChild1, testingTaskChild2, testingTaskChild3, testingTaskChild4 }
            };

            this.Tasks.Add(testingTask);
        }
コード例 #6
0
 private static void GenerateAllGanttTasks(IEnumerable <XElement> tasks, XNamespace xnamespace)
 {
     foreach (var t in tasks)
     {
         var ganttTask = new GanttTask();
         if (t.Element(xnamespace + "Name") != null)
         {
             ganttTask.Title = t.Element(xnamespace + "Name").Value;
         }
         ganttTask.UniqueId    = t.Element(xnamespace + "UID").Value;
         ganttTask.Start       = DateTime.Parse(t.Element(xnamespace + "Start").Value, CultureInfo.InvariantCulture);
         ganttTask.End         = DateTime.Parse(t.Element(xnamespace + "Finish").Value, CultureInfo.InvariantCulture);
         ganttTask.IsMilestone = t.Element(xnamespace + "Milestone").Value == "1";
         ganttTask.Progress    = Double.Parse(t.Element(xnamespace + "PercentComplete").Value, CultureInfo.InvariantCulture);
         string outlineNumber = null;
         if (t.Element(xnamespace + "OutlineNumber") != null)
         {
             outlineNumber = t.Element(xnamespace + "OutlineNumber").Value;
         }
         var            relations      = t.Elements(xnamespace + "PredecessorLink");
         IList <string> relatonTaskIDs = new List <string>();
         foreach (var relation in relations)
         {
             var relationTask = relation.Element(xnamespace + "PredecessorUID").Value;
             relatonTaskIDs.Add(relationTask);
         }
         if (outlineNumber != null)
         {
             SetAllChildren(outlineNumber, ganttTask.UniqueId);
         }
         taskIdToGanttTask[ganttTask.UniqueId] = new Tuple <GanttTask, string>(ganttTask, outlineNumber);
     }
 }
コード例 #7
0
 public void AddGanttTask(GanttRow row, GanttTask task)
 {
     if (task.Start < ganttChartData.MaxDate && task.End > ganttChartData.MinDate)
     {
         row.Tasks.Add(task);
     }
 }
コード例 #8
0
        public override object ConvertTo(object data, string format)
        {
            if (format == typeof(IDateRange).FullName)
            {
                var draggedProjectItem = (DataObjectHelper.GetData(data, typeof(Project), true) as List<object>).First() as Project;
                var task = new GanttTask { Title = draggedProjectItem.Name, Start = draggedProjectItem.Start, End = draggedProjectItem.End };

                return task;
            }
            else if (DataObjectHelper.GetDataPresent(data, typeof(ScheduleViewDragDropPayload), false))
            {
                ScheduleViewDragDropPayload payload = (ScheduleViewDragDropPayload)DataObjectHelper.GetData(data, typeof(ScheduleViewDragDropPayload), false);
                if (payload != null)
                {
                    return payload.DraggedAppointments;
                }
            }
            else if (format == typeof(ScheduleViewDragDropPayload).FullName)
            {
                var customers = DataObjectHelper.GetData(data, typeof(Project), true) as IEnumerable;
                if (customers != null)
                {
                    return customers.OfType<Project>().Select(c => new Appointment { Subject = c.Name }).ToList();
                }
            }

            return null;
        }
コード例 #9
0
 private static void GenerateAllGanttTasks(IEnumerable<XElement> tasks, XNamespace xnamespace)
 {
     foreach (var t in tasks)
     {
         var ganttTask = new GanttTask();
         if (t.Element(xnamespace + "Name") != null)
         {
             ganttTask.Title = t.Element(xnamespace + "Name").Value;
         }
         ganttTask.UniqueId = t.Element(xnamespace + "UID").Value;
         ganttTask.Start = DateTime.Parse(t.Element(xnamespace + "Start").Value);
         ganttTask.End = DateTime.Parse(t.Element(xnamespace + "Finish").Value);
         ganttTask.IsMilestone = t.Element(xnamespace + "Milestone").Value == "1";
         ganttTask.Progress = Double.Parse(t.Element(xnamespace + "PercentComplete").Value);
         string outlineNumber = null;
         if (t.Element(xnamespace + "OutlineNumber") != null)
         {
             outlineNumber = t.Element(xnamespace + "OutlineNumber").Value;
         }
         var relations = t.Elements(xnamespace + "PredecessorLink");
         IList<string> relatonTaskIDs = new List<string>();
         foreach (var relation in relations)
         {
             var relationTask = relation.Element(xnamespace + "PredecessorUID").Value;
             relatonTaskIDs.Add(relationTask);
         }
         if (outlineNumber != null)
         {
             SetAllChildren(outlineNumber, ganttTask.UniqueId);
         }
         taskIdToGanttTask[ganttTask.UniqueId] = new Tuple<GanttTask, string>(ganttTask, outlineNumber);
     }
 }
		private static void SetUpRelationsToGanttTask(string uniqueID, Tuple<GanttTask, string> t, GanttTask gtask)
		{
			foreach (var rel in taskToRelation[uniqueID].ToList())
			{
				var relationTask = taskIdToGanttTask[rel].Item1;
				gtask.Dependencies.Add(new Dependency { FromTask = relationTask });
			}
		}
コード例 #11
0
        public MyViewModel()
        {
            var date     = DateTime.Now;
            var ganttAPI = new GanttTask()
            {
                Start       = date,
                End         = date.AddDays(2),
                Title       = "Design public API",
                Description = "Description: Design public API"
            };

            var ganttRendering = new GanttTask()
            {
                Start       = date.AddDays(2).AddHours(8),
                End         = date.AddDays(4),
                Title       = "Gantt Rendering",
                Description = "Description: Gantt Rendering"
            };

            var ganttDemos = new GanttTask()
            {
                Start       = date.AddDays(4.5),
                End         = date.AddDays(7),
                Title       = "Gantt Demos",
                Description = "Description: Gantt Demos"
            };

            var milestone = new GanttTask()
            {
                Start       = date.AddDays(7),
                End         = date.AddDays(7).AddHours(1),
                Title       = "Review",
                Description = "Review",
                IsMilestone = true
            };


            ganttRendering.Dependencies.Add(new Dependency {
                FromTask = ganttAPI
            });
            ganttDemos.Dependencies.Add(new Dependency {
                FromTask = ganttRendering
            });

            var iterationTask = new GanttTask()
            {
                Start    = date,
                End      = date.AddDays(7),
                Title    = "Iteration 1",
                Children = { ganttAPI, ganttRendering, ganttDemos, milestone }
            };

            this.tasks = new ObservableCollection <GanttTask>()
            {
                iterationTask
            };
            this.visibleTime = new DateRange(date.AddDays(-1), date.AddDays(9));
        }
コード例 #12
0
        /// <summary>
        /// Get All Relevant Production Work Schedules an dpass them for each Order To
        /// </summary>
        private async Task GetSchedulesForOrderListAsync(IEnumerable <int> ordersParts)
        {
            foreach (var orderPart in ordersParts)
            {
                //var pows = await _context.GetProductionOrderBomRecursive(_context.ProductionOrders.FirstOrDefault(x => x.ArticleId == 1), 1);
                // get the corresponding Order Parts to Order
                var demands = _context.Demands.OfType <DemandOrderPart>()
                              .Include(x => x.OrderPart)
                              .Include(x => x.DemandProvider)
                              .Where(o => o.OrderPart.OrderId == orderPart)
                              .ToList();

                var pows = new List <ProductionOrderWorkSchedule>();
                foreach (var demand in demands)
                {
                    var data = _context.GetWorkSchedulesFromDemand(demand, ref pows);
                }


                foreach (var pow in pows)
                {
                    // check if head element is Created,
                    GanttTask timeline = GetOrCreateTimeline(pow, orderPart);
                    long      start = 0, end = 0;
                    DefineStartEnd(ref start, ref end, pow);
                    // Add Item To Timeline
                    _ganttContext.Tasks.Add(
                        CreateGanttTask(
                            pow,
                            start,
                            end,
                            timeline.color,
                            timeline.id
                            )
                        );
                    var c = await _context.GetFollowerProductionOrderWorkSchedules(pow);

                    if (!c.Any())
                    {
                        continue;
                    }
                    // create Links for this pow
                    foreach (var link in c)
                    {
                        _ganttContext.Links.Add(
                            new GanttLink
                        {
                            id     = Guid.NewGuid().ToString(),
                            type   = LinkType.finish_to_start,
                            source = pow.Id.ToString(),
                            target = link.Id.ToString()
                        }
                            );
                    } // end foreach link
                }     // emd pows
            }         // end foreach Order
        }
コード例 #13
0
        public override object ConvertTo(object data)
        {
            var draggedProjectItem = (DataObjectHelper.GetData(data, typeof(Project), true) as List <object>).First() as Project;
            var task = new GanttTask {
                Title = draggedProjectItem.Name, Start = draggedProjectItem.Start, End = draggedProjectItem.End
            };

            return(task);
        }
コード例 #14
0
        internal async Task <int> CreateNewProject(CreateUserProjectViewModel viewModel)
        {
            using (ApplicationDbContext db = new ApplicationDbContext())
            {
                // creat new UserProject record
                UserProject userProject = new UserProject();
                userProject.InjectFrom(viewModel);
                userProject.CreatedAt  = DateTime.Now;
                userProject.ModifiedAt = DateTime.Now;
                db.UserProjects.Add(userProject);
                await db.SaveChangesAsync();

                // initialize blank ProjectScheduleVersion
                ProjectScheduleVersion schedule = new ProjectScheduleVersion();
                schedule.ProjectID  = userProject.ID;
                schedule.VersionNum = 1;
                schedule.CreatedAt  = userProject.CreatedAt;
                schedule.SavedAt    = userProject.CreatedAt;
                schedule.Comments   = "[initialize project schedule]";
                db.ProjectScheduleVersions.Add(schedule);
                await db.SaveChangesAsync();

                // initialize 'project' GanttTask based on user-specified ProjectStartDate
                GanttTask initProject = new GanttTask()
                {
                    ProjectID = userProject.ID,
                    ProjectScheduleVersionID = schedule.ID,
                    Text      = viewModel.Name,
                    StartDate = viewModel.ProjectStartDate,
                    Duration  = 1,
                    Progress  = 0m,
                    SortOrder = 0,
                    Type      = "project",
                    Open      = true
                };
                db.GanttTasks.Add(initProject);
                await db.SaveChangesAsync();

                // initialize 'task' GanttTask for proper rendering of start/end dates in grid
                GanttTask initTask = new GanttTask()
                {
                    ProjectID = userProject.ID,
                    ProjectScheduleVersionID = schedule.ID,
                    Text      = "New Task",
                    StartDate = viewModel.ProjectStartDate,
                    Duration  = 1,
                    Progress  = 0m,
                    SortOrder = 1,
                    Type      = "task",
                    ParentId  = initProject.GanttTaskId
                };
                db.GanttTasks.Add(initTask);
                await db.SaveChangesAsync();

                return(userProject.ID);
            }
        }
コード例 #15
0
ファイル: ViewModel.cs プロジェクト: JoelWeber/xaml-sdk
        public ViewModel()
        {
            var date = DateTime.Now;

            var ganttAPI = new GanttTask()
            {
                Start = date,
                End = date.AddDays(2),
                Title = "Design public API",
                Description = "Description: Design public API"
            };
            var ganttRendering = new GanttTask()
            {
                Start = date.AddDays(2).AddHours(8),
                End = date.AddDays(4),
                Title = "Gantt Rendering",
                Description = "Description: Gantt Rendering"
            };
            var ganttDemosTest = new GanttTask()
            {
                Start = date.AddDays(4.5),
                End = date.AddDays(7),
                Title = "Gantt Demos Test",
                Description = "Description: Gantt Demos Test"
            };
            var ganttDemos = new GanttTask()
            {
                Start = date.AddDays(4.5),
                End = date.AddDays(7),
                Title = "Gantt Demos",
                Description = "Description: Gantt Demos",
                Children = { ganttDemosTest }
            };
            var milestone = new GanttTask()
            {
                Start = date.AddDays(7),
                End = date.AddDays(7).AddHours(1),
                Title = "Review",
                Description = "Description: Review",
                IsMilestone = true
            };

            ganttRendering.Dependencies.Add(new Dependency() { FromTask = ganttAPI });
            ganttDemos.Dependencies.Add(new Dependency() { FromTask = ganttRendering });

            var iterationTask = new GanttTask()
            {
                Start = date,
                End = date.AddDays(7),
                Title = "Iteration 1",
                Children = { ganttAPI, ganttRendering, ganttDemos, milestone }
            };

            this.tasks = new ObservableCollection<GanttTask>() { iterationTask };
            this.visibleTime = new DateRange(date.AddDays(-1), date.AddDays(8));
        }
コード例 #16
0
        private ObservableCollection <GanttTask> GetTasks(DateTime date)
        {
            var ganttAPI = new GanttTask()
            {
                Start       = date,
                End         = date.AddDays(2),
                Title       = "Design public API",
                Description = "Description: Design public API",
            };
            var ganttRendering = new GanttTask()
            {
                Start       = date.AddDays(2).AddHours(8),
                End         = date.AddDays(4),
                Title       = "Gantt Rendering",
                Description = "Description: Gantt Rendering",
            };
            var ganttDemos = new GanttTask()
            {
                Start       = date.AddDays(4.5),
                End         = date.AddDays(7),
                Title       = "Gantt Demos",
                Description = "Description: Gantt Demos",
            };
            var milestone = new GanttTask()
            {
                Start       = date.AddDays(7),
                End         = date.AddDays(7).AddHours(1),
                Title       = "Review",
                Description = "Description: Review",
                IsMilestone = true,
            };

            ganttRendering.Dependencies.Add(new Dependency()
            {
                FromTask = ganttAPI
            });
            ganttDemos.Dependencies.Add(new Dependency()
            {
                FromTask = ganttRendering
            });

            var iterationTask = new GanttTask()
            {
                Start    = date,
                End      = date.AddDays(7),
                Title    = "Iteration 1",
                Children = { ganttAPI, ganttRendering, ganttDemos, milestone },
            };

            ObservableCollection <GanttTask> tasks = new ObservableCollection <GanttTask>()
            {
                iterationTask
            };

            return(tasks);
        }
コード例 #17
0
        private void Delete(GanttTask task)
        {
            var childTasks = db.GanttTasks.Where(t => t.ParentID == task.ID);

            foreach (var childTask in childTasks)
            {
                Delete(childTask);
                db.GanttTasks.Remove(childTask);
            }
        }
		private static void SetUpChildrenToGanttTask(Tuple<GanttTask, string> t, GanttTask gtask)
		{
			var oNumber = t.Item2;
			var childCollection = taskToChildren[oNumber];
			foreach (var child in childCollection.ToList())
			{
				var childrenTask = taskIdToGanttTask[child].Item1;
				gtask.Children.Add(childrenTask);
			};
		}
コード例 #19
0
        public async Task <IActionResult> AddTask(GanttTask task)
        {
            if (ModelState.IsValid)
            {
                task.UserId = requestUser.GetUserId();
                tasksRepository.Add(task);
                await tasksRepository.SaveChanges();

                return(RedirectToAction("Index"));
            }
            return(View(task));
        }
コード例 #20
0
 private void ExpandTask(GanttTask task)
 {
     this.GanttView.ExpandCollapseService.ExpandItem(task);
     var childTasks = task.Children;
     if (childTasks != null)
     {
         foreach (GanttTask childTask in childTasks)
         {
             this.ExpandTask(childTask);
         }
     }
 }
コード例 #21
0
        private static void SetUpChildrenToGanttTask(Tuple <GanttTask, string> t, GanttTask gtask)
        {
            var oNumber         = t.Item2;
            var childCollection = taskToChildren[oNumber];

            foreach (var child in childCollection.ToList())
            {
                var childrenTask = taskIdToGanttTask[child].Item1;
                gtask.Children.Add(childrenTask);
            }
            ;
        }
        private async Task GetSchedulesForTimeSlotListAsync(int pageStart, int pageEnd, bool folowLinks)
        {
            var pows = _resultContext.SimulationOperations.Where(predicate: x => x.Start >= pageStart && x.End <= pageEnd &&
                                                                 x.SimulationType == _simulationType &&
                                                                 x.SimulationNumber == _simulationNumber &&
                                                                 x.SimulationConfigurationId == _simulationConfigurationId);

            _maxPage = (int)Math.Ceiling(a: (double)_resultContext.SimulationOperations.Where(predicate: x => x.SimulationType == _simulationType &&
                                                                                              x.SimulationNumber == _simulationNumber &&
                                                                                              x.SimulationConfigurationId ==
                                                                                              _simulationConfigurationId).Max(selector: m => m.End) / _timeSpan);

            foreach (var pow in pows)
            {
                // check if head element is Created,
                GanttTask timeline = GetOrCreateTimeline(pow: pow);
                long      start = 0, end = 0;
                DefineStartEnd(start: ref start, end: ref end, item: pow);
                // Add Item To Timeline
                _ganttContext.Tasks.Add(
                    item: CreateGanttTask(
                        item: pow,
                        start: start,
                        end: end,
                        gc: timeline.color,
                        parent: timeline.id
                        )
                    );

                if (folowLinks)
                {
                    var c = await _context.GetFollowerProductionOrderWorkSchedules(simulationWorkSchedule : pow, type : _simulationType, relevantItems : pows.ToList());

                    if (!c.Any())
                    {
                        continue;
                    }
                    // create Links for this pow
                    foreach (var link in c)
                    {
                        _ganttContext.Links.Add(
                            item: new GanttLink
                        {
                            id     = Guid.NewGuid().ToString(),
                            type   = LinkType.finish_to_start,
                            source = pow.Id.ToString(),
                            target = link.Id.ToString()
                        }
                            );
                    } // end foreach link
                }
            }         // emd pows
        }
コード例 #23
0
        private void DeleteEntityChildren(GanttTask task)
        {
            using (var db = GetContext())
            {
                var childTasks = db.GanttTasks.Where(t => t.ParentID == task.ID);

                foreach (var childTask in childTasks)
                {
                    DeleteEntityChildren(childTask);
                    db.GanttTasks.Remove(childTask);
                }
            }
        }
コード例 #24
0
        private void ExpandTask(GanttTask task)
        {
            this.GanttView.ExpandCollapseService.ExpandItem(task);
            var childTasks = task.Children;

            if (childTasks != null)
            {
                foreach (GanttTask childTask in childTasks)
                {
                    this.ExpandTask(childTask);
                }
            }
        }
コード例 #25
0
		private void ExpandItem(GanttTask task)
		{
			this.ganttView.ExpandCollapseService.ExpandItem(task);

			foreach (GanttTask childItem in task.Children)
			{
				this.ganttView.ExpandCollapseService.ExpandItem(childItem);

				if (childItem.Children.Any())
				{
					this.ExpandItem(childItem);
				}
			}
		}
        /// <summary>
        /// Get All Relevant Production Work Schedules an dpass them for each Order To
        /// </summary>
        private async Task GetSchedulesForOrderListAsync(IEnumerable <int> ordersParts)
        {
            foreach (var ordersPart in ordersParts)
            {
                var pows = _resultContext.SimulationOperations.Where(predicate: x => x.OrderId == "[" + ordersPart.ToString() + "]" &&
                                                                     x.SimulationType == _simulationType &&
                                                                     x.SimulationNumber == _simulationNumber &&
                                                                     x.SimulationConfigurationId == _simulationConfigurationId)
                           .OrderBy(keySelector: x => x.Machine).ThenBy(keySelector: x => x.ProductionOrderId).ThenBy(keySelector: x => x.Start);


                foreach (var pow in pows)
                {
                    // check if head element is Created,
                    GanttTask timeline = GetOrCreateTimeline(pow: pow, orderId: ordersPart);
                    long      start = 0, end = 0;
                    DefineStartEnd(start: ref start, end: ref end, item: pow);
                    // Add Item To Timeline
                    _ganttContext.Tasks.Add(
                        item: CreateGanttTask(
                            item: pow,
                            start: start,
                            end: end,
                            gc: timeline.color,
                            parent: timeline.id
                            )
                        );
                    var c = await _context.GetFollowerProductionOrderWorkSchedules(simulationWorkSchedule : pow, type : _simulationType, relevantItems : pows.ToList());

                    if (!c.Any())
                    {
                        continue;
                    }
                    // create Links for this pow
                    foreach (var link in c)
                    {
                        _ganttContext.Links.Add(
                            item: new GanttLink
                        {
                            id     = Guid.NewGuid().ToString(),
                            type   = LinkType.finish_to_start,
                            source = pow.Id.ToString(),
                            target = link.Id.ToString()
                        }
                            );
                    } // end foreach link
                }     // emd pows
            }
        }
コード例 #27
0
        public void AddGanttTask(GanttRow row, GanttTask task)
        {
            if (row is null)
            {
                throw new ArgumentNullException(nameof(row));
            }
            if (task is null)
            {
                throw new ArgumentNullException(nameof(task));
            }

            if (task.Start < ganttChartData.MaxDate && task.End > ganttChartData.MinDate)
            {
                row.Tasks.Add(task);
            }
        }
コード例 #28
0
ファイル: ViewModel.cs プロジェクト: JoelWeber/xaml-sdk
        private ObservableCollection<GanttTask> GetTasks(DateTime date)
        {
            var ganttAPI = new GanttTask()
            {
                Start = date,
                End = date.AddDays(2),
                Title = "Design public API",
                Description = "Description: Design public API",
            };
            var ganttRendering = new GanttTask()
            {
                Start = date.AddDays(2).AddHours(8),
                End = date.AddDays(4),
                Title = "Gantt Rendering",
                Description = "Description: Gantt Rendering",
            };
            var ganttDemos = new GanttTask()
            {
                Start = date.AddDays(4.5),
                End = date.AddDays(7),
                Title = "Gantt Demos",
                Description = "Description: Gantt Demos",
            };
            var milestone = new GanttTask()
            {
                Start = date.AddDays(7),
                End = date.AddDays(7).AddHours(1),
                Title = "Review",
                Description = "Description: Review",
                IsMilestone = true,
            };

            ganttRendering.Dependencies.Add(new Dependency() { FromTask = ganttAPI });
            ganttDemos.Dependencies.Add(new Dependency() { FromTask = ganttRendering });

            var iterationTask = new GanttTask()
            {
                Start = date,
                End = date.AddDays(7),
                Title = "Iteration 1",
                Children = { ganttAPI, ganttRendering, ganttDemos, milestone },
            };

            ObservableCollection<GanttTask> tasks = new ObservableCollection<GanttTask>() { iterationTask };

            return tasks;
        }
コード例 #29
0
        public async Task UpdateTest_ReturnsUpdatePartialView_WhenModelStateIsInvalid()
        {
            // Arrange
            var task = new GanttTask {
                Title = "Test 1"
            };

            controller.ModelState.AddModelError("Duration", "Please fill in this field.");

            // Act
            var result = await controller.Update(task);

            // Assert
            var partialViewResult = Assert.IsType <PartialViewResult>(result);

            Assert.Equal(task, partialViewResult.ViewData.Model);
        }
コード例 #30
0
        public async Task UpdateTest_SetsUserId_BeforeUpdatingTask()
        {
            // Arrange
            var task = new GanttTask {
                Title = "Test 1"
            };
            var userId = "40e11bef-633c-44ff-aab1-af6c1bea6bf5";

            tasksRepository.Setup(t => t.Find(userId)).Returns(Task.FromResult(task));
            requestUser.Setup(m => m.GetUserId()).Returns(userId);

            // Act
            var result = await controller.Update(task);

            // Assert
            tasksRepository.Verify(t => t.Update(It.Is <GanttTask>(m => m == task && m.UserId == userId)));
        }
コード例 #31
0
        public MyViewModel()
        {
            var date     = DateTime.Now;
            var ganttAPI = new GanttTask(date, date.AddDays(2), "Design public API")
            {
                Description = "Description: Design public API"
            };

            var ganttRendering = new GanttTask(date.AddDays(2).AddHours(8), date.AddDays(4), "Gantt Rendering")
            {
                Description = "Description: Gantt Rendering"
            };

            var ganttDemos = new GanttTask(date.AddDays(4.5), date.AddDays(7), "Gantt Demos")
            {
                Description = "Description: Gantt Demos"
            };

            var milestone = new GanttTask(date.AddDays(7), date.AddDays(7).AddHours(1), "Review")
            {
                Description = "Review", IsMilestone = true
            };


            ganttRendering.Dependencies.Add(new Dependency {
                FromTask = ganttAPI
            });
            ganttDemos.Dependencies.Add(new Dependency {
                FromTask = ganttRendering
            });

            var iterationTask = new GanttTask(date, date.AddDays(7), "Iteration 1")
            {
                Children = { ganttAPI, ganttRendering, ganttDemos, milestone }
            };

            this.tasks = new ObservableCollection <GanttTask>()
            {
                iterationTask
            };
            this.visibleTime = new DateRange(date.AddDays(-1), date.AddDays(9));
            this.timeLineDeadlineBehavior = new TimeLineDeadlineBehavior();

            this.ProjectDeadline = date.AddDays(8);
        }
コード例 #32
0
        public async Task DeleteTest_ReturnsRedirectsToIndex_WhenTaskIsDeletedFromRepository()
        {
            // Arrange
            var Id   = "25e7ce17-1377-44f3-8261-e0b3242da89f";
            var task = new GanttTask {
                Title = "Test 1"
            };

            tasksRepository.Setup(t => t.Find(Id)).Returns(Task.FromResult(task));

            // Act
            var result = await controller.Delete(Id);

            // Assert
            var redirect = Assert.IsType <RedirectToActionResult>(result);

            Assert.Equal("Index", redirect.ActionName);
        }
コード例 #33
0
        /// <summary>
        /// Creates new TimelineItem with a label depending on the schedulingState
        /// </summary>
        public GanttTask CreateGanttTask(ProductionOrderWorkSchedule item, long start, long end, GanttColors gc, string parent)
        {
            var gantTask = new GanttTask()
            {
                id         = item.Id.ToString(),
                type       = GanttType.task,
                desc       = item.Name,
                text       = _schedulingState == 4 ? item.MachineGroup.Name : "P.O.: " + item.ProductionOrderId,
                start_date = start.GetDateFromMilliseconds().ToString("dd-MM-yyyy HH:mm"),
                end_date   = end.GetDateFromMilliseconds().ToString("dd-MM-yyyy HH:mm"),
                IntFrom    = start,
                IntTo      = end,
                parent     = parent,
                color      = gc,
            };

            return(gantTask);
        }
コード例 #34
0
        public async Task UpdateTest_ReturnsRedirectsToIndex_WhenTaskIsUpdated()
        {
            // Arrange
            var task = new GanttTask {
                Title = "Test 1"
            };

            tasksRepository.Setup(t => t.SaveChanges()).Returns(Task.CompletedTask);

            // Act
            var result = await controller.Update(task);

            // Assert
            tasksRepository.Verify(t => t.Update(task));
            var redirect = Assert.IsType <RedirectToActionResult>(result);

            Assert.Equal("Index", redirect.ActionName);
        }
コード例 #35
0
        public async Task DetailsTest_ReturnsPartialViewContainingTaskModel_WhenTaskExists()
        {
            // Arrange
            var Id   = "25e7ce17-1377-44f3-8261-e0b3242da89f";
            var task = new GanttTask {
                Title = "Test 1"
            };

            tasksRepository.Setup(t => t.Find(Id)).Returns(Task.FromResult(task));

            // Act
            var result = await controller.Details(Id);

            // Assert
            var partialViewResult = Assert.IsType <PartialViewResult>(result);

            Assert.Equal(task, partialViewResult.ViewData.Model);
        }
コード例 #36
0
        private ObservableCollection <GanttTask> GetTasks()
        {
            var collection    = new ObservableCollection <GanttTask>();
            var today         = DateTime.Today.AddHours(8);
            var interval      = new TimeSpan(8, 0, 0);
            var recurringTask = new CustomRecurrenceTask(today.AddHours(-5), today.AddHours(-1), "Task with 3 recurrences")
            {
                RecurrenceRule = new RecurrenceRule(today.AddHours(-5), interval, 3)
            };

            collection.Add(recurringTask);
            var normalTask = new GanttTask(today.AddHours(8), today.AddHours(13), "Task Without Recurrence");

            normalTask.Children.Add(new GanttTask(today.AddHours(9), today.AddHours(12), "Child Task"));
            collection.Add(normalTask);

            return(collection);
        }
コード例 #37
0
ファイル: ViewModel.cs プロジェクト: CJMarsland/xaml-sdk
        private ObservableCollection<IGanttTask> GetTasks()
		{
            var collection = new ObservableCollection<IGanttTask>();
            var today = DateTime.Today;

            var recurrenceTask1 = new GanttTask(today.AddHours(1), today.AddHours(4), "Reccurence 1");
            var recurrenceTask2 = new GanttTask(today.AddHours(8), today.AddHours(12), "Reccurence 2");
            var recurrenceTask3 = new GanttTask(today.AddHours(16), today.AddHours(20), "Reccurence 3");
            var recurrenceSeriesTask = new RecurrenceTask(today, today.AddHours(20), "Recurrence Series")
            {
                Recurrences = { recurrenceTask1, recurrenceTask2, recurrenceTask3 }
            };
            collection.Add(recurrenceSeriesTask);
            var taskWithoutRecurrence = new GanttTask(today.AddHours(8), today.AddHours(13), "Task Without Recurrence");
            taskWithoutRecurrence.Children.Add(new GanttTask(today.AddHours(9), today.AddHours(12), "Child Task"));
            collection.Add(taskWithoutRecurrence);

            return collection;
		}
コード例 #38
0
        private ObservableCollection <IGanttTask> GetTasks()
        {
            var collection = new ObservableCollection <IGanttTask>();
            var today      = DateTime.Today;

            var recurrenceTask1      = new GanttTask(today.AddHours(1), today.AddHours(4), "Reccurence 1");
            var recurrenceTask2      = new GanttTask(today.AddHours(8), today.AddHours(12), "Reccurence 2");
            var recurrenceTask3      = new GanttTask(today.AddHours(16), today.AddHours(20), "Reccurence 3");
            var recurrenceSeriesTask = new RecurrenceTask(today, today.AddHours(20), "Recurrence Series")
            {
                Recurrences = { recurrenceTask1, recurrenceTask2, recurrenceTask3 }
            };

            collection.Add(recurrenceSeriesTask);
            var taskWithoutRecurrence = new GanttTask(today.AddHours(8), today.AddHours(13), "Task Without Recurrence");

            taskWithoutRecurrence.Children.Add(new GanttTask(today.AddHours(9), today.AddHours(12), "Child Task"));
            collection.Add(taskWithoutRecurrence);

            return(collection);
        }
コード例 #39
0
        private void SetUpGanttData()
        {
            this.VisibleRange = new DateRange(DateTime.Today, DateTime.Today.AddDays(15));
            this.Tasks        = new ObservableCollection <IGanttTask>();

            var start = DateTime.Today;
            var end   = start.AddDays(3);

            var testingTaskChild1 = new GanttTask(start, end, "Unit test planning");
            var testingTaskChild2 = new GanttTask(start.AddDays(1), end.AddDays(2), "Integration test planning");

            start = start.AddDays(3);
            end   = start.AddDays(4);
            var testingTaskChild3 = new GanttTask(start, end, "Unit testing");

            start = end.Date.AddHours(1);
            end   = start.AddDays(2);
            var testingTaskChild4 = new GanttTask(start, end, "Integration Testing");

            testingTaskChild2.Dependencies.Add(new Dependency {
                FromTask = testingTaskChild1
            });
            testingTaskChild3.Dependencies.Add(new Dependency {
                FromTask = testingTaskChild2
            });
            testingTaskChild4.Dependencies.Add(new Dependency {
                FromTask = testingTaskChild3
            });

            start = DateTime.Today;
            end   = start.AddDays(4);

            var testingTask = new GanttTask(start, end, "Testing")
            {
                Children = { testingTaskChild1, testingTaskChild2, testingTaskChild3, testingTaskChild4 }
            };

            this.Tasks.Add(testingTask);
        }
コード例 #40
0
        private ObservableCollection <IGanttTask> GetTasks()
        {
            var collection = new ObservableCollection <IGanttTask>();
            var today      = DateTime.Today.AddHours(8);

            var child1 = new GanttTask(today, today.AddHours(4), "reccurence1");
            var child2 = new GanttTask(today.AddHours(8), today.AddHours(12), "reccurence2");
            var child3 = new GanttTask(today.AddHours(16), today.AddHours(20), "reccurence3");

            var task1 = new RecurrenceTask(today, today.AddHours(20), "recurrence")
            {
                Children = { child1, child2, child3 }
            };

            collection.Add(task1);

            var taskWithoutRecurrence = new GanttTask(today.AddHours(8), today.AddHours(13), "Task Without Recurrence");

            taskWithoutRecurrence.Children.Add(new GanttTask(today.AddHours(9), today.AddHours(12), "Child Task"));
            collection.Add(taskWithoutRecurrence);

            return(collection);
        }
コード例 #41
0
		private void AddMilestoneExecuted(object parameter)
		{
			if (this.SelectedItem == null)
			{
				RadWindow.Alert("Please, select a task first.");
			}
			else
			{
				var selectedItem = (GanttTask)this.SelectedItem;
				var ganttTask = new GanttTask(this.SelectedItem.End, this.SelectedItem.End, "<new milestone>")
				{
					IsMilestone = true
				};
				selectedItem.Children.Add(ganttTask);
				OnPropertyChanged(() => Tasks);
			}
		}
コード例 #42
0
        public override ITask InsertTask(ITask task)
        {
            using (var db = new GanttResourcesEntities())
            {
                int? pId = null;
                int id = string.IsNullOrEmpty(task.ID.ToString()) ? 0 : int.Parse(task.ID.ToString());
                task.ID = null;

                if (task.ParentID != null)
                {
                    pId = int.Parse(task.ParentID.ToString());
                }

                GanttTask result = new GanttTask
                {
                    ID = id,
                    ParentID = pId,
                    OrderID = int.Parse(task.OrderID.ToString()),
                    Start = task.Start,
                    End = task.End,
                    PercentComplete = task.PercentComplete,
                    Summary = task.Summary,
                    Title = task.Title,
                    Expanded = task.Expanded
                };
                db.GanttTasks.Add(result);
                db.SaveChanges();
                task.ID = result.ID;
                task.ParentID = result.ParentID;
                task.OrderID = result.OrderID;
            }

            return task;
        }
コード例 #43
0
ファイル: ViewModel.cs プロジェクト: JoelWeber/xaml-sdk
        public ViewModel()
        {
            var date = DateTime.Now;

            var ganttAPI = new GanttTask()
            {
                Start = date,
                End = date.AddDays(2),
                Title = "Design public API",
                Description = "Description: Design public API"
            };
            var ganttRendering = new GanttTask()
            {
                Start = date.AddDays(2).AddHours(8),
                End = date.AddDays(4),
                Title = "Gantt Rendering",
                Description = "Description: Gantt Rendering"
            };
            var ganttDemosTest = new GanttTask()
            {
                Start = date.AddDays(4.5),
                End = date.AddDays(7),
                Title = "Gantt Demos Test",
                Description = "Description: Gantt Demos Test"
            };
            var ganttDemos = new GanttTask()
            {
                Start = date.AddDays(4.5),
                End = date.AddDays(7),
                Title = "Gantt Demos",
                Description = "Description: Gantt Demos",
                Children = { ganttDemosTest }
            };
            var milestone = new GanttTask()
            {
                Start = date.AddDays(7),
                End = date.AddDays(7).AddHours(1),
                Title = "Review",
                Description = "Description: Review",
                IsMilestone = true
            };

            ganttRendering.Dependencies.Add(new Dependency() { FromTask = ganttAPI });
            ganttDemos.Dependencies.Add(new Dependency() { FromTask = ganttRendering });

            var iterationTask = new GanttTask()
            {
                Start = date,
                End = date.AddDays(7),
                Title = "Iteration 1",
                Children = { ganttAPI, ganttRendering, ganttDemos, milestone }
            };

            var webSiteLaunch = new GanttTask()
            {
                Start = date.AddDays(8),
                End = date.AddDays(10),
                Title = "Website Launch",
                Description = "Description: Website Launch",
            };

            var blogPostPublish = new GanttTask()
            {
                Start = date.AddDays(10),
                End = date.AddDays(10.3),
                Title = "Blog Post Publish",
                Description = "Description: Blog Post Publish",
            };

            var releaseParty = new GanttTask()
            {
                Start = date.AddDays(11),
                End = date.AddDays(13),
                Title = "Release Party",
                Description = "Description: Release Party",
            };

            blogPostPublish.Dependencies.Add(new Dependency() { FromTask = webSiteLaunch });
            releaseParty.Dependencies.Add(new Dependency() { FromTask = blogPostPublish });

            var postProduction = new GanttTask()
            {
                Start = date.AddDays(8),
                End = date.AddDays(13),
                Title = "Post Production",
                Description = "Description: Post Production",
                Children = { webSiteLaunch, blogPostPublish, releaseParty }
            };

            this.tasks = new ObservableCollection<GanttTask>() { iterationTask, postProduction };
            this.visibleRange = new DateRange(date.AddDays(-1), date.AddDays(14));
        }
コード例 #44
0
ファイル: ViewModel.cs プロジェクト: hiwasham/xaml-sdk
        private ObservableCollection<GanttTask> GetTasks()
        {
            var collection = new ObservableCollection<GanttTask>();
            var today = DateTime.Today.AddHours(8);
            var interval = new TimeSpan(8, 0, 0);
            var recurringTask = new CustomRecurrenceTask(today.AddHours(-5), today.AddHours(-1), "Task with 3 recurrences")
            {
                RecurrenceRule = new RecurrenceRule(today.AddHours(-5), interval, 3)
            };
            collection.Add(recurringTask);
            var normalTask = new GanttTask(today.AddHours(8), today.AddHours(13), "Task Without Recurrence");
            normalTask.Children.Add(new GanttTask(today.AddHours(9), today.AddHours(12), "Child Task"));
            collection.Add(normalTask);

            return collection;
        }
コード例 #45
0
		public static GanttTask LoadTaskByMovie(Movie movie)
		{
			var startDate = movie.StartFilmingDate;
			var endDate = movie.ReleaseDate;
			var restDurationInDays = movie.FilmingDuration.TotalDays - 50;

			var task0 = new GanttTask { Title = movie.Title, Start = startDate, End = endDate };

			var task1 = new GanttTask { Start = startDate, End = startDate.AddDays(3), Title = "Financing" };
			var task2 = new GanttTask { Start = startDate.AddDays(1).AddHours(8), End = startDate.AddDays(5), Title = "Screenplay" };
			var task3 = new GanttTask { Start = startDate.AddDays(3).AddHours(12), End = startDate.AddDays(7).AddHours(15), Title = "Casting / Roles" };
			var task4 = new GanttTask { Start = startDate.AddDays(7).AddHours(12), End = startDate.AddDays(12), Title = "Major staffing - preparing list" };
			var task5 = new GanttTask { Start = startDate.AddDays(9), End = startDate.AddDays(14).AddHours(16), Title = "Schedule" };
			var task6 = new GanttTask { Start = startDate.AddDays(13), End = startDate.AddDays(16).AddHours(16), Title = "Materials" };
			var task7 = new GanttTask { Start = startDate.AddDays(15), End = startDate.AddDays(20), Title = "Scenography" };
			var task8 = new GanttTask { Start = startDate.AddDays(16).AddHours(4), End = startDate.AddDays(20), Title = "Production meeting" };
			var task9 = new GanttTask { Start = startDate.AddDays(17).AddHours(4), End = startDate.AddDays(19), Title = "Concept Art" };
			var task10 = new GanttTask { Start = startDate.AddDays(17).AddHours(20), End = startDate.AddDays(20), Title = "Research" };
			var task11 = new GanttTask { Start = startDate.AddDays(18).AddHours(14), End = startDate.AddDays(18).AddHours(14), Title = "Planning Location", IsMilestone = true };
			var task12 = new GanttTask(startDate, startDate.AddDays(20), "Planning") { Children = { task1, task2, task3, task4, task5, task6, task7, task8, task9, task10, task11 } };

			task0.Children.Add(task12);

			var task13 = new GanttTask { Start = startDate.AddDays(20), End = startDate.AddDays(30).AddHours(22), Title = "Research" };
			var task14 = new GanttTask { Start = startDate.AddDays(21).AddHours(6), End = startDate.AddDays(28).AddHours(17), Title = "Planning" };
			var task15 = new GanttTask { Start = startDate.AddDays(26).AddHours(12), End = startDate.AddDays(29).AddHours(4), Title = "Prop and wardrobe identification  and preparation" };
			var task16 = new GanttTask { Start = startDate.AddDays(30).AddHours(2), End = startDate.AddDays(33), Title = "Special effects identification and preparation" };
			var task17 = new GanttTask { Start = startDate.AddDays(32).AddHours(12), End = startDate.AddDays(36).AddHours(8), Title = "Production schedule" };
			var task18 = new GanttTask { Start = startDate.AddDays(37).AddHours(2), End = startDate.AddDays(42).AddHours(21), Title = "Set construction" };
			var task19 = new GanttTask { Start = startDate.AddDays(40), End = startDate.AddDays(44).AddHours(2), Title = "Script-locking (semi-finalization of the script)" };
			var task20 = new GanttTask { Start = startDate.AddDays(47).AddHours(2), End = startDate.AddDays(50).AddHours(2), Title = "Script read-through with cast, director and other  interested parties" };
			var task21 = new GanttTask(startDate.AddDays(20), startDate.AddDays(50).AddHours(2), "Pre-Production") { Children = { task13, task14, task15, task16, task17, task18, task19, task20 } };

			task0.Children.Add(task21);
			var filmingStart = startDate.AddDays(50);
			var filmingEnd = startDate.AddDays(50).AddDays(restDurationInDays / 3);
			var filmingDuration = filmingEnd.Subtract(filmingStart).TotalDays;
			var task22 = new GanttTask { Start = filmingStart, End = filmingStart.AddDays(filmingDuration / 7), Title = "Storyboarding" };
			var task23 = new GanttTask { Start = filmingStart.AddDays(filmingDuration / 8), End = filmingStart.AddDays(filmingDuration / 6), Title = "Cast Rehearsal" };
			var task24 = new GanttTask { Start = filmingStart.AddDays(filmingDuration / 7), End = filmingStart.AddDays(filmingDuration / 4), Title = "Motion Capture rehearsal & record" };
			var task25 = new GanttTask { Start = filmingStart.AddDays(filmingDuration / 6), End = filmingStart.AddDays(filmingDuration / 4), Title = "Cast Recording" };
			var task26 = new GanttTask { Start = filmingStart.AddDays(filmingDuration / 4), End = filmingStart.AddDays(filmingDuration / 2), Title = "Audio recording" };
			var task27 = new GanttTask { Start = filmingStart.AddDays(4 * filmingDuration / 10), End = filmingStart.AddDays(7 * filmingDuration / 10), Title = "Music composition" };
			var task28 = new GanttTask { Start = filmingStart.AddDays(7 * filmingDuration / 10), End = filmingStart.AddDays(9 * filmingDuration / 10), Title = "Music recording" };
			var task29 = new GanttTask { Start = filmingStart.AddDays(8 * filmingDuration / 10), End = filmingStart.AddDays(9 * filmingDuration / 10), Title = "Track and Sound Effects" };
			var task30 = new GanttTask { Start = filmingStart.AddDays(9 * filmingDuration / 10), End = filmingEnd, Title = "Rendering" };
			var task31 = new GanttTask(filmingStart, filmingEnd, "Filming / Production or Principal Photography - The actual shooting/recording") { Children = { task22, task23, task24, task25, task26, task27, task28, task29, task30 } };

			task0.Children.Add(task31);

			var editingStart = startDate.AddDays(50).AddDays(restDurationInDays / 3);
			var editingEnd = startDate.AddDays(50).AddDays(restDurationInDays / 3).AddDays(restDurationInDays / 6);
			var editingDuration = editingEnd.Subtract(editingStart).TotalDays;

			var task32 = new GanttTask { Start = editingStart, End = editingStart.AddDays(editingDuration / 2), Title = "Script Editing / Continuity Editing" };
			var task33 = new GanttTask(editingStart.AddDays(2 * editingDuration / 5), editingEnd, "Visual");

			var task34 = new GanttTask(editingStart, editingEnd, "Editing") { Children = { task32, task33 } };

			task0.Children.Add(task34);

			var audioStart = startDate.AddDays(50).AddDays(restDurationInDays / 3).AddDays(restDurationInDays / 6);
			var audioEnd = startDate.AddDays(50).AddDays(2 * restDurationInDays / 3);
			var audioDuration = audioEnd.Subtract(audioStart).TotalDays;
			var task35 = new GanttTask { Start = audioStart, End = audioStart.AddDays(audioDuration / 2), Title = "Shaped audio edits" };
			var task36 = new GanttTask { Start = audioStart.AddDays(2 * audioDuration / 3), End = audioEnd, Title = "Sound design" };
			var task37 = new GanttTask(audioStart, audioEnd, "Audio") { Children = { task35, task36 } };

			task0.Children.Add(task37);

			var postProductionStart = startDate.AddDays(50).AddDays(2 * restDurationInDays / 3);
			var postProductionEnd = endDate;
			var productionDuration = postProductionEnd.Subtract(postProductionStart).TotalDays;

			var task38 = new GanttTask { Start = postProductionStart, End = postProductionStart.AddDays(productionDuration / 7), Title = "Editing video footage" };
			var task39 = new GanttTask { Start = postProductionStart.AddDays(productionDuration / 8), End = postProductionStart.AddDays(productionDuration / 6), Title = "Editing the soundtrack" };
			var task40 = new GanttTask { Start = postProductionStart.AddDays(productionDuration / 7), End = postProductionStart.AddDays(productionDuration / 4), Title = "Adding sound effects" };
			var task41 = new GanttTask { Start = postProductionStart.AddDays(productionDuration / 6), End = postProductionStart.AddDays(productionDuration / 4), Title = "Adding titles and graphics" };
			var task42 = new GanttTask { Start = postProductionStart.AddDays(productionDuration / 4), End = postProductionStart.AddDays(productionDuration / 2), Title = "Colour, exposure correction" };
			var task43 = new GanttTask { Start = postProductionStart.AddDays(4 * productionDuration / 10), End = postProductionStart.AddDays(7 * productionDuration / 10), Title = "Filters" };
			var task44 = new GanttTask { Start = postProductionStart.AddDays(6 * productionDuration / 10), End = postProductionStart.AddDays(7 * productionDuration / 9), Title = "Effects" };
			var task45 = new GanttTask { Start = postProductionStart.AddDays(7 * productionDuration / 10), End = postProductionStart.AddDays(7 * productionDuration / 9), Title = "Adding special effects" };
			var task46 = new GanttTask { Start = postProductionStart.AddDays(8 * productionDuration / 10), End = postProductionStart.AddDays(9 * productionDuration / 10), Title = "Re-shooting certain scenes if required (pick-up shots)" };
			var task47 = new GanttTask { Start = postProductionStart.AddDays(8 * productionDuration / 10), End = postProductionStart.AddDays(productionDuration), Title = "Wide screen" };
			var task48 = new GanttTask { Start = postProductionStart.AddDays(9 * productionDuration / 10), End = postProductionEnd, Title = "Black & White" };
			var task49 = new GanttTask(postProductionStart, postProductionEnd, "Post Production") { Children = { task38, task39, task40, task41, task42, task43, task44, task45, task46, task47, task48 } };

			task0.Children.Add(task49);

			var task50 = new GanttTask { Start = endDate, End = endDate, Title = "Release Date", IsMilestone = true };
			task0.Children.Add(task50);

			return task0;
		}
コード例 #46
0
ファイル: Form1.cs プロジェクト: marysi8a/nGantt-master
 private void DeleteClicked(GanttTask ganttTask)
 {
     MessageBox.Show("Delete clicked for task " + ganttTask.Name);
 }
コード例 #47
0
ファイル: ViewModel.cs プロジェクト: CJMarsland/xaml-sdk
        private ObservableCollection<GanttTask> GetTasks(DateTime date)
        {
            var ganttAPI = new GanttTask()
            {
                Start = date,
                End = date.AddDays(2),
                Title = "Design public API",
                Description = "Description: Design public API",
            };
            var ganttRendering = new GanttTask()
            {
                Start = date.AddDays(2).AddHours(8),
                End = date.AddDays(4),
                Title = "Gantt Rendering",
                Description = "Description: Gantt Rendering",
            };
            var ganttDemos = new GanttTask()
            {
                Start = date.AddDays(4.5),
                End = date.AddDays(7),
                Title = "Gantt Demos",
                Description = "Description: Gantt Demos",
            };
            var milestone = new GanttTask()
            {
                Start = date.AddDays(7),
                End = date.AddDays(7).AddHours(1),
                Title = "Review",
                Description = "Description: Review",
                IsMilestone = true,
            };

            var ganttAPI2 = new GanttTask()
            {
                Start = date,
                End = date.AddDays(2),
                Title = "Design public API 2",
                Description = "Description: Design public API 2",
            };
            var ganttRendering2 = new GanttTask()
            {
                Start = date.AddDays(2).AddHours(8),
                End = date.AddDays(4),
                Title = "Gantt Rendering 2",
                Description = "Description: Gantt Rendering 2",
            };
            var ganttDemos2 = new GanttTask()
            {
                Start = date.AddDays(4.5),
                End = date.AddDays(7),
                Title = "Gantt Demos 2",
                Description = "Description: Gantt Demos 2",
            };
            var milestone2 = new GanttTask()
            {
                Start = date.AddDays(7),
                End = date.AddDays(7).AddHours(1),
                Title = "Review 2",
                Description = "Description: Review 2",
                IsMilestone = true,
            };

            ganttRendering.Dependencies.Add(new Dependency() { FromTask = ganttAPI });
            ganttDemos.Dependencies.Add(new Dependency() { FromTask = ganttRendering });

            ganttRendering2.Dependencies.Add(new Dependency() { FromTask = ganttAPI2 });
            ganttDemos2.Dependencies.Add(new Dependency() { FromTask = ganttRendering2 });

            var iterationTask = new GanttTask()
            {
                Start = date,
                End = date.AddDays(7),
                Title = "Iteration 1",
                Children = { ganttAPI, ganttRendering, ganttDemos, milestone },
            };

            var iterationTask2 = new GanttTask()
            {
                Start = date,
                End = date.AddDays(7),
                Title = "Iteration 2",
                Children = { ganttAPI2, ganttRendering2, ganttDemos2, milestone2 },
            };

            var simpleTask = new GanttTask()
            {
                Start = date,
                End = date.AddDays(2),
                Title = "Simple Task",
                Description = "Simple Task",
            };

            var bigIterationTask = new GanttTask()
            {
                Start = date,
                End = date.AddDays(7),
                Title = "Big Iteration",
                Children = { iterationTask, simpleTask, iterationTask2 },
            };

            ObservableCollection<GanttTask> result = new ObservableCollection<GanttTask>() { bigIterationTask };

            return result;
        }
コード例 #48
0
ファイル: ViewModel.cs プロジェクト: JoelWeber/xaml-sdk
        private ObservableCollection<IGanttTask> GetTasks()
        {
            var collection = new ObservableCollection<IGanttTask>();
            var today = DateTime.Today.AddHours(8);

            var child1 = new GanttTask(today, today.AddHours(4), "reccurence1");
            var child2 = new GanttTask(today.AddHours(8), today.AddHours(12), "reccurence2");
            var child3 = new GanttTask(today.AddHours(16), today.AddHours(20), "reccurence3");

            var task1 = new RecurrenceTask(today, today.AddHours(20), "recurrence")
            {
                Children = { child1, child2, child3 }
            };

            collection.Add(task1);

            var taskWithoutRecurrence = new GanttTask(today.AddHours(8), today.AddHours(13), "Task Without Recurrence");
            taskWithoutRecurrence.Children.Add(new GanttTask(today.AddHours(9), today.AddHours(12), "Child Task"));
            collection.Add(taskWithoutRecurrence);

            return collection;
        }
コード例 #49
0
		private IEnumerable<GanttTask> GenerateTasks()
		{
			List<GanttTask> ganttTasks = new List<GanttTask>();

			int ganttTasksCount = 0;

			for (int index = 0; index < 3000; index++)
			{
				var start = DateTime.Today.AddDays(1);
				var end = start.AddDays(1);

				var ganttTask = new GanttTask { Title = string.Format("Task{0}", ganttTasksCount), Start = start.AddDays(-0.5), End = end.AddDays(6.5), UniqueId = index.ToString() };

				ganttTasks.Add(ganttTask);
				ganttTasksCount++;

				for (int children = 0; children < 16; children++)
				{
					double startAdd = children / 2 + (children % 2) * 0.5 -0.5;
					double endAdd = startAdd + 0.43;
					var child = new GanttTask { Title = string.Format("Task{0}", ganttTasksCount), Start = start.AddDays(startAdd), End = start.AddDays(endAdd) };
					if (children != 0)
					{
						child.Dependencies.Add(new Dependency {FromTask = ganttTask.Children[children - 1], Type = DependencyType.FinishStart });
					}
					ganttTask.Children.Add(child);
					ganttTasksCount++;
				}
			}

			return ganttTasks;
		}
コード例 #50
0
ファイル: ViewModel.cs プロジェクト: JoelWeber/xaml-sdk
        public ViewModel()
        {
            var date = DateTime.Now;
            var ganttAPI = new GanttTask()
            {
                Start = date,
                End = date.AddDays(2),
                Title = "Design public API",
                Deadline = date.AddDays(1)
            };

            var ganttRendering = new GanttTask()
            {
                Start = date.AddDays(2).AddHours(8),
                End = date.AddDays(4),
                Title = "Gantt Rendering",               
                Deadline = date.AddDays(5)
            };
            var ganttDemos = new GanttTask()
            {
                Start = date.AddDays(4.5),
                End = date.AddDays(7),
                Title = "Gantt Demos",
                Deadline = date.AddDays(7)
            };
            var milestone = new GanttTask()
            {
                Start = date.AddDays(7),
                End = date.AddDays(7).AddHours(1),
                Title = "Review",           
                Deadline = date.AddDays(8),
                IsMilestone = true
            };
            ganttRendering.Dependencies.Add(new Dependency() { FromTask = ganttAPI });
            ganttDemos.Dependencies.Add(new Dependency() { FromTask = ganttRendering });
            var iterationTask = new GanttTask()          
            {
                Start = date, 
                End = date.AddDays(7), 
                Title = "Iteration 1",
                Children = { ganttAPI, ganttRendering, ganttDemos, milestone }
            };
            this.Tasks = new ObservableCollection<GanttTask>() { iterationTask };
         


            var custom_ganttAPI = new CustomGanttTask()
            {
                Start = date,
                End = date.AddDays(2),
                Title = "Design public API",
                Deadline = date.AddDays(1)
            };

            var custom_ganttRendering = new CustomGanttTask()
            {
                Start = date.AddDays(2).AddHours(8),
                End = date.AddDays(4),
                Title = "Gantt Rendering",
                Deadline = date.AddDays(5)
            };
            var custom_ganttDemos = new CustomGanttTask()
            {
                Start = date.AddDays(4.5),
                End = date.AddDays(7),
                Title = "Gantt Demos",
                Deadline = date.AddDays(7)
            };
            var custom_milestone = new CustomGanttTask()
            {
                Start = date.AddDays(7),
                End = date.AddDays(7).AddHours(1),
                Title = "Review",
                Deadline = date.AddDays(8),
                IsMilestone = true
            };
            custom_ganttRendering.Dependencies.Add(new Dependency() { FromTask = custom_ganttAPI });
            custom_ganttDemos.Dependencies.Add(new Dependency() { FromTask = custom_ganttRendering });
            var custom_iterationTask = new CustomGanttTask()
            {
                Start = date,
                End = date.AddDays(7),
                Title = "Iteration 1",
                Children = { custom_ganttAPI, custom_ganttRendering, custom_ganttDemos, custom_milestone }
            };
            this.CustomTasks = new ObservableCollection<CustomGanttTask>() { custom_iterationTask };

            this.visibleTime = new DateRange(date.AddDays(-1), date.AddDays(9));
        }