private bool VerifyUser() { bool verify = false; UserBL ubl = new UserBL(); User user = ubl.GetUser(userName); if (user != null) { if (pwd.Equals(user.Pwd)) { System.Diagnostics.Debug.WriteLine("用户[" + userName + "]登录成功!"); verify = true; } else { MessageBox.Show("用户[" + userName + "]密码错误!"); this.kryTbxPwd.Clear(); this.kryTbxPwd.Focus(); } } else { MessageBox.Show("用户[" + userName + "]不存在!"); this.kryTbxUserName.Clear(); this.kryTbxPwd.Clear(); this.kryTbxUserName.Focus(); } return verify; }
private void kryBtnSel_Click(object sender, EventArgs e) { int selIndex = this.kryCbxSel.SelectedIndex; switch (selIndex) { case 0: { UserBL bl = new UserBL(); List<User> users = bl.GetUsers(); this.bindSrcUsers.DataSource = users; kryDgvMng.DataSource = this.bindSrcUsers; break; } case 1: { DbConnBL bl = new DbConnBL(); List<DbConn> conns = bl.GetDbConns(); this.bindSrcDbConns.DataSource = conns; kryDgvMng.DataSource = this.bindSrcDbConns; break; } case 2: { SqlSentenceBL bl = new SqlSentenceBL(); List<SqlSentence> sqls = bl.GetSqls(); this.bindSrcSqls.DataSource = sqls; kryDgvMng.DataSource = this.bindSrcSqls; break; } default: KryptonMessageBox.Show("请选择配置表!"); break; } }