private void btnRestartHost_Click(object sender, EventArgs e) { this.Cursor = Cursors.WaitCursor; try { ExplorerOMHelper explorerHelper = new ExplorerOMHelper(this.DBServerName); bool retVal = explorerHelper.RestartHostInstance(txtAppName.Text); MessageBox.Show("Restarted associated hosts: " + retVal.ToString()); } catch (Exception exe) { MessageBox.Show("An error occurred while trying to execute the WMI method: " + exe.Message); } this.Cursor = Cursors.Default; }
private void btnStart_Click(object sender, EventArgs e) { this.Cursor = Cursors.WaitCursor; try { ExplorerOMHelper explorerOMhelper = new ExplorerOMHelper(this.DBServerName); explorerOMhelper.StartApp(txtAppName.Text); MessageBox.Show("Application started successfully"); } catch (Exception exe) { MessageBox.Show(exe.Message); } this.Cursor = Cursors.Default; }
private void btnChkInstances_Click(object sender, EventArgs e) { this.Cursor = Cursors.WaitCursor; try { ExplorerOMHelper explorerHelper = new ExplorerOMHelper(this.DBServerName); bool isExists = explorerHelper.HasInProgressInstance(txtAppName.Text); if (isExists == false) { MessageBox.Show("No Suspended instance for the given application: " + txtAppName.Text); } if (isExists == true) { MessageBox.Show("Suspended instance exists for the given application: " + txtAppName.Text); } } catch (Exception exe) { MessageBox.Show("An error occurred while querying for WMI data: " + 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); } }