private void LoadEnvironments() { EntityBusiness edata = new EntityBusiness(); var serverlist = edata.GetServerList().ToList(); if (serverlist != null) { _envlist = serverlist; foreach (var s in serverlist) { ToolStripItem item = new ToolStripMenuItem(); item.Text = s.DbAlias; item.Name = s.ServerID.ToString(); item.Click += new EventHandler(item_Click); tsbtnExeOn.DropDownItems.Add(item); ToolStripItem item2 = new ToolStripMenuItem(); item2.Text = s.DbAlias; item2.Name = s.ServerID.ToString(); item2.Click += new EventHandler(itemcheck_Click); tsbtnExeOnSelected.DropDownItems.Add(item2); } } ToolStripSeparator tsSeparator = new ToolStripSeparator(); tsbtnExeOn.DropDownItems.Add(tsSeparator); ToolStripItem itemall = new ToolStripMenuItem(); itemall.Text = "All Environments"; itemall.Name = "all"; itemall.Click += new EventHandler(item_Click); tsbtnExeOn.DropDownItems.Add(itemall); }
void LoadExistingServers() { EntityBusiness business = new EntityBusiness(); var servers = business.GetServerList(); cmbServerName.DisplayMember = "ServerName"; cmbServerName.ValueMember = "ServerID"; cmbServerName.DataSource = servers; cmbServerName.SelectedIndex = -1; }
void LoadDataBases() { EntityBusiness edata = new EntityBusiness(); var serverlist = edata.GetServerList(); //Column5.DisplayMember = "Database"; //Column5.ValueMember = "ServerID"; Column3.DataSource = serverlist; DataGridViewComboBoxColumn ComboColumn = (DataGridViewComboBoxColumn)(dataGridView1.Columns[2]); ComboColumn.DataSource = serverlist; ComboColumn.DisplayMember = "Database"; ComboColumn.ValueMember = "ServerID"; }
public void LoadDatabases() { cmbDatabase.SelectedIndexChanged -= cmbDatabase_SelectedIndexChanged; EntityBusiness entityBusiness = new EntityBusiness(); var dbs = entityBusiness.GetServerList(); cmbDatabase.ComboBox.DisplayMember = "DbAlias"; cmbDatabase.ComboBox.ValueMember = "ServerID"; cmbDatabase.ComboBox.DataSource = dbs; string mainserver = new ConfigurationHelper().GetConfigurationValue("mainserver"); //string mainserver = System.Configuration.ConfigurationSettings.AppSettings["mainserver"]; if (mainserver != "0" && mainserver != "") cmbDatabase.ComboBox.SelectedValue = Convert.ToInt32(mainserver); else cmbDatabase.ComboBox.SelectedIndex = -1; cmbDatabase.SelectedIndexChanged += cmbDatabase_SelectedIndexChanged; }
private void tscomserver_SelectedIndexChanged(object sender, EventArgs e) { try { if (tscomserver.ComboBox.Items.Count > 0) { if (tscomserver.ComboBox.SelectedIndex != -1) { int id = Convert.ToInt32(tscomserver.ComboBox.SelectedValue); EntityBusiness data = new EntityBusiness(); var servers = data.GetServerList(); maindb = servers.Where(x => x.ServerID == id).FirstOrDefault(); LoadTables(); } } } catch (Exception ex) { MessageBox.Show(ex.Message, "Exception", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public void LoadDatabases() { tscomserver.SelectedIndexChanged -= tscomserver_SelectedIndexChanged; EntityBusiness entityBusiness = new EntityBusiness(); var dbs = entityBusiness.GetServerList(); tscomserver.ComboBox.DisplayMember = "DbAlias"; tscomserver.ComboBox.ValueMember = "ServerID"; tscomserver.ComboBox.DataSource = dbs; string mainserver = new ConfigurationHelper().GetConfigurationValue("mainserver"); if (mainserver != "0" && mainserver != "") { tscomserver.ComboBox.SelectedValue = Convert.ToInt32(mainserver); maindb = dbs.Where(x => x.ServerID == Convert.ToInt32(mainserver)).FirstOrDefault(); //LoadOtherDBs(dbs, Convert.ToInt32(mainserver)); } else { tscomserver.ComboBox.SelectedIndex = -1; //LoadOtherDBs(dbs, 0); } tscomserver.SelectedIndexChanged += tscomserver_SelectedIndexChanged; }
void LoadDataBases() { EntityBusiness edata = new EntityBusiness(); var serverlist = edata.GetServerList(); DataGridViewComboBoxColumn colsource = (DataGridViewComboBoxColumn)(dgvSP.Columns[5]); colsource.DataSource = serverlist; colsource.DisplayMember = "Database"; colsource.ValueMember = "ServerID"; DataGridViewComboBoxColumn colto = (DataGridViewComboBoxColumn)(dgvSP.Columns[6]); colto.DataSource = serverlist; colto.DisplayMember = "Database"; colto.ValueMember = "ServerID"; }
private void frmHome_Load(object sender, EventArgs e) { try { LoadDatabases(); string serverid = new ConfigurationHelper().GetConfigurationValue("mainserver"); EntityBusiness data = new EntityBusiness(); var servers = data.GetServerList(); var server = servers.Where(x => x.ServerID == Convert.ToInt32(serverid)).FirstOrDefault(); if (server != null) { AppTimeConfiguration.MainServer = server; } } catch (Exception ex) { MessageBox.Show(ex.Message, "Exception", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void cmbDatabase_SelectedIndexChanged(object sender, EventArgs e) { try { if (cmbDatabase.ComboBox.Items.Count > 0) { if (cmbDatabase.ComboBox.SelectedIndex != -1) { int id = Convert.ToInt32(cmbDatabase.ComboBox.SelectedValue); EntityBusiness data= new EntityBusiness(); var servers = data.GetServerList(); AppTimeConfiguration.MainServer = servers.Where(x => x.ServerID == id).FirstOrDefault(); new ConfigurationHelper().AddConfiguration("mainserver",id.ToString()); } } } catch (Exception ex) { MessageBox.Show(ex.Message, "Exception", MessageBoxButtons.OK, MessageBoxIcon.Error); } }