private async void btnSync_Click(object sender, EventArgs e) { this.btnSync.Enabled = false; var jiraLabels = this.txtLabelList.Text; if (jiraLabels.Trim().Length == 0) { MessageBox.Show("Please enter some jira labels related release version like 9.0.4"); this.btnSync.Enabled = true; return; } dicDeliveryCaseMapper.Clear(); string[] jiraLabelList = jiraLabels.Split(','); foreach (string label in jiraLabelList) { if (String.IsNullOrEmpty(label) || String.IsNullOrWhiteSpace(label)) { continue; } var GetIssueList = JiraProxy.GetIssueListByLabel(label); var issueList = await GetIssueList; if (issueList == null || issueList.Count == 0) { continue; } List <AccelaIssueCaseMapper> jiraIssues = dicDeliveryCaseMapper.ContainsKey(label) ? dicDeliveryCaseMapper[label] : new List <AccelaIssueCaseMapper>(); foreach (var issue in issueList) { if (issue == null) { continue; } AccelaIssueCaseMapper issueMapper = new AccelaIssueCaseMapper(); // Product issueMapper.SFProduct = issue.fields.customfield_10904; // Jira Key issueMapper.JiraKey = issue.key; // Salesforce ID issueMapper.CaseNumber = issue.fields.customfield_10600; // Customer issueMapper.SFCustomer = issue.fields.customfield_10900; // Summary issueMapper.Description = issue.fields.summary; // Type issueMapper.IssueType = (issue.fields.issueType == null ? "" : issue.fields.issueType.name); // Severity issueMapper.Priority = (issue.fields.Priority == null ? "" : issue.fields.Priority.name); // Fix Version issueMapper.FixVersions = new List <string>(); if (issue.fields.fixVersions != null) { foreach (var fixVersion in issue.fields.fixVersions) { if (fixVersion == null) { continue; } issueMapper.FixVersions.Add(fixVersion.name); } issueMapper.FixVersions.Sort(); } // Jira Status issueMapper.Status = (issue.fields.status == null ? "" : issue.fields.status.name); // Assignee(Dev) issueMapper.Assignee = (issue.fields.assignee == null ? "" : issue.fields.assignee.displayName); // Assignee(QA) issueMapper.AssigneeQA = (issue.fields.customfield_11702 == null ? "" : issue.fields.customfield_11702.displayName); List <Comment> comments = new List <Comment>(); if (this.chkRootCause.Checked || this.chkSolution.Checked || this.chkImpactArea.Checked) { if ("ENGSUPP-12597".Equals(issue.key)) { System.Console.WriteLine("" + issue.key); } var Comments = await JiraProxy.GetComments(issue); foreach (var comment in Comments) { if (this.chkRootCause.Checked && comment.body.Contains("Root Cause")) { comments.Add(comment); continue; } if (this.chkSolution.Checked && comment.body.Contains("Solution")) { comments.Add(comment); continue; } if (this.chkImpactArea.Checked && comment.body.Contains("Impact Area")) { comments.Add(comment); continue; } } } issueMapper.Comments = comments; issueMapper.ReleaseNote = issue.fields.customfield_11500; jiraIssues.Add(issueMapper); } dicDeliveryCaseMapper[label] = jiraIssues; } DataTable table = new DataTable("Delivery Progress Report"); table.Columns.Add("No", typeof(int)); table.Columns.Add("Product", typeof(string)); table.Columns.Add("JiraKey", typeof(string)); table.Columns.Add("SalesforceID", typeof(string)); table.Columns.Add("Customer", typeof(string)); table.Columns.Add("Description", typeof(string)); table.Columns.Add("IssueType", typeof(string)); table.Columns.Add("Severity", typeof(string)); table.Columns.Add("FixVersions", typeof(List <string>)); table.Columns.Add("FixVersionsForUI", typeof(string)); table.Columns.Add("JiraStatus", typeof(string)); table.Columns.Add("AssigneeDev", typeof(string)); table.Columns.Add("AssigneeQA", typeof(string)); table.Columns.Add("Comments", typeof(List <Comment>)); table.Columns.Add("CemmentCount", typeof(int)); table.Columns.Add("ReleaseNote", typeof(string)); int index = 1; int labelIndex = 1; foreach (string versionLabel in jiraLabelList) { if (String.IsNullOrEmpty(versionLabel) || String.IsNullOrWhiteSpace(versionLabel)) { continue; } List <AccelaIssueCaseMapper> jiraIssueList = dicDeliveryCaseMapper.ContainsKey(versionLabel) ? dicDeliveryCaseMapper[versionLabel] : new List <AccelaIssueCaseMapper>(); if (jiraIssueList.Count == 0) { continue; } foreach (AccelaIssueCaseMapper jiraIssue in jiraIssueList) { DataRow row = table.NewRow(); row["No"] = index++; row["Product"] = jiraIssue.SFProduct; row["JiraKey"] = jiraIssue.JiraKey; row["SalesforceID"] = jiraIssue.CaseNumber; row["Customer"] = jiraIssue.SFCustomer; row["Description"] = jiraIssue.Description; row["IssueType"] = jiraIssue.IssueType; row["Severity"] = jiraIssue.Priority; row["FixVersions"] = jiraIssue.FixVersions; string fixVersionsForUI = String.Empty; foreach (string versionUI in jiraIssue.FixVersions) { if (String.IsNullOrEmpty(fixVersionsForUI)) { fixVersionsForUI = versionUI; } else { fixVersionsForUI += "," + versionUI; } } row["FixVersionsForUI"] = fixVersionsForUI; row["JiraStatus"] = jiraIssue.Status; row["AssigneeDev"] = jiraIssue.Assignee; row["AssigneeQA"] = jiraIssue.AssigneeQA; row["Comments"] = jiraIssue.Comments; row["CemmentCount"] = jiraIssue.Comments.Count; row["ReleaseNote"] = jiraIssue.ReleaseNote; table.Rows.Add(row); } if (labelIndex < jiraLabelList.Length) { labelIndex++; table.Rows.Add(table.NewRow()); } } //DataView dataTableView = table.DefaultView; //dataTableView.Sort = "Severity ASC"; //table = dataTableView.ToTable(); grdCaseList.AutoGenerateColumns = false; grdCaseList.DataSource = table; this.btnSync.Enabled = true; }