Exemplo n.º 1
0
 public GanttRow(Task c)
 {
     this.id = (int)c.HashIndex();
     this.start_date = c.StartTime.ToString("dd-MM-yyyy");
     this.text = c.Name;
     this.duration = (int)(c.EndTime - c.StartTime).TotalHours / hoursPerDay;
     this.progress = c.EffortEstimation == 0 ? 0 : c.Effort / c.EffortEstimation;
 }
Exemplo n.º 2
0
 protected override TaskData CreateData(Task source, int id, string parentType)
 {
     var data = CreateDataFor(source, id, null, parentType);
     data.ParentType = parentType;
     TaskData.SetParent(db, parentType, data);
     // var project = ItemData<Note, Item>.GetProject(data.Parent, db);
     data.Entity.ProjectId = data.ParentItem.ProjectId;
     db.SaveChanges();
     return data;
 }
Exemplo n.º 3
0
 protected override TaskData CreateData(Task t, int id)
 {
     return CreateDataFor(null, id);
 }
Exemplo n.º 4
0
        private static Tuple<DateTime, DateTime> AddTaskTasks(Task s, List<Task> tasks, UIBuildItContext db)
        {
            var result = new List<string>();
            DateTime start = DateTime.MaxValue;
            DateTime end = DateTime.MinValue;
            var children = (from t in tasks where t.ParentType == "Task" && t.ParentId == s.Id select t).ToList();
            if (children.Count == 0)
            {
                return new Tuple<DateTime, DateTime>(s.StartTime, s.EndTime);
            }
            else
            {
                foreach (var c in children)
                {
                    if (c.StartTime > new DateTime(1950, 1, 1) && c.EndTime < new DateTime(2222, 1, 1))
                    {
                        var row = new GanttRow(c);
                        _rows.Add(row);
                        row.parent = (int)s.HashIndex();
                        if (start < c.StartTime)
                        {
                            start = c.StartTime;
                        }
                        if (end < c.EndTime)
                        {
                            end = c.EndTime;
                        }
                        var times = AddTaskTasks(c, tasks, db);
                        if (start > times.Item1)
                        {
                            start = times.Item1;
                        }
                        if (end < times.Item2)
                        {
                            end = times.Item2;
                        }
                    }
                }
            }

            return new Tuple<DateTime,DateTime>(start, end);
        }