Exemplo n.º 1
0
        public async Task <IReadOnlyCollection <IssueListItem> > HandleAsync(GetIssuesRelatedToNfr query)
        {
            var task = await repository.GetAsync(query.ParentIssueId);

            var issues = task.Bugs.Cast <Issue>();

            return(issues.Select(x => new IssueListItem(x.Id, x.ProjectId, IssueHelpers.GetIssueType(x), x.Title, x.Description, x.Status, x.Reporter.Id, x.Assignee?.Id)).ToList());
        }
        public async Task <IssueResponse> HandleAsync(GetIssue query)
        {
            var issue = await issueRepository.GetAsync(query.IssueId);

            var issueType  = IssueHelpers.GetIssueType(issue);
            var usersNames = await userSearcher.GetUsers(issue.Comments.Select(x => x.MemberId).ToList());

            var issueResponse = new IssueResponse(issue.Id, issue.ProjectId, issue.SprintId, issueType, issue.Title, issue.Description,
                                                  issue.Status, issue.Reporter.Id, issue.Reporter.GetFullName(), issue.Reporter.Email, issue.Assignee?.Id,
                                                  issue.Comments.Select(x => new CommentResponse(x.MemberId, usersNames[x.MemberId], x.Content, x.AddedAt)).ToList(),
                                                  issue.Labels.Select(x => new LabelResponse(x.Id, x.Name, x.Description)).ToList(), issue.Version);

            var linkedIssues = new List <LinkedIssue>();

            if (issue is Storage.Models.Task)
            {
                var issues = await issueSearcher.GetIssuesRelatedToTask(issue.Id);

                linkedIssues = issues.Select(x => new LinkedIssue(x.Id, x.Title, IssueHelpers.GetIssueType(x))).ToList();
            }
            else if (issue is Storage.Models.Nfr)
            {
                var issues = await issueSearcher.GetIssuesRelatedToNfr(issue.Id);

                linkedIssues = issues.Select(x => new LinkedIssue(x.Id, x.Title, IssueHelpers.GetIssueType(x))).ToList();
            }
            else if (issue is Storage.Models.Subtask)
            {
                var parentIssue = await issueSearcher.GetParentIssueToSubtask(issue.Id);

                issueResponse.SetLinkedTo(parentIssue.Id, parentIssue.Title, IssueType.Task);
            }
            else
            {
                var parentIssue = await issueSearcher.GetParentIssueToBug(issue.Id);

                if (parentIssue != null)
                {
                    issueResponse.SetLinkedTo(parentIssue.Id, parentIssue.Title, IssueHelpers.GetIssueType(parentIssue));
                }
            }


            if (linkedIssues.Count != 0)
            {
                issueResponse.SetLinkedIssues(linkedIssues);
            }

            return(issueResponse);
        }
Exemplo n.º 3
0
        public ActionResult IssuesManager(HttpPostedFileBase FileImport)
        {
            IssueHelpers      fileImport = new IssueHelpers();
            List <SmartIssue> data       = null;

            try
            {
                data = fileImport.GetIssuesFromFile(UpdateFile(FileImport)).ToList();
                Session["DataImport"] = data;
            }
            catch
            {
                ViewBag.File = "File error!";
            }

            return(View(data));
        }
        public async Task HandleAsync(SprintFinished @event)
        {
            var sprint = await db.Sprints.Include(x => x.Tasks).Include(x => x.Subtasks).Include(x => x.Nfrs).Include(x => x.Bugs).SingleOrDefaultAsync(x => x.Id == @event.Id);

            if (sprint == null)
            {
                throw new EntityDoesNotExist(@event.Id, nameof(Models.Sprint));
            }

            sprint.End     = @event.End.Date;
            sprint.Status  = @event.Status;
            sprint.Version = @event.AggregateVersion;

            var unfinishedIssueIds = @event.UnfinishedIssueIds;
            var issues             = await db.Issues.Where(x => unfinishedIssueIds.Any(y => x.Id == y)).ToListAsync();

            var unfinishedIssues = issues.Select(x => new UnfinishedIssue(x.Id, IssueHelpers.GetIssueType(x), x.Title)).ToList();

            sprint.UnfinishedIssues = unfinishedIssues;

            await db.SaveChangesAsync();
        }
        public async Task <IReadOnlyCollection <IssueListItem> > HandleAsync(GetIssues query)
        {
            var issues = await issueSearcher.GetProjectIssues(query.ProjectId);

            return(issues.Select(x => new IssueListItem(x.Id, x.ProjectId, IssueHelpers.GetIssueType(x), x.Title, x.Description, x.Status, x.Reporter.Id, x.Assignee?.Id)).ToList());
        }