private void btnDangNhap_Click(object sender, EventArgs e)
        {
            try
            {
                if (dn.LayTaiKhoan(txtTaiKhoan.Text, txtMatKhau.Text) == 1 && dn.LayTrangThai(txtTaiKhoan.Text, txtMatKhau.Text) == "Hoạt động")
                {
                    TenNVDangChon   = dn.LayTenNV(txtTaiKhoan.Text, txtMatKhau.Text);
                    QuyenNVDangChon = dn.LayQuyenNV(txtTaiKhoan.Text, txtMatKhau.Text);
                    MaNVDangChon    = dn.LayMaNV(txtTaiKhoan.Text, txtMatKhau.Text);
                    TenTK           = txtTaiKhoan.Text;

                    MessageBox.Show("Đăng nhập thành công", "Thông báo");
                    this.Hide();
                    frm_TrangChu h = new frm_TrangChu();
                    h.TenNV = TenNVDangChon;
                    h.Quyen = QuyenNVDangChon;
                    h.TK    = MaNVDangChon;
                    h.TenDN = TenTK;
                    h.ShowDialog();
                    this.Hide();
                }
                else if (dn.LayTaiKhoan(txtTaiKhoan.Text, txtMatKhau.Text) == 1 && dn.LayTrangThai(txtTaiKhoan.Text, txtMatKhau.Text) == "Tạm ngưng")
                {
                    MessageBox.Show("Tài khoản đã bị khóa", "Thông báo");
                }
                else
                {
                    MessageBox.Show("Sai Tên Đăng Nhập Hoặc Mật Khẩu!");
                }
            }
            catch
            {
            }
        }
Esempio n. 2
0
        private void btn_Thoat_Click(object sender, EventArgs e)
        {
            DialogResult traloi;

            traloi = MessageBox.Show("Bạn có chắc muốn thoát không?", "Trả lời",
                                     MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
            if (traloi == DialogResult.OK)
            {
                this.Hide();
                frm_TrangChu tc = new frm_TrangChu();
                tc.ShowDialog();
            }
        }