private void btnDN_Click(object sender, EventArgs e) { try { // conn.Open(); string tk = txtDanhNhap.Text; string mk = txtMatKhau.Text; if (ConnectDatabase.Login(tk, mk)) { MessageBox.Show("Đăng nhập thành công", "Thông báo", MessageBoxButtons.OK); this.Hide(); Program.usernamelogin = tk; Program.frMain_main = new frmMain(); Program.frMain_main.Show(); } else { MessageBox.Show("Đăng nhập không thành công"); } } catch (Exception) { MessageBox.Show("Đăng nhập lỗi"); } }
private void btnLuu_Click_1(object sender, EventArgs e) { status.ForeColor = Color.Red; if (ConnectDatabase.Login(txtTenDN.Text, txtmatkhaucu.Text) == false) { status.Text = "Sai mật khẩu!!"; return; } if (txtmatkhaumoi.Text != txtnhaplaimatkhaumoi.Text) { status.Text = "Mật khẩu nhập lại không trùng khớp !!"; return; } ConnectDatabase.thayDoiMatKhau(txtTenDN.Text, txtmatkhaumoi.Text); status.ForeColor = Color.Blue; status.Text = "Đã đổi mật khẩu!"; }