private async void btnRequest_Click(object sender, EventArgs e) { // this.btnRequest.Enabled = false; string sfid = this.txtSFID.Text; string engsuppKey = this.txtEngsuppID.Text; string currentVersion = this.txtVersion.Text; string product = this.txtProduct.Text; string contact = this.txtCaseOwner.Text; string priority = this.txtPriority.Text; string siteUr = this.txtSiteUrl.Text; string issueSubject = this.txtIssueSubject.Text; string customerInfo = this.txtCustomerInfo.Text; string dbType = this.txtDBType.Text; string dbIP = this.txtDBServerIP.Text; string dbPort = this.txtDBServerPort.Text; string dbInstance = this.txtDBInstance.Text; string dbUserName = this.txtDBUser.Text; string dbUserPassword = this.txtDBPassword.Text; string dbVersion = this.txtDBVersion.Text; string dbRelatedCase = this.txtRelatedCase.Text; string enviroment = ""; string reviewer = this.txtReviewer.Text; if (this.txtSiteUrl.Text.Trim().IndexOf(".accela.com") == -1) { MessageBox.Show("Please specify the client's site url where this case could be recreated.\n For example: https://av.supp3.accela.com/ "); this.btnRequest.Enabled = true; return; } if (chbAccelaHostedFlag.Checked) { if (this.chbProductionFlag.Checked) { enviroment += "<<Production>>"; } if (this.chbSupportFlag.Checked) { enviroment += "<<Support>>"; } if (this.chbTestFlag.Checked) { enviroment += "<<Test>>"; } if (this.chbJetspeed.Checked) { enviroment += "<<Jetspeed>>"; } if (String.IsNullOrEmpty(enviroment)) { MessageBox.Show("Please specify which database enviroment you would request. For example, production, support or test or jetspped"); this.btnRequest.Enabled = true; return; } } else { MessageBox.Show("Please double check if this customer is Accela hosted. If yes, please tick the checkbox beside Accela Hosted field."); this.btnRequest.Enabled = true; return; } string summary = "Request one fresh database dump for [" + customerInfo + "] - " + sfid; string description1 = @" Hi [[email protected]], Please kindly help to get one fresh database dump pings to {0} for <<{1}>> which is Accela hosted, because we could not reproduce the problem on our local site. The problem might exists on their latest {2} enviroment. Custom Info: --------------------------------------------------------- Salesforce ID: {3} ENGSUPP Key: {4} Customer: {5} Current Version: {6} Product: {7} Contact:{8} Priority: {9} Issue Subject: {10} --------------------------------------------------------- After the fresh database dump is ready, please put it under Accela ftp server. The path should like ftp://ftp.accela.com/BIN/MISSIONSKY/XXXXX-XXXXX, and then re-assign this jira ticket to [~{11}] who will download it in Missionsky. Any further question, please let us know. Thanks you very much! CC [[email protected]] [[email protected]] [[email protected]] [~{11}]"; description1 = String.Format(description1, siteUr, customerInfo, enviroment, sfid, engsuppKey, customerInfo, currentVersion, product, contact, priority, issueSubject, reviewer ); IssueFields fields = new IssueFields(); fields.summary = summary; fields.description = description1; var GetDBTaskBySFID = JiraProxy.GetDatabaseTaskByCaseID("DATABASE", "Task", sfid); var GetDatabaseTaskByCustomerID = JiraProxy.GetDatabaseTaskByCustomerID("DATABASE", "Task", customerInfo); var taskInfoByCaseId = await GetDBTaskBySFID; var taskInfoByCustomerId = await GetDatabaseTaskByCustomerID; if (taskInfoByCaseId != null || taskInfoByCustomerId != null) { var taskInfo = taskInfoByCaseId; if (taskInfo == null) { taskInfo = taskInfoByCustomerId; } taskInfo.fields = fields; JiraProxy.UpdateDatabaseTask(taskInfo); this.txtDatabaseID.Text = taskInfo.key; MessageBox.Show("The database request ticket already exists, please refer to " + taskInfo.key); showCaseComment(engsuppKey, taskInfo.key); } else { var issue = await JiraProxy.CreateDatabaseTask(fields); this.txtDatabaseID.Text = issue.key; // 2 - Critical // 7 - High // 6 - Medium // 8 - Low issue.fields.Priority = new IssuePriority(); issue.fields.Priority.name = priority; JiraProxy.UpdateDatabaseTask(issue); showCaseComment(engsuppKey, issue.key); IssueRef engIssue = new IssueRef(); engIssue.key = engsuppKey; engIssue.id = engsuppKey; JiraProxy.CreateComment(engIssue, String.Format("One jira ticket is already submitted to Accela DBA for the most recent database dump, because the reported issue might be data-related based on the research. The ticket key is {0}. Thank you for your patience", issue.key)); } this.btnRequest.Enabled = true; }