private void btnMod_Click(object sender, System.EventArgs e) { if (lbxDB.SelectedIndex == -1) return; string s = lbxDB.Items[lbxDB.SelectedIndex].ToString(); string s1 = lbxDBString.Items[lbxDB.SelectedIndex].ToString(); // Add By Chenjian string dbType = lbxDbType.Items[lbxDB.SelectedIndex].ToString(); string odbcType = lbxOdbcType.Items[lbxDB.SelectedIndex].ToString(); string maxCount = lbxMaxCount.Items[lbxDB.SelectedIndex].ToString(); string timeOut = lbxTimeOut.Items[lbxDB.SelectedIndex].ToString(); string isMaster = lbxIsMaster.Items[lbxDB.SelectedIndex].ToString(); bool isEncrypt = (bool)lbxEncrypt.Items[lbxDB.SelectedIndex]; string pwd = lbxPwd.Items[lbxDB.SelectedIndex].ToString(); // End frmAddDB aForm = new frmAddDB(s, s1, dbType, true); aForm.DBName = s; aForm.DBString = s1; // Add By Chenjian aForm.Text = "Modify one EEP DataBase"; aForm.DBType = dbType; aForm.OdbcType = odbcType; aForm.MaxCount = maxCount; aForm.TimeOut = timeOut; aForm.Pwd = pwd; if (isMaster == "1") { aForm.IsMaster = true; } else { aForm.IsMaster = false; } aForm.IsEncrypt = isEncrypt; // End aForm.ShowDialog(); try { if (aForm.DialogResult == DialogResult.OK) { lbxDB.Items[lbxDB.SelectedIndex] = aForm.DBName; lbxDBString.Items[lbxDB.SelectedIndex] = aForm.DBString; // Add By Chenjian lbxDbType.Items[lbxDB.SelectedIndex] = aForm.DBType; lbxOdbcType.Items[lbxDB.SelectedIndex] = aForm.OdbcType; lbxMaxCount.Items[lbxDB.SelectedIndex] = aForm.MaxCount; lbxTimeOut.Items[lbxDB.SelectedIndex] = aForm.TimeOut; lbxEncrypt.Items[lbxDB.SelectedIndex] = aForm.IsEncrypt; if (aForm.IsMaster) { lbxIsMaster.Items.Add("1"); SetIsMasterAt(lbxDB.SelectedIndex); } else { lbxIsMaster.Items.Add("0"); ClearIsMasterAt(lbxDB.SelectedIndex); } lbxPwd.Items[lbxDB.SelectedIndex] = aForm.Pwd; // End this.bHasSaved = false; } } finally { aForm.Dispose(); } // Add By Chenjian lbxDB_SelectedIndexChanged(null, null); // End }
private void btnAdd_Click(object sender, System.EventArgs e) { frmAddDB aForm = new frmAddDB(); // Add By Chenjian aForm.Text = "Add one EEP DataBase"; aForm.DBType = "1"; aForm.MaxCount = "20"; aForm.TimeOut = "30"; // End aForm.ShowDialog(); try { if (aForm.DialogResult == DialogResult.OK) { lbxDB.Items.Add(aForm.DBName); lbxDBString.Items.Add(aForm.DBString); // Add By Chenjian lbxDbType.Items.Add(aForm.DBType); lbxOdbcType.Items.Add(aForm.OdbcType); lbxMaxCount.Items.Add(aForm.MaxCount); lbxTimeOut.Items.Add(aForm.TimeOut); lbxEncrypt.Items.Add(aForm.IsEncrypt); if (aForm.IsMaster) { lbxIsMaster.Items.Add("1"); SetIsMasterAt(lbxDB.Items.Count - 1); } else { lbxIsMaster.Items.Add("0"); ClearIsMasterAt(lbxDB.Items.Count - 1); } lbxPwd.Items.Add(aForm.Pwd); // End this.bHasSaved = false; } } finally { aForm.Dispose(); } }