private async void btnSubmit_Click(object sender, EventArgs e) { this.btnSubmit.Enabled = false; DataTable dataTable = dgvSubTaskTable.DataSource as DataTable; if (dataTable != null) { string SubTaskKey = ""; string MEO = ""; int rowCount = dataTable.Rows.Count; for (int k = 0; k < rowCount; k++) { DataRow row = dataTable.Rows[k]; SubTaskKey = row["SubTaskKey"] as string; MEO = row["MEO"] as string; if (!String.IsNullOrEmpty(SubTaskKey) && !String.IsNullOrEmpty(MEO) && MEO.Trim().Length > 0) { IssueRef issueRef = new IssueRef(); issueRef.key = SubTaskKey; var issue = await JiraProxy.LoadIssue(issueRef); if (issue == null || issue.fields == null) { return; } issue.fields.customfield_14101 = new MEOOption(); issue.fields.customfield_14101.value = MEO; JiraProxy.UpdateSubTask(issue); } } } this.btnSubmit.Enabled = true; }
public async void updateSubTask(string subTaskKey, string assignee) { IssueRef issueRef = new IssueRef(); issueRef.key = subTaskKey; 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(); jiraUser.name = assignee; issue.fields.assignee = jiraUser; JiraProxy.UpdateSubTask(issue); }
private async void btnSync_Click(object sender, EventArgs e) { this.btnSync.Enabled = false; if (jiraIssueList == null || jiraIssueList.Count <= 0) { this.btnSync.Enabled = true; return; } foreach (var issue in jiraIssueList) { if (issue.subtasks == null || issue.subtasks.Count <= 0) { continue; } foreach (var key in issue.subtasks.Keys) { var subTask = issue.subtasks[key]; IssueRef issueRef = new IssueRef(); issueRef.key = subTask.key; issueRef.id = subTask.key; if (subTask == null || subTask.timespent <= 0 || subTask.worklogs == null || subTask.worklogs.Count <= 0) { continue; } var lastWorkLog = subTask.worklogs[subTask.worklogs.Count - 1]; var lastAssigneeEmailAddress = lastWorkLog.assigneeEmailAddress; var subTaskItem = await JiraProxy.LoadIssue(issueRef); if (subTaskItem == null || subTaskItem.fields == null) { continue; } if (subTask.assignee == "Jerry Lu") { // https://accelaeng.atlassian.net/rest/api/2/user/[email protected] JiraUser jiraUser = new JiraUser(); if ("*****@*****.**" == lastAssigneeEmailAddress) { lastAssigneeEmailAddress = "likko.zhang"; } jiraUser.name = lastAssigneeEmailAddress; subTaskItem.fields.assignee = jiraUser; JiraProxy.UpdateSubTask(subTaskItem); } if ("Closed".Equals(issue.status, StringComparison.InvariantCultureIgnoreCase) && !"Closed".Equals(subTask.status, StringComparison.InvariantCultureIgnoreCase)) { if ("Case".Equals(issue.issueType, StringComparison.InvariantCultureIgnoreCase)) { if ("Review and Recreate(QA)".Equals(subTask.name, StringComparison.InvariantCultureIgnoreCase) || "Review and Recreate(Dev)".Equals(subTask.name, StringComparison.InvariantCultureIgnoreCase) || "Research Root Cause".Equals(subTask.name, StringComparison.InvariantCultureIgnoreCase)) { JiraProxy.CloseSubTask(issueRef); } } if ("Bug".Equals(issue.issueType, StringComparison.InvariantCultureIgnoreCase)) { if ("Review and Recreate(QA)".Equals(subTask.name, StringComparison.InvariantCultureIgnoreCase) || "Review and Recreate(Dev)".Equals(subTask.name, StringComparison.InvariantCultureIgnoreCase) || "Research Root Cause".Equals(subTask.name, StringComparison.InvariantCultureIgnoreCase) || "Code Fix(Dev)".Equals(subTask.name, StringComparison.InvariantCultureIgnoreCase) || "Write Test Case(QA)".Equals(subTask.name, StringComparison.InvariantCultureIgnoreCase) || "Execute Test Case(QA)".Equals(subTask.name, StringComparison.InvariantCultureIgnoreCase) || "Write Release Notes(Dev)".Equals(subTask.name, StringComparison.InvariantCultureIgnoreCase) || "Review Release Notes(QA)".Equals(subTask.name, StringComparison.InvariantCultureIgnoreCase)) { JiraProxy.CloseSubTask(issueRef); } } } } } this.btnSync.Enabled = true; }
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; }