Ejemplo n.º 1
0
        private void btnQuayLai_Click(object sender, EventArgs e)
        {
            MenuQuanLy menuQuanTri = new MenuQuanLy();

            menuQuanTri.Show();
            this.Hide();
        }
Ejemplo n.º 2
0
        private void btTroVe_Click(object sender, EventArgs e)
        {
            MenuQuanLy frmQuanLy = new MenuQuanLy();

            frmQuanLy.Show();
            this.Hide();
        }
Ejemplo n.º 3
0
 private void btnDangNhap_Click(object sender, EventArgs e)
 {
     try
     {
         String taiKhoan = txtTaiKhoan.Text.Trim();
         String matKhau  = txtMatKhau.Text.Trim();
         Single role;
         if (taiKhoan.Equals("") || matKhau.Equals(""))
         {
             MessageBox.Show("Vui lòng không để trống!", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
             return;
         }
         if (rdNhanVien.Checked)
         {
             role = 0;
         }
         else
         {
             role = 1;
         }
         if (role == 0)
         {
             NhanVienDAO nhanVienDao = new NhanVienDAO();
             if (nhanVienDao.checkExistAccNV(taiKhoan, matKhau))
             {
                 this.Hide();
                 MenuNhanVien frmMenuNV = new MenuNhanVien(taiKhoan);
                 frmMenuNV.Show();
             }
             else
             {
                 MessageBox.Show("Tài khoản hoặc mật khẩu không đúng.Thử lại!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
             return;
         }
         if (role == 1)
         {
             AdminDAO adminDao = new AdminDAO();
             if (adminDao.checkExistAccAdmin(taiKhoan, matKhau))
             {
                 this.Hide();
                 MenuQuanLy frmMenuQL = new MenuQuanLy(taiKhoan);
                 frmMenuQL.Show();
             }
             else
             {
                 MessageBox.Show("Tài khoản hoặc mật khẩu không đúng.Thử lại!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
             return;
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }