Пример #1
0
        private void txtMaNhanVien_TextChanged(object sender, EventArgs e)
        {
            BULNhanVien     bul = new BULNhanVien();
            List <NhanVien> arr = bul.layNhanVien();

            for (int i = 0; i < arr.Count; i++)
            {
                if (arr[i].MaNhanVien + "" == txtMaNhanVien.Text)
                {
                    txtTenNhanVien.Text = arr[i].TenNhanVien;
                    txtTaiKhoan.Text    = arr[i].TenTaiKhoan;
                    txtSoDienThoai.Text = arr[i].SoDienThoai;

                    txtChungMinhThu.Text = arr[i].ChungMinhThu;
                    BULTaiKhoan bultk = new BULTaiKhoan();
                    txtMatKhau.Text = bultk.layTaiKhoanTheoTenTK(txtTaiKhoan.Text)[0].MatKhau;
                    cbQuyen.Text    = bultk.layTaiKhoanTheoTenTK(txtTaiKhoan.Text)[0].Quyen;
                    break;
                }
                else
                {
                    txtTenNhanVien.Text = "";
                    txtTaiKhoan.Text    = "";
                    txtSoDienThoai.Text = "";

                    txtChungMinhThu.Text = "";

                    txtMatKhau.Text = "";
                }
            }
        }
Пример #2
0
        private void btnDangNhap_Click(object sender, EventArgs e)
        {
            TaiKhoan    tk  = new TaiKhoan(txtTaiKhoan.Text, txtMatKhau.Text);
            BULTaiKhoan bul = new BULTaiKhoan();

            if (bul.dangNhap(tk))
            {
                BULNhanVien bulNV = new BULNhanVien();
                frmSieuThi.nv = bulNV.layNhanVienTheoTaiKhoan(txtTaiKhoan.Text);
                frmSieuThi.tk = bul.layTaiKhoanTheoTenTK(txtTaiKhoan.Text)[0];
                frmST.Show();
                this.Visible = false;
            }
            else
            {
                MessageBox.Show("Sai tài khoản - mật khẩu");
            }
        }