private ICollection<HourColumn> CreateStructureHours(ICollection<BacklogItem> items) { if (items == null) return null; List<HourColumn> temp = new List<HourColumn>(); foreach (string groupUId in items.GroupBy(i => i.GroupUId).Select(g => g.Key)) { BacklogItem item = items.FirstOrDefault(i => i.GroupUId == groupUId); if (item != null && item.Group!=null) { HourColumn column = new HourColumn() { Name = item.Group.GroupName }; decimal? hours = items.Where(i => i.GroupUId == groupUId && i.PlannedHours != null).Sum(i => i.PlannedHours.Sum(h => h.Hours)); if (!hours.HasValue) hours = 0; column.Hours = hours.Value; temp.Add(column); } } return temp; }
private ICollection<HourColumn> CreateProjectHours(ICollection<BacklogItem> items) { if (items == null) return null; List<HourColumn> temp = new List<HourColumn>(); decimal? hours = items.Where(i => i.PlannedHours!=null).Sum(i => i.PlannedHours.Sum(h => h.Hours)); if (!hours.HasValue) hours = 0; HourColumn column = new HourColumn() { Name = Project.ProjectName, Hours = hours.Value }; temp.Add(column); return temp; }
private ICollection<HourColumn> CreateRoleHours(ICollection<BacklogItem> items) { if (items == null) return null; List<HourColumn> temp = new List<HourColumn>(); foreach (Role role in Project.Roles) { HourColumn column = new HourColumn() { Name = role.RoleName }; decimal? hours = items.Where(i=>i.PlannedHours!=null).Sum(i => i.PlannedHours.Where(h => h.RoleUId== role.RoleUId).Sum(h => h.Hours)); if (!hours.HasValue) hours = 0; column.Hours = hours.Value; temp.Add(column); } return temp; }
private ICollection<HourColumn> CreateItemsHours(ICollection<BacklogItem> items) { if (items == null) return null; List<HourColumn> temp = new List<HourColumn>(); foreach (BacklogItem item in items.OrderBy(i => i.BacklogItemNumber)) { HourColumn column = new HourColumn() { Name = item.BacklogItemNumber.ToString() }; if (item.PlannedHours != null) { decimal? hours = item.PlannedHours.Sum(h => h.Hours); if(!hours.HasValue) hours =0; column.Hours = hours.Value; } temp.Add(column); } return temp; }