public override bool Execute(out string message) { string resultMessage; bool result = false; Application app = this.BizTalkInfo.CatalogExplorer.Applications[this.ApplicationInfo.ApplicationName]; //try //{ // Application app = this.BizTalkInfo.CatalogExplorer.Applications[this.ApplicationInfo.ApplicationName]; // this.BizTalkInfo.CatalogExplorer.re // this.BizTalkInfo.CatalogExplorer.RemoveApplication(this.BizTalkInfo.CatalogExplorer.Applications[this.ApplicationInfo.ApplicationName]); // message = string.Format("Application deleted successfully. \r\n{0}"); // result = true; //} //catch (Exception exe) //{ // result = false; // message = string.Format("Application can not be deleted. \r\n{0}", exe.Message); //} result = BTSTaskHelper.DeleteApp(this.ApplicationInfo.ApplicationName, out resultMessage); if (result) { message = string.Format("Application:{0} deleted successfully. \r\n{1}", this.ApplicationInfo.ApplicationName, resultMessage); } else { message = string.Format("Application:{0} can not be deleted. \r\n{1}", this.ApplicationInfo.ApplicationName, resultMessage); } return(result); }
private void btnDelete_Click(object sender, EventArgs e) { this.Cursor = Cursors.WaitCursor; try { richTextBox1.Text = string.Empty; richTextBox1.Visible = true; BTSTaskHelper btstaskHelper = new BTSTaskHelper(this.BTServerInstallLoc); string result = btstaskHelper.DeleteApp(txtAppName.Text); richTextBox1.AppendText(result); } catch (Exception exe) { MessageBox.Show(exe.Message); } this.Cursor = Cursors.Default; }
private void btnfullDeploy_Click(object sender, EventArgs e) { this.Cursor = Cursors.WaitCursor; string result; richTextBox1.Text = string.Empty; richTextBox1.Visible = true; try { ExplorerOMHelper explorerHelper = new ExplorerOMHelper(this.DBServerName); BTSTaskHelper btsTaskHelper = new BTSTaskHelper(this.BTServerInstallLoc); DateTime tStart = DateTime.Now; writeLog("Checking for suspended Instances....."); bool IsInstance = explorerHelper.HasInProgressInstance(txtAppName.Text); if (IsInstance == true) { MessageBox.Show("Process aborted, Instance exists"); //stop process } else { writeLog("No suspended Instances.....Restarting associated hosts....."); bool HostsRestarted = explorerHelper.RestartHostInstance(txtAppName.Text); writeLog("Restarted associated hosts: " + HostsRestarted.ToString()); if (explorerHelper.HasDynamicSendPorts(txtAppName.Text)) { richTextBox1.SelectionFont = new Font(richTextBox1.Font, FontStyle.Bold); writeLog("..Dynamic send ports exists for the application. Manual intervention required to restart associated send handlers' hosts...."); } richTextBox1.SelectionFont = new Font(richTextBox1.Font, FontStyle.Regular); writeLog("Stopping application....."); explorerHelper.StopApp(txtAppName.Text); writeLog("Stopped application.....Deleting application....."); result = btsTaskHelper.DeleteApp(txtAppName.Text); writeLog(result); writeLog("Deleted application.....UnInstalling application....."); string UnInstallmessage = GenericHelper.UninstallApplication(txtAppName.Text, IdentifyingNumber, "1.0.0.0"); writeLog("Uninstalling application done:" + UnInstallmessage); if (!UnInstallmessage.Contains("error")) { writeLog("Installing application....."); string Installmessage = GenericHelper.InstallApplication(TempLocation, txtMSILocation.Text); writeLog("Installing application done:" + Installmessage); if (!Installmessage.Contains("error")) { writeLog("Importing application....."); result = btsTaskHelper.ImportApp(txtAppName.Text, txtMSILocation.Text, Env); writeLog(result); writeLog("Imported application.....Starting application....."); explorerHelper.StartApp(txtAppName.Text); writeLog("Started application....."); if (chkBxSSO.Checked == true) { if (!String.IsNullOrEmpty(txtSSOConfigLoc.Text)) { string exceptionMessage; bool boolresult = SSOHelper.ImportSSOconfig(SSOKey, txtSSOConfigLoc.Text, txtConfigAppName.Text, String.Format("BizTalkAdmin@{0}.com", SSOCompanyName), true, out exceptionMessage); if (boolresult) { writeLog("Successfully redeployed SSOconfig and refreshed cache."); } else { writeLog("Error is importing SSOconfig. Manual intervension required"); } } else { richTextBox1.SelectionFont = new Font(richTextBox1.Font, FontStyle.Bold); writeLog("No SSO Config file selected....Select file and Deploy SSO separately now.."); richTextBox1.SelectionFont = new Font(richTextBox1.Font, FontStyle.Regular); } } if (chkBxIIS.Checked == true) { string RestartIISMes = GenericHelper.RestartIIS(); if (!RestartIISMes.Contains("error")) { writeLog(RestartIISMes); } else { richTextBox1.SelectionFont = new Font(richTextBox1.Font, FontStyle.Bold); writeLog(RestartIISMes + "Manual Intervention required.."); richTextBox1.SelectionFont = new Font(richTextBox1.Font, FontStyle.Regular); } } DateTime tStop = DateTime.Now; TimeSpan tPass = tStop - tStart; this.Cursor = Cursors.Default; MessageBox.Show("Done in time: " + tPass.ToString()); } else { MessageBox.Show("Process aborted, Installing application failed"); //stop process } } else { MessageBox.Show("Process aborted, UnInstalling application failed"); //stop process } } } catch (Exception exe) { this.Cursor = Cursors.Default; MessageBox.Show(exe.Message); } }