示例#1
0
        private void btDangNhap_Click(object sender, EventArgs e)
        {
            TaiKhoan_DTO tk = new TaiKhoan_DTO();

            if (txtMatKhau.Text == "" || txtTaiKhoan.Text == "")
            {
                MessageBox.Show("Vui long khong de trong tai khoan hoac mat khau");
            }
            else
            {
                tk.TaiKhoan = txtTaiKhoan.Text;
                tk.MatKhau  = txtMatKhau.Text;
                if (busTaiKhoan.DangNhap(tk))
                {
                    FrmMain.taikhoan = tk.TaiKhoan;
                    DataTable dt = busTaiKhoan.KiemTraQuyen(tk.TaiKhoan);
                    Quyen = dt.Rows[0][0].ToString();
                    MessageBox.Show("Đăng nhập thành công");
                    FrmMain.session = 1;
                    this.Close();
                }
                else
                {
                    MessageBox.Show("Đăng nhập không thành công, kiểm tra lại email hoặc mật khẩu");
                    txtTaiKhoan.Text = null;
                    txtMatKhau.Text  = null;
                    txtTaiKhoan.Focus();
                }
            }
        }