private void Services_Load(object sender, EventArgs e) { allServers.AddRange(MSBTS_Server.GetMessagingServers()); allServers.Add(MSBTS_MsgBoxSetting.GetDatabaseServerName()); allServers = allServers.Distinct().ToList(); foreach (var server in allServers) { TreeNode serverNode = treeView1.Nodes[0].Nodes.Add(server); serverNode.ContextMenuStrip = contextMenuStrip2; } treeView1.ExpandAll(); }
private static DataTable GetAllServiceInstances(string query) { DataTable dt = new DataTable(); using (SqlConnection conn = new SqlConnection(String.Format(Constants._DB_CONN_STRING, GlobalProperties.DatabaseServer, MSBTS_MsgBoxSetting.GetDatabaseName()))) { using (SqlCommand command = new SqlCommand(query, conn)) { command.Connection.Open(); SqlDataAdapter dataAdapter = new SqlDataAdapter(command); dataAdapter.Fill(dt); } } return(dt); }
private static bool HasInProgressInstanceSQLQuery(string query, out int numberOfInstances) { bool retValue = false; using (SqlConnection conn = new SqlConnection(String.Format(Constants._DB_CONN_STRING, GlobalProperties.DatabaseServer, MSBTS_MsgBoxSetting.GetDatabaseName()))) { using (SqlCommand command = new SqlCommand(query, conn)) { command.Connection.Open(); numberOfInstances = (int)command.ExecuteScalar(); if (numberOfInstances > 0) { retValue = true; } } } return(retValue); }