public async static Task <IssueData[]> GetIssuesAsync(int page, int pageSize, IssueSortOrder sortOrder, IssueFilter filter) { return(await Task.Run(() => { var issues = IssuesHelper.SortIssues(sortOrder, AllIssues.Value); if (filter != null) { issues = IssuesHelper.FilterIssues(filter, issues); } issues = issues.Skip(page *pageSize).Take(pageSize); return issues.ToArray(); })); }
async Task <object[]> GetTotalSummariesAsync(GetSummariesAsyncEventArgs e) { IssueFilter filter = IssuesHelper.MakeIssueFilter(e.Filter); var summaryValues = await IssuesService.GetSummariesAsync(filter); return(e.Summaries.Select(x => { if (x.SummaryType == SummaryType.Count) { return (object)summaryValues.Count; } throw new InvalidOperationException(); }).ToArray()); }
async Task <FetchRowsResult> FetchRowsAsync(FetchRowsAsyncEventArgs e) { IssueSortOrder sortOrder = IssuesHelper.GetIssueSortOrder(e); IssueFilter filter = IssuesHelper.MakeIssueFilter(e.Filter); const int pageSize = 30; var issues = await IssuesService.GetIssuesAsync( page : e.Skip / pageSize, pageSize : pageSize, sortOrder : sortOrder, filter : filter); return(new FetchRowsResult(issues, hasMoreRows: issues.Length == pageSize)); }
public async static Task <IssuesSummaries> GetSummariesAsync(IssueFilter filter) { return(await Task.Run(() => { return new IssuesSummaries(count: IssuesHelper.FilterIssues(filter, AllIssues.Value).Count()); })); }