public ActionResult HuyTour(int id)
        {
            var  dao    = new DatTourDAO();
            bool result = dao.Delete(id);

            return(RedirectToAction("Index", "DatTour"));
        }
        public ActionResult DanhSachTourDaDat(int id)
        {
            var model = new DatTourDAO().DanhSachTourDaDat(id);

            ViewBag.Tour = new TourDAO().ViewDetail(id);
            return(View(model));
        }
        public ActionResult ChiTietDatTour(int id)
        {
            var dao = new DatTourDAO();

            ViewBag.TourChuaThanhToan = dao.TourChuaThanhToan(id);
            return(View());
        }
        public ActionResult XacNhanThanhToan(int id)
        {
            var dao     = new DatTourDAO();
            var daoTour = new TourDAO();
            //Cập nhật trạng thái thanh toán

            var dattour = dao.TourChuaThanhToan(id);
            var tour    = daoTour.ViewDetail(dattour.matour);

            //Trừ số chỗ
            int sochodattour = dattour.sotreem.Value + dattour.songuoilon.Value;
            int socho        = tour.socho.Value;

            if (sochodattour > socho)
            {
                Session["Error"] = "Hiện tour đã hết chỗ";
                return(RedirectToAction("ChiTietDatTour", "DatTour", new { id = id }));
            }
            else
            {
                bool result = dao.XacNhanThanhToan(id);
                daoTour.CapNhatSoCho(dattour.matour, sochodattour);
            }

            ViewBag.TourDaThanhToan = dao.TourDaThanhToan(id);
            return(View());
        }
        //
        // GET: /Admin/DatTour/

        public ActionResult Index()
        {
            var dao = new DatTourDAO();

            ViewBag.TourChuaThanhToan = dao.TourChuaThanhToan();
            return(View());
        }
Example #6
0
        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"));
        }
Example #7
0
        public ActionResult SuaTour(int id)
        {
            var quangcaoDAO = new QuangCaoDAO();

            ViewBag.QuangCao = quangcaoDAO.DanhSachQuangCao();
            var dao = new DatTourDAO();

            ViewBag.TTDatTour = dao.TourChuaThanhToan(id);
            return(View());
        }
Example #8
0
        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());
        }
        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());
        }
Example #10
0
        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());
        }
Example #11
0
        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());
            }
        }