public void loadMachineNames() { DBConnect dbc = new DBConnect(); ArrayList al = dbc.GetMachineNames(); machineNames.Items.Clear(); machineNames.Items.AddRange(al.ToArray()); machineNames.Text = Properties.Settings.Default.machinename; }
private bool TestDbConn() { DBConnect dbc = new DBConnect(); if (dbc.TestConnection()) { return true; } else { return false; } }
private void button3_Click(object sender, EventArgs e) { Properties.Settings.Default.username = dbuname.Text; Properties.Settings.Default.password = dbpwd.Text; Properties.Settings.Default.dbname = dbname.Text; Properties.Settings.Default.server = dbserver.Text; Properties.Settings.Default.dbport = dbport.Text; Properties.Settings.Default.Save(); DBConnect dbc1 = new DBConnect(); if (dbc1.TestConnection()) { MessageBox.Show("DB Connection Successful! Settings Saved"); loadMachineNames(); } else { MessageBox.Show("DB Connection Failed!"); } }
private void PopulateComboBoxes() { string macName = Properties.Settings.Default.machinename; DBConnect dbc = new DBConnect(); ArrayList partNames = dbc.GetPartNames(macName,this.cat); ArrayList OperNames = dbc.GetOperationNames(macName); foreach (ComboBox cb in parts) { cb.Items.Clear(); cb.Items.AddRange(partNames.ToArray()); } foreach (ComboBox cb in opr) { cb.Items.Clear(); cb.Items.AddRange(OperNames.ToArray()); } }
private void SetTarget(object sender, EventArgs e) { DBConnect dbc = new DBConnect(); ComboBox cb = (ComboBox)sender; string tblindx = cb.Name.Substring(1, 1); string rowindx = cb.Name.Substring(5, 1); string partname = "t" + tblindx + "part" + rowindx; string trgtname = "t" + tblindx + "trgt" + rowindx; Control[] box = this.Controls.Find(partname,true); ComboBox prt = box[0] as ComboBox; Control[] trgtArr = this.Controls.Find(trgtname, true); TextBox trgt = trgtArr[0] as TextBox; string macName = Properties.Settings.Default.machinename; if (prt.Text != string.Empty && cb.Text != string.Empty) { trgt.Text = dbc.GetTarget(macName, prt.Text, cb.Text, appCat); } }
private void PopulateOperation(object sender, EventArgs e) { ArrayList ops; DBConnect dbc = new DBConnect(); ComboBox cb = (ComboBox)sender; string partNme = cb.Text; string macNme = Properties.Settings.Default.machinename; ops = dbc.GetOperationNames(macNme, partNme, appCat); ComboBox opBox = (ComboBox)partOps[sender]; opBox.Items.Clear(); opBox.Items.AddRange(ops.ToArray()); string tblindx = cb.Name.Substring(1, 1); string rowindx = cb.Name.Substring(6, 1); string trgtname = "t" + tblindx + "trgt" + rowindx; Control[] trgtArr = this.Controls.Find(trgtname, true); TextBox trgt = trgtArr[0] as TextBox; trgt.Text = string.Empty; }