private async void btnCheckJiraKey_Click(object sender, EventArgs e) { this.btnCheckJiraKey.Enabled = false; string jiraKey = this.txtJiraKey.Text; IssueRef issueRef = new IssueRef(); issueRef.key = jiraKey; var issue = await JiraProxy.LoadIssue(issueRef); if (issue == null || issue.fields == null) { return; } this.txtAssignee.Text = issue.fields.assignee.name; this.txtAssigneeQA.Text = issue.fields.customfield_11702 == null ? "" : issue.fields.customfield_11702.name; Dictionary <string, string> SubTaskMaper = new Dictionary <string, string>(); foreach (var subTask in issue.fields.subtasks) { if (subTask != null && subTask.fields != null && subTask.fields.issuetype.subtask == true) { if (!SubTaskMaper.ContainsKey(subTask.fields.summary)) { SubTaskMaper.Add(subTask.fields.summary, subTask.key); } } } if ("Case".Equals(issue.fields.issueType.name, StringComparison.InvariantCultureIgnoreCase)) { //this.btnCreateSubTask.Enabled = true; //this.chkReviewAndRecreateQA.Enabled = true; //this.chkReviewAndRecreateDev.Enabled = true; //this.chkResearchRootCause.Enabled = true; this.chkCodeFix.Enabled = false; //this.chkWriteTestCase.Enabled = false; //this.chkExecuteTestCase.Enabled = false; //this.chkWriteReleaseNotes.Enabled = false; //this.chkReviewReleaseNotes.Enabled = false; foreach (string key in SubTaskMaper.Keys) { // Review and Recreate(QA) if (this.chkReviewAndRecreateQA.Text == key) { //this.chkReviewAndRecreateQA.Enabled = false; this.txtReviewAndRecreateQASubTaskKey.Text = SubTaskMaper[key]; var assignee = await JiraProxy.GetAssigneeByJiraKey(SubTaskMaper[key]); this.txtReviewAndRecreateQAAssignee.Text = assignee; } // Review and Recreate(Dev) if (this.chkReviewAndRecreateDev.Text == key) { //this.chkReviewAndRecreateDev.Enabled = false; this.txtReviewAndRecreateDevSubTaskKey.Text = SubTaskMaper[key]; var assignee = await JiraProxy.GetAssigneeByJiraKey(SubTaskMaper[key]); this.txtReviewAndRecreateDevAssignee.Text = assignee; } // Research Root Cause if (this.chkResearchRootCause.Text == key) { //this.chkResearchRootCause.Enabled = false; this.txtResearchRootCauseSubTaskKey.Text = SubTaskMaper[key]; var assignee = await JiraProxy.GetAssigneeByJiraKey(SubTaskMaper[key]); this.txtResearchRootCauseAssignee.Text = assignee; } } } if ("Bug".Equals(issue.fields.issueType.name, StringComparison.InvariantCultureIgnoreCase)) { this.btnCreateSubTask.Enabled = true; this.chkReviewAndRecreateQA.Enabled = false; this.chkReviewAndRecreateDev.Enabled = false; this.chkResearchRootCause.Enabled = false; this.chkCodeFix.Enabled = true; this.chkWriteTestCase.Enabled = true; this.chkExecuteTestCase.Enabled = true; this.chkWriteReleaseNotes.Enabled = true; this.chkReviewReleaseNotes.Enabled = true; foreach (string key in SubTaskMaper.Keys) { // Code Fix(Dev) if (this.chkCodeFix.Text == key) { this.chkCodeFix.Enabled = false; this.txtCodeFixSubTaskKey.Text = SubTaskMaper[key]; } // Write Test Case(QA) if (this.chkWriteTestCase.Text == key) { this.chkWriteTestCase.Enabled = false; this.txtWriteTestCaseSubTaskKey.Text = SubTaskMaper[key]; } // Execute Test Case(QA) if (this.chkExecuteTestCase.Text == key) { this.chkExecuteTestCase.Enabled = false; this.txtExecuteTestCaseSubTaskKey.Text = SubTaskMaper[key]; } // Write Release Notes(Dev) if (this.chkWriteReleaseNotes.Text == key) { this.chkWriteReleaseNotes.Enabled = false; this.txtWriteReleaseNotesSubTaskKey.Text = SubTaskMaper[key]; } // Review Release Notes(QA) if (this.chkReviewReleaseNotes.Text == key) { this.chkReviewReleaseNotes.Enabled = false; this.txtReviewReleaseNotesSubTaskKey.Text = SubTaskMaper[key]; } } } this.btnCreateSubTask.Enabled = true; this.btnCheckJiraKey.Enabled = true; }
public IEnumerable <Ticket> Tickets(IAvailableTicketTypes availableTypes) { var map = new JiraTypeMap(this, availableTypes); foreach (var jiraKey in jira.EnumerateIssues(jiraProject)) { var issueRef = new IssueRef { id = jiraKey.id, key = jiraKey.key }; var jiraTicket = jira.LoadIssue(issueRef); onDetailedProcessing(jiraTicket.key + " - " + jiraTicket.fields.summary); var ticket = new Ticket(); ticket.TicketType = map[jiraTicket.fields.issuetype.name]; ticket.ID = jiraTicket.key; ticket.Summary = JiraString.StripNonPrintable(jiraTicket.fields.summary); var status = jiraTicket.fields.status.statusCategory.key.ToUpper(); switch (status) { case "NEW": ticket.TicketState = Ticket.State.Todo; break; case "DONE": ticket.TicketState = Ticket.State.Done; break; case "INDETERMINATE": ticket.TicketState = Ticket.State.InProgress; break; default: ticket.TicketState = Ticket.State.Unknown; break; } ticket.Parent = jiraTicket.fields.parent.key; ticket.Description = JiraString.StripNonPrintable(jiraTicket.fields.description); if (PreferHtml && string.IsNullOrWhiteSpace(jiraTicket.renderedFields.description) == false) { ticket.Description = JiraString.StripNonPrintable(jiraTicket.renderedFields.description); } ticket.CreatedOn = jiraTicket.fields.created; ticket.LastModified = jiraTicket.fields.updated; ticket.CreatedBy = new User(jiraTicket.fields.reporter.displayName, jiraTicket.fields.reporter.name, jiraTicket.fields.reporter.emailAddress); ticket.AssignedTo = new User(jiraTicket.fields.assignee.displayName, jiraTicket.fields.assignee.name, jiraTicket.fields.assignee.emailAddress); ticket.Epic = jiraTicket.fields.customfield_10800; ticket.ExternalReference = jiraTicket.key; ticket.Url = jiraServer + "/browse/" + jiraTicket.key; int.TryParse(jiraTicket.fields.customfield_10004, out ticket.StoryPoints); foreach (var link in jiraTicket.fields.issuelinks) { if (string.Compare(link.inwardIssue.key, jiraTicket.key) != 0) { ticket.Links.Add(new Link(link.inwardIssue.key, link.type.name)); } if (string.Compare(link.outwardIssue.key, jiraTicket.key) != 0) { ticket.Links.Add(new Link(link.outwardIssue.key, link.type.name)); } } foreach (var jiraComment in jiraTicket.fields.comments) { var author = new User(jiraComment.author.displayName, jiraComment.author.name, jiraComment.author.emailAddress); var comment = new Comment(author, jiraComment.body, jiraComment.created); if (jiraComment.updated.Date > jiraComment.created.Date) { comment.Updated = jiraComment.updated; } ticket.Comments.Add(comment); } foreach (var attachment in jiraTicket.fields.attachment) { ticket.Attachments.Add(new Attachment(attachment.filename, attachment.content)); } ticket.Priority = jiraTicket.fields.priority.name; ticket.Project = jiraTicket.fields.project.name; if (jiraTicket.fields.resolutiondate != null) { ticket.ClosedOn = jiraTicket.fields.resolutiondate; } yield return(ticket); } }
public async Task <string> createSubTask(string summary, string issueKey) { IssueRef issueRef = new IssueRef(); issueRef.key = issueKey; string description = ""; if ("Review and Recreate(QA)" == summary) { description = @"*{color:red}Notice{color}*: * {color:red}Just log QA effort spent on reviewing and recreating the assicaited production case{color} * {color:red}Please DO NOT add comment in the sub task{color} Following the below steps if you work on this sub task # Assign this sub task to you # Log all your effort spent on this case # Post your comment in the parent jira ticket if neccessary # Close this sub task when this case is recreated"; } if ("Review and Recreate(Dev)" == summary) { description = @"*{color:red}Notice{color}*: * {color:red}Just log Dev effort spent on reviewing and recreating the assicaited production case{color} * {color:red}Please DO NOT add comment in the sub task{color} Following the below steps if you work on this sub task # Assign this sub task to you # Log all your effort spent on this case # Post your comment in the parent jira ticket if neccessary # Close this sub task when this case is recreated"; } if ("Research Root Cause" == summary) { description = @"*{color:red}Notice{color}*: * {color:red}Just log Dev effort spent on researching root cause after the assicaited production case is recreated{color} * {color:red}Please DO NOT add comment in the sub task{color} Following the below steps if you work on this sub task # Assign this sub task to you # Log all your effort spent on this case # Post your comment in the parent jira ticket if neccessary # Close this sub task when this root cause is found"; } // Code Fix(Dev) if ("Code Fix(Dev)" == summary) { description = @"*{color:red}Notice{color}*: * {color:red}Just log Dev effort spent on solving the assicaited production bug{color} * {color:red}Please DO NOT add comment in the sub task{color} Following the below steps if you work on this sub task # Assign this sub task to you # Log all your effort spent on this case # Post your comment in the parent jira ticket if neccessary # Close this sub task when it is done"; } // Write Test Case(QA) if ("Write Test Case(QA)" == summary) { description = @"*{color:red}Notice{color}*: * {color:red}Just log QA effort spent on writing test case for the assicaited production bug{color} * {color:red}Please DO NOT add comment in the sub task{color} Following the below steps if you work on this sub task # Assign this sub task to you # Log all your effort spent on this case # Post your comment in the parent jira ticket if neccessary # Close this sub task when it is done"; } // Execute Test Case(QA) if ("Execute Test Case(QA)" == summary) { description = @"*{color:red}Notice{color}*: * {color:red}Just log QA effort spent on executing test case for the assicaited production bug{color} * {color:red}Please DO NOT add comment in the sub task{color} Following the below steps if you work on this sub task # Assign this sub task to you # Log all your effort spent on this case # Post your comment in the parent jira ticket if neccessary # Close this sub task when it is done"; } // Write Release Notes(Dev) if ("Write Release Notes(Dev)" == summary) { description = @"*{color:red}Notice{color}*: * {color:red}Just log Dev effort spent on writing release notes for the assicaited production bug{color} * {color:red}Please DO NOT add comment in the sub task{color} Following the below steps if you work on this sub task # Assign this sub task to you # Log all your effort spent on this case # Post your comment in the parent jira ticket if neccessary # Close this sub task when it is done"; } // Review Release Notes(QA) if ("Review Release Notes(QA)" == summary) { description = @"*{color:red}Notice{color}*: * {color:red}Just log QA effort spent on reviewing release notes for the assicaited production bug{color} * {color:red}Please DO NOT add comment in the sub task{color} Following the below steps if you work on this sub task # Assign this sub task to you # Log all your effort spent on this case # Post your comment in the parent jira ticket if neccessary # Close this sub task when it is done"; } var issue = await JiraProxy.CreateSubTask(summary, description, issueRef); return(issue.key); }
private async void btnAssign_Click(object sender, EventArgs e) { this.btnAssign.Enabled = false; DataTable dataTable = dgvWorkLogReport.DataSource as DataTable; if (dataTable != null) { string Name = ""; string EmailAddress = ""; string Effort = ""; string SubTaskID = ""; string SubTaskSummary = ""; string SubTaskAssignee = ""; string SubTaskComment = ""; string JiraKey = ""; string JiraSummary = ""; int rowCount = dataTable.Rows.Count; for (int k = 0; k < rowCount; k++) { DataRow row = dataTable.Rows[k]; Name = row["Name"] as string; EmailAddress = row["EmailAddress"] as string; Effort = row["Effort"] as string; SubTaskID = row["SubTaskID"] as string; SubTaskSummary = row["SubTaskSummary"] as string; SubTaskAssignee = row["SubTaskAssignee"] as string; SubTaskComment = row["SubTaskComment"] as string; JiraKey = row["JiraKey"] as string; JiraSummary = row["JiraSummary"] as string; if (!String.IsNullOrEmpty(SubTaskID) && !Name.Equals(SubTaskAssignee, StringComparison.InvariantCultureIgnoreCase)) { IssueRef issueRef = new IssueRef(); issueRef.key = SubTaskID; var issue = await JiraProxy.LoadIssue(issueRef); if (issue == null || issue.fields == null) { return; } // https://accelaeng.atlassian.net/rest/api/2/user/[email protected] JiraUser jiraUser = new JiraUser(); if ("*****@*****.**" == EmailAddress) { EmailAddress = "likko.zhang"; } jiraUser.name = EmailAddress; issue.fields.assignee = jiraUser; JiraProxy.UpdateSubTask(issue); } } } this.btnAssign.Enabled = true; }
public IssueLink() { type = new LinkType(); inwardIssue = new IssueRef(); outwardIssue = new IssueRef(); }
public static async Task <bool> UpdateJiraStatus(IssueRef issueRef, string jiraStatus, string jiraNextStatus) { IJiraClient jira = new JiraClient("https://accelaeng.atlassian.net/", "*****@*****.**", "peter.peng"); var transitions = jira.GetTransitions(issueRef); if ("Closed".Equals(jiraStatus, System.StringComparison.InvariantCultureIgnoreCase) && jiraNextStatus == "In Progress") { foreach (var transition in transitions) { if ("Re-Open".Equals(transition.name, System.StringComparison.InvariantCultureIgnoreCase)) { jira.TransitionIssue(issueRef, transition); break; } } } if ("Pending".Equals(jiraStatus, System.StringComparison.InvariantCultureIgnoreCase) && jiraNextStatus == "In Progress") { foreach (var transition in transitions) { if ("Analysis In Progress".Equals(transition.name, System.StringComparison.InvariantCultureIgnoreCase)) { jira.TransitionIssue(issueRef, transition); break; } } } if ("In Progress".Equals(jiraStatus, System.StringComparison.InvariantCultureIgnoreCase) && jiraNextStatus == "Pending") { foreach (var transition in transitions) { if ("Commented".Equals(transition.name, System.StringComparison.InvariantCultureIgnoreCase)) { jira.TransitionIssue(issueRef, transition); break; } } } if (("Pending".Equals(jiraStatus, System.StringComparison.InvariantCultureIgnoreCase) || "Resolved".Equals(jiraStatus, System.StringComparison.InvariantCultureIgnoreCase)) && jiraNextStatus == "Closed") { foreach (var transition in transitions) { if ("Closed".Equals(transition.name, System.StringComparison.InvariantCultureIgnoreCase)) { jira.TransitionIssue(issueRef, transition); break; } } } //var issues = jira.TransitionIssue(issueRef, inProgressOrReopen); // "Open" -> "In Progress" // "In Progress" -> "Commented" // "In Progress" -> "Closed" return(true); }
public static async Task <Issue> CreateSubTask(string summary, string description, IssueRef parent) { IJiraClient jira = new JiraClient("https://accelaeng.atlassian.net/", "*****@*****.**", "peter.peng"); var issue = jira.CreateSubTask("ENGSUPP", parent.key, summary, description); return(issue); }