private void btnLuu_Click(object sender, EventArgs e) { if (Them) { if (this.txtTaiKhoan.Text == "") { epvTaiKhoan.SetError(this.txtTaiKhoan, "!"); MessageBox.Show("Bạn chưa nhập Tài khoản!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning); epvTaiKhoan.Clear(); this.txtTaiKhoan.Focus(); } else if (dbLogin.KiemTraTaiKhoanTonTai(this.txtTaiKhoan.Text, ref err) == true) { epvTaiKhoan.SetError(this.txtTaiKhoan, "!"); MessageBox.Show("Tài khoản đã tồn tại!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning); epvTaiKhoan.Clear(); txtTaiKhoan.Focus(); } else { if (dbLogin.ThemLogin(this.txtTaiKhoan.Text.Trim(), this.txtMatKhau.Text.Trim(), this.mskPhone.Text, this.txtEmail.Text, this.cboQuyen.Text, ref err)) { LoadData(); MessageBox.Show("Đã thêm xong!"); } else { MessageBox.Show("Không thêm được. Lỗi rồi!!! " + err); } } } else { if (dbLogin.CapNhatLogin(this.txtTaiKhoan.Text, this.txtMatKhau.Text.Trim(), this.mskPhone.Text, this.txtEmail.Text, this.cboQuyen.Text, ref err)) { LoadData(); MessageBox.Show("Đã sửa xong!"); } else { MessageBox.Show("Không sửa được. Lỗi rồi!!! " + err); } } }