private void fanhui_Click(object sender, EventArgs e) { this.Hide(); Super_Admin super_Admin = new Super_Admin(); super_Admin.ShowDialog(); this.Dispose(); }
//登录按钮点击事件 private void Denglu_Click(object sender, EventArgs e) { info.num = UserName.Text; try { if (Fa() == false) { return; } if (cbb_Type.Text == "管理员") { string UsN = UserName.Text; string Pwd = PassWord.Text; string cmdsql = string.Format("select * from userinfo_table where account_number='{0}' and password='******'", UsN, Pwd); SqlDataReader reader = DBHepler.GetDataReader(cmdsql); if (reader.Read()) { reader.Close(); //关闭连接对象 this.Hide(); //隐藏界面 Main One = new Main(); One.ShowDialog(); this.Dispose();//释放所有资源 } else { MessageBox.Show("账号或密码不正确!", "登录", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } reader.Close(); } if (cbb_Type.Text == "业主") { nom = UserName.Text; string Pwd = PassWord.Text; string cmdsql = string.Format("select * from Users where usersnum='{0}' and userspwd='{1}'", nom, Pwd); SqlDataReader reader = DBHepler.GetDataReader(cmdsql); if (reader.Read()) { reader.Close(); this.Hide(); Owner_User_Interface owner_User_Interface = new Owner_User_Interface(); owner_User_Interface.ShowDialog(); this.Dispose(); } else { MessageBox.Show("账号或密码不正确!", "登录", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } reader.Close(); } if (cbb_Type.Text == "超级管理员") { nom = UserName.Text; string Pwd = PassWord.Text; string cmdsql = string.Format("select * from Super_Admin where number='{0}' and Pwd='{1}'", nom, Pwd); SqlDataReader reader = DBHepler.GetDataReader(cmdsql); if (reader.Read()) { reader.Close(); this.Hide(); Super_Admin super_Admin = new Super_Admin(); super_Admin.ShowDialog(); this.Dispose(); } else { MessageBox.Show("账号或密码不正确!", "登录", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } reader.Close(); } if (!(cbb_Type.Text == "业主" || cbb_Type.Text == "管理员" || cbb_Type.Text == "超级管理员")) { MessageBox.Show("登录身份验证错误!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } } catch (Exception) { MessageBox.Show("登录身份验证错误!", "提示"); } }