コード例 #1
0
        public static List <TaskViewItem> Build(this List <TaskItem> taskItems, List <TimeEntry> timeEntries = null)
        {
            List <TaskViewItem> list = new List <TaskViewItem>();
            var domains = taskItems.ToLookup(x => x.DomainId);

            foreach (var domain in domains)
            {
                var domainTaskView = new TaskViewItem().Default(domain.Key);
                domainTaskView.Build(domain.ToList(), timeEntries);
                list.Add(domainTaskView);
            }
            return(list);
        }
コード例 #2
0
 private static void Build(this TaskViewItem viewItem, List <TaskItem> taskItems, List <TimeEntry> timeEntries = null, int level = 0)
 {
     level++;
     foreach (var item in taskItems.Where(t => t.Identifier.MasterId.Equals(viewItem.Id, StringComparison.OrdinalIgnoreCase)))
     {
         if (viewItem.Tasks == null)
         {
             viewItem.Tasks = new List <TaskViewItem>();
         }
         TaskViewItem view = new TaskViewItem(item).Default(item, viewItem);
         if (timeEntries != null)
         {
             var entries = timeEntries.Where(x => x.Task.Id.Equals(view.Data.Id, StringComparison.OrdinalIgnoreCase));
             view.TimeEntries.AddRange(entries);
         }
         view.Build(taskItems, timeEntries, level);
         viewItem.Tasks.Add(view);
     }
     level--;
 }