private async Task <WorkItemListView> ListInnerAsync(OpenWorkItems query) { var vm = new WorkItemListView(); using (var cn = _data.GetConnection()) { vm.WorkItems = await query.ExecuteAsync(cn); var itemIds = vm.WorkItems.Select(wi => wi.Id).ToArray(); var labelsInUse = await new LabelsInUse() { WorkItemIds = itemIds, OrgId = _data.CurrentOrg.Id }.ExecuteAsync(cn); vm.SelectedLabels = labelsInUse.ToLookup(row => row.WorkItemId); } return(vm); }
protected override async Task OnGetInternalAsync(SqlConnection connection) { UnestimatedItemCount = WorkItems.Where(wi => wi.EstimateHours == 0).Count(); MyActivitySubscriptions = await new MyHandOffActivities() { OrgId = OrgId, UserId = UserId }.ExecuteAsync(connection); MyHandOffItems = await new OpenWorkItems(QueryTraces) { OrgId = OrgId, InMyActivities = true, ActivityUserId = UserId, IsPaused = true, AppId = CurrentOrgUser.CurrentAppId }.ExecuteAsync(connection); var itemIds = MyHandOffItems.Select(wi => wi.Id).ToArray(); var labelsInUse = await new LabelsInUse() { WorkItemIds = itemIds, OrgId = OrgId }.ExecuteAsync(connection); HandOffLabels = labelsInUse.ToLookup(row => row.WorkItemId); var comments = await new Comments() { OrgId = OrgId, ObjectIds = itemIds, ObjectType = ObjectType.WorkItem }.ExecuteAsync(connection); HandOffComments = comments.ToLookup(row => row.ObjectId); MySchedule = await new MyWorkSchedule() { OrgId = OrgId, UserId = UserId }.ExecuteAsync(connection); HiddenMilestones = await new HiddenMilestones() { OrgId = OrgId, UserId = UserId }.ExecuteAsync(connection); var pinnedItemQry = new OpenWorkItems() { OrgId = OrgId, MyPinnedItems = true, MyUserId = UserId }; if (Options[Option.MyItemsFilterCurrentApp]?.BoolValue ?? true) { pinnedItemQry.AppId = CurrentOrgUser.EffectiveAppId; } UserIdFieldOption.Criteria.Invoke(pinnedItemQry, UserId); PinnedItems = await pinnedItemQry.ExecuteAsync(connection); var pinnedItemIds = PinnedItems.Select(wi => wi.Id).ToArray(); var pinnedLabels = await new LabelsInUse() { WorkItemIds = pinnedItemIds, OrgId = OrgId }.ExecuteAsync(connection); PinnedItemLabels = pinnedLabels.ToLookup(row => row.WorkItemId); var pinnedComments = await new Comments() { OrgId = OrgId, ObjectIds = pinnedItemIds, ObjectType = ObjectType.WorkItem }.ExecuteAsync(connection); PinnedComments = pinnedComments.ToLookup(row => row.ObjectId); }