public ActionResult ChinhsuaTK(TaiKhoanViewModel tk)
 {
     ViewBag.MaNV    = new SelectList(NhanVienQueries.LayDanhSachNhanVien(), "MaNV", "HoTen", tk.MaNV);
     ViewBag.MaQuyen = new SelectList(QuyenQueries.LayDanhSachQuyen(), "MaQuyen", "TenQuyen", tk.MaQuyen);
     TaiKhoanQueries.ChinhsuaTaiKhoan(tk);
     return(RedirectToAction("MenuDanhSachTaiKhoan", "TaiKhoan"));
 }
        public ActionResult DoiMatKhau(TaiKhoanViewModel TaiKhoan, String MatKhauCu, String MatKhauMoi)
        {
            var model = TaiKhoanQueries.LayThongTinTaiKhoan(TaiKhoan.TaiKhoanNV);
            int i = 0, j = 0;
            var check = TaiKhoanQueries.Login(TaiKhoan.TaiKhoanNV, MatKhauCu);

            if (check == null)
            {
                ViewBag.MatKhauSai = "Mật khẩu không đúng";
                i++;
            }
            else
            {
                i = 0;
            }
            if (TaiKhoan.MatKhau != MatKhauMoi)
            {
                ViewBag.MatKhauTrung = "Mật khẩu không trùng";
                j++;
            }
            else
            {
                j = 0;
            }
            if (i == 0 && j == 0)
            {
                TaiKhoanQueries.DoiMatKhau(TaiKhoan);
                ViewBag.Success = "Đổi thành công!!";
            }
            return(View(model));
        }
        public ActionResult ChinhsuaTK(string id)
        {
            var tk = TaiKhoanQueries.LayChiTietTaiKhoan(id);

            ViewBag.MaNV    = new SelectList(NhanVienQueries.LayDanhSachNhanVien(), "MaNV", "HoTen", tk.MaNV);
            ViewBag.MaQuyen = new SelectList(QuyenQueries.LayDanhSachQuyen(), "MaQuyen", "TenQuyen", tk.MaQuyen);
            return(View(tk));
        }
        public ActionResult LockScreen(string TaiKhoanNV, string MatKhau)
        {
            var model = TaiKhoanQueries.Login(TaiKhoanNV, MatKhau);

            if (model != null)
            {
                Session["TaiKhoan"] = model;
                return(RedirectToAction("MenuLichTheoNgay", "Home"));
            }
            ViewBag.ThongBao = "Tài khoản hoặc mật khẩu sai! Vui lòng nhập lại...";
            return(View());
        }
        public ActionResult MenuTaoTaiKhoan(TaiKhoanViewModel taiKhoan)
        {
            var model = NhanVienQueries.LayDanhSachNhanVien();

            ViewBag.Quyen = QuyenQueries.LayDanhSachQuyen();
            if (!TaiKhoanQueries.TaoTaiKhoan(taiKhoan))
            {
                ViewBag.TrungTK   = "Tài khoản đã được sử dụng";
                ViewBag.ThanhCong = "Tạo tài khoản thất bại";
                return(View(model));
            }
            else
            {
                TaiKhoanQueries.TaoTaiKhoan(taiKhoan);
                ViewBag.ThanhCong = "Tạo tài khoản thành công";
                return(View(model));
            }
        }
 public ActionResult DangNhap(DangNhapViewModel model)
 {
     if (ModelState.IsValid)
     {
         if (TaiKhoanQueries.KiemTraDangNhap(model))
         {
             Session[Constants.Constants.LOGIN_QUANTRIVIEN] = model.Username;
             if (Response.Cookies[Constants.Constants.LOGIN_QUANTRIVIEN] != null)
             {
                 Response.Cookies.Remove(Constants.Constants.LOGIN_QUANTRIVIEN);
             }
             Response.Cookies[Constants.Constants.LOGIN_QUANTRIVIEN].Value = model.Username;
             Response.Cookies[Constants.Constants.LOGIN_QUANTRIVIEN][Constants.Constants.DANGNHAPLANCUOI] = DateTime.Now.ToString();
             Response.Cookies[Constants.Constants.LOGIN_QUANTRIVIEN].Expires = DateTime.Now.AddDays(15);
             return(RedirectToAction("Index", "TourDuLich"));
         }
     }
     return(View(model));
 }
        public PartialViewResult LayDanhSachNhanVienOnline()
        {
            var result = TaiKhoanQueries.LayDanhSachNhanVienOnl();

            return(PartialView(result));
        }
        public JsonResult LayDanhSachNhanVien()
        {
            var result = TaiKhoanQueries.LayDanhSachNhanVienOnl();

            return(Json(result, JsonRequestBehavior.AllowGet));
        }
        public ViewResult DoiMatKhau(String taiKhoan)
        {
            var model = TaiKhoanQueries.LayThongTinTaiKhoan(taiKhoan);

            return(View(model));
        }
        //thông tin chi tiết tài khoản
        public ActionResult ChiTietTK(string tk)
        {
            var Tk = TaiKhoanQueries.LayChiTietTaiKhoan(tk);

            return(View(Tk));
        }
 public ActionResult ResetPass(string taiKhoan)
 {
     TaiKhoanQueries.ResetPass(taiKhoan);
     return(RedirectToAction("MenuDanhSachTaiKhoan", "TaiKhoan"));
 }
        public ViewResult MenuDanhSachTaiKhoan()
        {
            var model = TaiKhoanQueries.LayDanhSachTaiKhoan();

            return(View(model));
        }