예제 #1
0
        /// <summary>
        /// Retrieves a new <see cref="DashboardSummary"/> containing information about current bugs, tasks and checkins.
        /// </summary>
        public static DashboardSummary GetSummary()
        {
            QueryManager <BugSummary>  bugQueryManager  = new QueryManager <BugSummary>();
            QueryManager <TaskSummary> taskQueryManager = new QueryManager <TaskSummary>();

            IList <WorkItemSummary> allbugs  = bugQueryManager.Execute().ToList();
            IList <WorkItemSummary> allTasks = taskQueryManager.Execute().ToList();

            DashboardSummary summary = new DashboardSummary();

            summary.RecentCheckins     = RecentCheckins();
            summary.RecentCheckinCount = summary.RecentCheckins.ToList().Count;

            bugQueryManager.WhereActive();
            summary.ActiveBugCount   = bugQueryManager.Execute().Count();
            summary.BugCount         = allbugs.Count;
            summary.MyActiveBugCount = allbugs.Where(b => b.State == "Active").ToList().Count;
            summary.MyActiveBugs     = allbugs.Where(b => b.State == "Active" && b.AssignedTo == UserContext.Current.Name)
                                       .OrderByDescending(b => b.CreatedDate)
                                       .Take(5)
                                       .ToList();

            taskQueryManager.WhereActive();
            summary.ActiveTaskCount = allTasks.Count;
            summary.TaskCount       = allTasks.Count;

            IEnumerable <WorkItemSummary> myActiveTasks = allTasks.Where(b => b.State == "Active" && b.AssignedTo == UserContext.Current.Name)
                                                          .OrderByDescending(b => b.CreatedDate);

            summary.MyActiveTasks     = myActiveTasks.Take(5).ToList();
            summary.MyActiveTaskCount = myActiveTasks.ToList().Count;

            return(summary);
        }
예제 #2
0
        /// <summary>
        /// Retrieves a new <see cref="DashboardSummary"/> containing information about current bugs, tasks and checkins.
        /// </summary>
        public static DashboardSummary GetSummary()
        {
            QueryManager<BugSummary> bugQueryManager = new QueryManager<BugSummary>();
            QueryManager<TaskSummary> taskQueryManager = new QueryManager<TaskSummary>();

            IList<WorkItemSummary> allbugs = bugQueryManager.Execute().ToList();
            IList<WorkItemSummary> allTasks = taskQueryManager.Execute().ToList();

            DashboardSummary summary = new DashboardSummary();
            summary.RecentCheckins = RecentCheckins();
            summary.RecentCheckinCount = summary.RecentCheckins.ToList().Count;

            bugQueryManager.WhereActive();
            summary.ActiveBugCount = bugQueryManager.Execute().Count();
            summary.BugCount = allbugs.Count;
            summary.MyActiveBugCount = allbugs.Where(b => b.State == "Active").ToList().Count;
            summary.MyActiveBugs = allbugs.Where(b => b.State == "Active" && b.AssignedTo == UserContext.Current.Name)
                .OrderByDescending(b => b.CreatedDate)
                .Take(5)
                .ToList();

            taskQueryManager.WhereActive();
            summary.ActiveTaskCount = allTasks.Count;
            summary.TaskCount = allTasks.Count;

            IEnumerable<WorkItemSummary> myActiveTasks = allTasks.Where(b => b.State == "Active" && b.AssignedTo == UserContext.Current.Name)
                .OrderByDescending(b => b.CreatedDate);

            summary.MyActiveTasks = myActiveTasks.Take(5).ToList();
            summary.MyActiveTaskCount = myActiveTasks.ToList().Count;

            return summary;
        }