protected override async Task OnGetInternalAsync(SqlConnection connection) { var emptyMilestones = await new Milestones() { OrgId = OrgId, HasWorkItems = false }.ExecuteAsync(connection); EmptyMilestones = emptyMilestones.Select(ms => new OpenWorkItemsResult() { MilestoneId = ms.Id, MilestoneDate = ms.Date, MilestoneDaysAway = ms.DaysAway, MilestoneName = ms.Name }); NextSoonest = await Milestone.GetSoonestNextAsync(connection, OrgId); NextGenerated = await Milestone.CreateNextAsync(connection, OrgId); BacklogItems = await new OpenWorkItems() { OrgId = OrgId, HasMilestone = false }.ExecuteAsync(connection); }
public async Task <IActionResult> OnGetAsync() { using (var cn = Data.GetConnection()) { var redirect = await GetRedirectAsync(cn); if (redirect != null) { return(redirect); } await InitializeAsync(cn); var query = GetQuery(); if (query != null) { WorkItems = await query.ExecuteAsync(cn); ItemsInPastMilestone = WorkItems.Where(wi => wi.MilestoneDate < DateTime.Today).ToArray(); if (ItemsInPastMilestone.Any()) { var teamId = CurrentOrgUser.CurrentTeamId ?? 0; if (teamId != 0) { NextSoonestMilestone = await Milestone.GetSoonestNextAsync(cn, teamId) ?? await Milestone.CreateNextAsync(cn, teamId); } } int[] itemIds = WorkItems.Select(wi => wi.Id).ToArray(); var labelsInUse = await new LabelsInUse() { WorkItemIds = itemIds, OrgId = OrgId }.ExecuteAsync(cn); SelectedLabels = labelsInUse.ToLookup(row => row.WorkItemId); LabelFilter = labelsInUse.GroupBy(row => row.Id); var comments = await new Comments() { OrgId = OrgId, ObjectIds = itemIds, ObjectType = ObjectType.WorkItem }.ExecuteAsync(cn); Comments = comments.ToLookup(row => row.ObjectId); WorkDays = await new WorkDays() { OrgId = OrgId }.ExecuteAsync(cn); if (ClosedItemGrouping != null) { var closedItems = await new ClosedWorkItems() { OrgId = OrgId, AppId = CurrentOrgUser.CurrentAppId }.ExecuteAsync(cn); ClosedItems = closedItems.ToLookup(row => ClosedItemGrouping(row)); } var milestoneIds = WorkItems.GroupBy(row => row.MilestoneId).Select(grp => grp.Key).ToArray(); var milestoneMetrics = await new MilestoneMetrics() { OrgId = OrgId, MilestoneIds = milestoneIds }.ExecuteAsync(cn); MilestoneMetrics = milestoneMetrics.ToDictionary(row => row.Id); } Dropdowns = await CommonDropdowns.FillAsync(cn, OrgId); await OnGetInternalAsync(cn); OnGetInternal(cn); } return(Page()); }