private void btnDong_Click(object sender, EventArgs e)
        {
            FrmDangNhap log = new FrmDangNhap();

            this.Close();
            log.Show();
        }
        private void btnDangNhap_Click(object sender, EventArgs e)
        {
            FrmDangNhap dangnhap = new FrmDangNhap();

            this.Hide();
            dangnhap.ShowDialog();
            this.Close();
        }
        private void btnDangNhap_Click(object sender, EventArgs e)
        {
            Dangnhap    user = Dangnhap.getUser();
            FrmDangNhap log  = new FrmDangNhap();

            if (txtUser.Text == "" & txtPassword.Text == "")
            {
                lblGhiChu.Text = "Bạn chưa nhập user";
                lblGhiChu.Show();
                lbGhiChu2.Text = "Bạn chưa nhập mật khẩu";
                lbGhiChu2.Show();
            }
            else if (txtUser.Text == "" || txtPassword.Text != "")
            {
                lblGhiChu.Text = "Bạn chưa nhập user";
                lblGhiChu.Show();
                lbGhiChu2.Text = "";
                lbGhiChu2.Show();
            }
            else if (txtUser.Text != "" || txtPassword.Text == "")
            {
                lbGhiChu2.Text = "Bạn chưa nhập mật khẩu";
                lbGhiChu2.Show();
                lblGhiChu.Text = "";
                lblGhiChu.Show();
            }
            else
            {
                if (user.Dangnhap1(txtUser.Text, txtPassword.Text) == true)
                {
                    FrmDashboard bang = new FrmDashboard();
                    this.Hide();
                    bang.ShowDialog();
                    this.Close();
                }
                else
                {
                    MessageBox.Show("Tên đăng nhập hoặc mật khẩu không đúng!");
                }
            }
        }
        private void btnDangKy_Click(object sender, EventArgs e)
        {
            Connect();
            try
            {
                cn = new SqlConnection(cnStr);
                cn.Open();
                cmd = new SqlCommand("uspDangNhap", cn);
                if (txtXNpass.Text == txtPassword.Text && txtPassword.Text != null && txtXNpass.Text != null)
                {
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Connection  = cn;
                    cmd.Parameters.AddWithValue("@UserName", txtUser.Text.Trim());
                    cmd.Parameters.AddWithValue("@Password", txtPassword.Text.Trim());


                    cmd.ExecuteNonQuery();
                    MessageBox.Show("ĐĂNG KÝ THÀNH CÔNG", "thong bao");
                    FrmDangNhap dangnhap = new FrmDangNhap();
                    this.Hide();
                    dangnhap.ShowDialog();
                }
                else if (txtXNpass.Text != txtPassword.Text || txtPassword.Text == null || txtXNpass.Text == null)
                {
                    MessageBox.Show("nhập đúng mật khẩu và không bỏ trống");
                }
            }
            catch (SqlException ex)
            {
                MessageBox.Show(ex.Message);
                //throw;
            }
            finally
            {
                Disconnect();
            }
        }