private async void RequestJiraData() { IsSearching = true; Issues = null; var issues = await new JiraRequestService().GetUnhandledIssuesAsync(); var userQuestionModes = issues.Select(i => new UserQuestionMode() { JiraKey = i.Key.Value, Summary = i.Summary, TypeName = i.Type.Name, Assignee = i.Assignee, CreateTime = i.Created?.ToString("yyyy-MM-dd HH:mm"), CompleteDays = DateTimeDiffHelper.DateDiff(DateTime.Now, i.Created ?? new DateTime()), ModuleNames = string.Join(",", i.Components.Select(j => j.Name)).Trim() }).OrderByDescending(i => i.CreateTime).ThenBy(i => i.JiraKey).ThenBy(I => I.Assignee).ToList(); _allSearchedIssues = userQuestionModes.OrderByDescending(i => i.CreateTime).ThenBy(i => i.JiraKey).ThenBy(I => I.Assignee).ToList(); Issues = _allSearchedIssues; var moduleTypes = userQuestionModes.Select(i => string.IsNullOrWhiteSpace(i.ModuleNames) ? _emptyModuleName : i.ModuleNames).Distinct().OrderBy(i => i).ToList(); if (moduleTypes.Contains(_emptyModuleName)) { moduleTypes.Remove(_emptyModuleName); moduleTypes.Insert(0, _emptyModuleName); } moduleTypes.Insert(0, _allModuleTypes); ModuleTypes = moduleTypes; IsSearching = false; }
private async void RequestJiraData() { IsSearching = true; Issues = null; var issuesResult = await new JiraRequestService().GetCurrentSprintIssuesAsync(); var userQuestionModes = new List <UserQuestionMode>(); foreach (var issue in issuesResult) { var userQuestion = new UserQuestionMode() { JiraKey = issue.Key.Value, Priority = issue.Priority.Name, TypeName = issue.Type.Name, Summary = issue.Summary, Description = issue.Description, Assignee = issue.Assignee, CreateTime = issue.Created?.ToString("yyyy-MM-dd HH:mm"), CompleteDays = DateTimeDiffHelper.DateDiff(issue.ResolutionDate ?? new DateTime(), issue.Created ?? new DateTime()), IsCompleted = IsIssueCompleted(issue.Status), Status = issue.Status.Name, ResolutionDate = issue.ResolutionDate?.ToString("yyyy-MM-dd HH:mm"), Creator = issue.Reporter, OriginalEstimate = issue.TimeTrackingData.OriginalEstimate, TimeSpent = issue.TimeTrackingData.TimeSpent }; // get comments var comments = await issue.GetCommentsAsync(); var commentBodyList = comments.Select(i => i.Body).ToList(); userQuestion.Comment = commentBodyList; userQuestionModes.Add(userQuestion); } _lastSearchedIssues = userQuestionModes.OrderBy(i => i.SortingStatus).ToList(); var statusList = userQuestionModes.Select(i => i.Status).Distinct().ToList(); statusList.Insert(0, "所有"); IssueStatusTypes = statusList; SetCurrentIssues(SearchJiraTextBox.SearchedText, SearchTypeComboBox.Text); //issues = issues.Where(i => i.Priority.Id == "1").ToList(); //var sum = itemsSource.Sum(i => i.CompleteDays); IsSearching = false; }