public ActionResult Login() { var quangcaoDAO = new QuangCaoDAO(); ViewBag.QuangCao = quangcaoDAO.DanhSachQuangCao(); return(View()); }
public ActionResult Login(LoginModel model) { var quangcaoDAO = new QuangCaoDAO(); ViewBag.QuangCao = quangcaoDAO.DanhSachQuangCao(); if (ModelState.IsValid) { var dao = new KhachHangDAO(); var result = dao.Login(model.UserName, Encryptor.MD5Hash(model.PassWord)); if (result == 1) { var userSession = new UserLogin(); var user = dao.GetByID(model.UserName); userSession.UserID = user.makh; userSession.UserName = user.taikhoan; Session.Add(CommonConstants.CUSTOMER_SESSION, userSession); return(Redirect("/")); } else { if (result == -2) { ModelState.AddModelError("", "Mật khẩu không chính xác"); } else { ModelState.AddModelError("", "Tài khoản không tồn tại"); } } } return(View(model)); }
public ActionResult DetailTour(int id) { var quangcaoDAO = new QuangCaoDAO(); ViewBag.QuangCao = quangcaoDAO.DanhSachQuangCao(); ViewBag.DetailTour = new TourDAO().ViewDetail(id); return(View()); }
// GET: Admin/QuangCao public ActionResult DanhSachQuangCao(string tukhoa, int page = 1, int pageSize = 30) { var dao = new QuangCaoDAO(); var model = dao.DanhSachQuangCao(tukhoa, page, pageSize); ViewBag.TuKhoa = tukhoa; return(View(model)); }
public ActionResult DetailNews(int id) { var quangcaoDAO = new QuangCaoDAO(); ViewBag.QuangCao = quangcaoDAO.DanhSachQuangCao(); var tour = new TinTucDAO().ViewDetail(id); return(View(tour)); }
public ActionResult LichKhoiHanh() { var quangcaoDAO = new QuangCaoDAO(); ViewBag.QuangCao = quangcaoDAO.DanhSachQuangCao(); var tourDAO = new TourDAO(); ViewBag.LichKhoiHanh = tourDAO.GetTourGanDay(20); return(View()); }
public ActionResult TourKhuyenMai(int page = 1, int pageSize = 8) { var quangcaoDAO = new QuangCaoDAO(); ViewBag.QuangCao = quangcaoDAO.DanhSachQuangCao(); var tourDAO = new TourDAO(); var model = tourDAO.GetTourKhuyenMai(page, pageSize); return(View(model)); }
public ActionResult TourTrongNuoc(int page = 1, int pageSize = 8) { var quangcaoDAO = new QuangCaoDAO(); ViewBag.QuangCao = quangcaoDAO.DanhSachQuangCao(); var tourDAO = new TourDAO(); var model = tourDAO.GetListTourOfCategory("Trong nước", page, pageSize); return(View(model)); }
public ActionResult Search(int diemden, int giatour, string khoihanh) { var quangcaoDAO = new QuangCaoDAO(); ViewBag.QuangCao = quangcaoDAO.DanhSachQuangCao(); var dao = new TourDAO(); ViewBag.Tour = dao.SearchTour(diemden, giatour, khoihanh); return(View()); }
public ActionResult HuyTour(int id) { var quangcaoDAO = new QuangCaoDAO(); ViewBag.QuangCao = quangcaoDAO.DanhSachQuangCao(); var dao = new DatTourDAO(); bool result = dao.Delete(id); return(RedirectToAction("TourCuaToi", "KhachHang")); }
public ActionResult SuaTour(int id) { var quangcaoDAO = new QuangCaoDAO(); ViewBag.QuangCao = quangcaoDAO.DanhSachQuangCao(); var dao = new DatTourDAO(); ViewBag.TTDatTour = dao.TourChuaThanhToan(id); return(View()); }
// // GET: /TinTuc/ public ActionResult Index(int page = 1, int pageSize = 6) { var quangcaoDAO = new QuangCaoDAO(); ViewBag.QuangCao = quangcaoDAO.DanhSachQuangCao(); var dao = new TinTucDAO(); var model = dao.ListAll(page, pageSize); ViewBag.News = dao.ListAll(page, pageSize); return(View(model)); }
public JsonResult GetDiemDen(int id) { var quangcaoDAO = new QuangCaoDAO(); ViewBag.QuangCao = quangcaoDAO.DanhSachQuangCao(); var result = new DiemDenDAO().Seach(id); JsonResult json = new JsonResult(); json.Data = result; return(json); }
public ActionResult TourNuocNgoai(int page = 1, int pageSize = 8) { var quangcaoDAO = new QuangCaoDAO(); ViewBag.QuangCao = quangcaoDAO.DanhSachQuangCao(); var tourDAO = new TourDAO(); var model = tourDAO.GetListTourOfCategory("Quốc tế", page, pageSize); //ViewBag.TourOfCategory = tourDAO.GetListTourOfCategory("Quốc tế"); return(View(model)); }
public ActionResult SuaTour(tblDATTOUR model) { var quangcaoDAO = new QuangCaoDAO(); ViewBag.QuangCao = quangcaoDAO.DanhSachQuangCao(); var dao = new DatTourDAO(); ViewBag.TTDatTour = dao.TourChuaThanhToan(model.madattour); if (ModelState.IsValid) { int?socho = new TourDAO().ViewDetail(model.matour).socho; if (model.sotreem == null) { model.sotreem = 0; } int soChoDat = model.songuoilon.Value + model.sotreem.Value; if (socho < soChoDat) { ViewBag.Error = "Số chỗ còn trống không đủ . Hiện số chỗ còn " + socho + " chỗ"; ViewBag.DetailTour = new TourDAO().ViewDetail(model.matour); var session = (TravelOnline.Common.UserLogin)Session[TravelOnline.Common.CommonConstants.CUSTOMER_SESSION]; if (session == null) { return(RedirectToAction("Login", "KhachHang")); } ViewBag.ThongTinKhachHang = new KhachHangDAO().ViewDetail(session.UserID); return(View()); } else { double giatour; var tourDAO = new TourDAO(); var tour = tourDAO.ViewDetail(model.matour); if (tour.giakhuyenmai != null) { giatour = tour.giakhuyenmai.Value; } else { giatour = tour.giatour.Value; } //Gia tour tre em double giaTourTreEm = giatour - giatour * 5 / 100; model.tongtien = giatour * model.songuoilon.Value + giaTourTreEm * model.sotreem.Value; bool result = dao.Update(model); if (result) { return(RedirectToAction("TourCuaToi", "KhachHang")); } } } return(View()); }
// // GET: /Home/ public ActionResult Index() { var tourDAO = new TourDAO(); var tintucDAO = new TinTucDAO(); ViewBag.NewTour = tourDAO.ListNewTour(4); ViewBag.News = tintucDAO.ListNews(3); ViewBag.TourGanDay = tourDAO.GetTourGanDay(5); var quangcaoDAO = new QuangCaoDAO(); ViewBag.QuangCao = quangcaoDAO.DanhSachQuangCao(); return(View()); }
public ActionResult LayLaiMatKhau() { var quangcaoDAO = new QuangCaoDAO(); ViewBag.QuangCao = quangcaoDAO.DanhSachQuangCao(); var session = (TravelOnline.Common.UserLogin)Session[TravelOnline.Common.CommonConstants.CUSTOMER_SESSION]; if (session != null) { return(RedirectToAction("Index", "Home")); } return(View()); }
public ActionResult UpdateProfile() { var quangcaoDAO = new QuangCaoDAO(); ViewBag.QuangCao = quangcaoDAO.DanhSachQuangCao(); var session = (TravelOnline.Common.UserLogin)Session[TravelOnline.Common.CommonConstants.CUSTOMER_SESSION]; if (session == null) { return(RedirectToAction("Login", "KhachHang")); } ViewBag.ThongTinKhachHang = new KhachHangDAO().ViewDetail(session.UserID); return(View()); }
public ActionResult TourCuaToi() { var quangcaoDAO = new QuangCaoDAO(); ViewBag.QuangCao = quangcaoDAO.DanhSachQuangCao(); var session = (TravelOnline.Common.UserLogin)Session[TravelOnline.Common.CommonConstants.CUSTOMER_SESSION]; if (session == null) { return(RedirectToAction("Login", "KhachHang")); } else { var dao = new DatTourDAO(); ViewBag.TourChuaThanhToan = dao.TourChuaThanhToanTheoKhachHang(session.UserID); } return(View()); }
public ActionResult Register(DangKyModel model) { var quangcaoDAO = new QuangCaoDAO(); ViewBag.QuangCao = quangcaoDAO.DanhSachQuangCao(); if (ModelState.IsValid) { var dao = new KhachHangDAO(); if (dao.kiemTraTaiKhoan(model.taikhoan) > 0) { ModelState.AddModelError("", "Tên đăng nhập đã tồn tại"); } else if (dao.kiemTraEmail(model.email) > 0) { ModelState.AddModelError("", "Tên email đã tồn tại"); } else { var khachhang = new tblKHACHHANG(); khachhang.taikhoan = model.taikhoan; khachhang.hoten = model.hoten; khachhang.ngaysinh = model.ngaysinh; khachhang.cmt = model.cmt; khachhang.diachi = model.diachi; khachhang.dienthoai = model.dienthoai; khachhang.gioitinh = model.gioitinh; khachhang.email = model.email; var encrytedMd5Pas = Encryptor.MD5Hash(model.matkhau); khachhang.matkhau = encrytedMd5Pas; var result = dao.Insert(khachhang); if (result > 0) { Session["Register"] = "Đăng ký"; return(RedirectToAction("Login", "KhachHang")); } else { ModelState.AddModelError("", "Đăng ký không thành công"); } } } return(View(model)); }
public ActionResult CapNhatMatKhau(string taikhoan, string email, string rdcode) { var quangcaoDAO = new QuangCaoDAO(); ViewBag.QuangCao = quangcaoDAO.DanhSachQuangCao(); var session = (TravelOnline.Common.UserLogin)Session[TravelOnline.Common.CommonConstants.CUSTOMER_SESSION]; if (session != null) { return(RedirectToAction("Index", "Home")); } //Kiểm tra tài khoản, email và rdcode var dao = new KhachHangDAO(); bool result = dao.KiemTraTaiKhoanEmailRDCode(taikhoan, email, rdcode); if (result == false) { return(RedirectToAction("Index", "Home")); } return(View()); }
public ActionResult DatTourThanhCong() { var quangcaoDAO = new QuangCaoDAO(); ViewBag.QuangCao = quangcaoDAO.DanhSachQuangCao(); var session = (TravelOnline.Common.ThongTinDatTour)Session[TravelOnline.Common.CommonConstants.DATTOUR_SESSION]; if (session == null) { return(RedirectToAction("Index", "Home")); } else { //string content = System.IO.File.ReadAllText(Server.MapPath("~/Assets/client/templates/dattour.html")); //string name = "<title>Thông tin đặt tour1</title>"; //content = content.Replace("<title>Thông tin đặt tour</title>\r\n", name); //new MailHelper().SendMail("*****@*****.**", "Thông tin đặt tour", content); ViewBag.DetailTour = new TourDAO().ViewDetail(session.matour); } return(View()); }
public ActionResult CapNhatMatKhau(CapNhatMatKhauModel model) { var quangcaoDAO = new QuangCaoDAO(); ViewBag.QuangCao = quangcaoDAO.DanhSachQuangCao(); if (ModelState.IsValid) { var session = (TravelOnline.Common.UserLogin)Session[TravelOnline.Common.CommonConstants.CUSTOMER_SESSION]; if (session != null) { return(RedirectToAction("Index", "Home")); } var dao = new KhachHangDAO(); //Kiểm tra tài khoản int kiemtrataikhoan = dao.kiemTraTaiKhoan(model.taikhoan); if (kiemtrataikhoan == 0) { ViewBag.Loi = "Tài khoản không tồn tại!"; } else { //Thay đổi RdCode string rdcode = RandomString(30, true); //Cập nhật bool result = dao.CapNhatMatKhau(model.taikhoan, Encryptor.MD5Hash(model.matkhau), rdcode); if (result == true) { ViewBag.ThanhCong = "Cập nhật mật khẩu thành công"; } else { ViewBag.Loi = "Cập nhật không thành công"; } } } return(View(model)); }
public ActionResult LayLaiMatKhau(LayLaiMatKhauModel model) { var quangcaoDAO = new QuangCaoDAO(); ViewBag.QuangCao = quangcaoDAO.DanhSachQuangCao(); var session = (TravelOnline.Common.UserLogin)Session[TravelOnline.Common.CommonConstants.CUSTOMER_SESSION]; if (session != null) { return(RedirectToAction("Index", "Home")); } var dao = new KhachHangDAO(); bool kiemTraTaiKhoanEmail = dao.kiemTraTaiKhoanEmail(model.taikhoan, model.email); if (kiemTraTaiKhoanEmail == false) { ViewBag.Loi = "Thông tin bạn nhập không chính xác!"; } else { //Tạo mã random string rdCode = RandomString(30, true); //Thêm vào table Khách hàng bool result = dao.UpdateRDCode(model.taikhoan, rdCode); //Gửi email xác nhận mật khẩu string content = System.IO.File.ReadAllText(Server.MapPath("~/Assets/client/templates/laylaimatkhau.html")); string urlHome = ConfigurationManager.AppSettings["UrlHome"].ToString(); string link = urlHome + "/khach-hang/cap-nhat-mat-khau/?taikhoan=" + model.taikhoan + "&email=" + model.email + "&rdcode=" + rdCode; content = content.Replace("{{Link}}", link); new MailHelper().SendMail(model.email, "Xác nhận thay đổi mật khẩu", content); ViewBag.ThanhCong = "<strong>Hoàn thành!</strong> . Vui lòng xác nhận qua email"; } return(View(model)); }
public ActionResult DatTour(int id) { ViewBag.DetailTour = new TourDAO().ViewDetail(id); var quangcaoDAO = new QuangCaoDAO(); ViewBag.QuangCao = quangcaoDAO.DanhSachQuangCao(); var session = (TravelOnline.Common.UserLogin)Session[TravelOnline.Common.CommonConstants.CUSTOMER_SESSION]; if (session == null) { return(RedirectToAction("Login", "KhachHang")); } var dao = new DatTourDAO(); bool result = dao.CheckDatTour(session.UserID); if (result == false) { return(RedirectToAction("TourCuaToi", "KhachHang")); } ViewBag.ThongTinKhachHang = new KhachHangDAO().ViewDetail(session.UserID); return(View()); }
public ActionResult DatTour(tblDATTOUR dattour) { var quangcaoDAO = new QuangCaoDAO(); ViewBag.QuangCao = quangcaoDAO.DanhSachQuangCao(); if (ModelState.IsValid) { int?socho = new TourDAO().ViewDetail(dattour.matour).socho; if (dattour.sotreem == null) { dattour.sotreem = 0; } int soChoDat = dattour.songuoilon.Value + dattour.sotreem.Value; if (socho < soChoDat) { ViewBag.Error = "Số chỗ còn trống không đủ"; ViewBag.DetailTour = new TourDAO().ViewDetail(dattour.matour); var session = (TravelOnline.Common.UserLogin)Session[TravelOnline.Common.CommonConstants.CUSTOMER_SESSION]; if (session == null) { return(RedirectToAction("Login", "KhachHang")); } ViewBag.ThongTinKhachHang = new KhachHangDAO().ViewDetail(session.UserID); return(View()); } else { //Insert vào table Dattour var dao = new DatTourDAO(); double giatour; var tourDAO = new TourDAO(); var tour = tourDAO.ViewDetail(dattour.matour); if (tour.giakhuyenmai != null) { giatour = tour.giakhuyenmai.Value; } else { giatour = tour.giatour.Value; } //Gia tour tre em double giaTourTreEm = giatour - giatour * 5 / 100; dattour.tongtien = giatour * dattour.songuoilon.Value + giaTourTreEm * dattour.sotreem.Value; long id = dao.Insert(dattour); var tourSession = new ThongTinDatTour(); tourSession.hoten = dattour.hoten; tourSession.matour = dattour.matour; tourSession.cmt = dattour.cmt; tourSession.diachi = dattour.diachi; tourSession.dienthoai = dattour.dienthoai; tourSession.email = dattour.email; tourSession.songuoilon = dattour.songuoilon; tourSession.sotreem = dattour.sotreem; tourSession.tongtien = dattour.tongtien; Session.Add(CommonConstants.DATTOUR_SESSION, tourSession); //Trừ số chỗ Tour //bool result = tourDAO.CapNhatSoCho(tour.matour, soChoDat); //View hoàn thành return(Redirect("/dat-tour/thanh-cong")); } } else { ViewBag.DetailTour = new TourDAO().ViewDetail(dattour.matour); var session = (TravelOnline.Common.UserLogin)Session[TravelOnline.Common.CommonConstants.CUSTOMER_SESSION]; if (session == null) { return(RedirectToAction("Login", "KhachHang")); } ViewBag.ThongTinKhachHang = new KhachHangDAO().ViewDetail(session.UserID); return(View()); } }