// GET: ChiTietPhong
        public ViewResult XemChiTiet(string Loai, string MaPhong)
        {
            IList <ChiTietVatTuDTO> lsctvt = ctvt.getListChiTietVatTuByMaLP(Loai);
            ChiTietPhongDTO         lsctp  = ctp.getListChiTietPhongById(MaPhong);
            IList <VatTuDTO>        lsvt   = new List <VatTuDTO>();

            if (lsctvt == null)
            {
                //Trả về trang báo lỗi
                Response.StatusCode = 404;
                return(null);
            }
            foreach (ChiTietVatTuDTO itum in lsctvt)
            {
                VatTuDTO lsvtu = vt.getVatTuByID(itum.Mavattu);
                lsvt.Add(lsvtu);
            }
            string smaloai  = lsctp.Maloai;
            string sPic     = lsctp.Anhbia;
            string smaphong = lsctp.Maphong;
            string ssonguoi = lsctp.Songuoi.ToString();
            string sgia     = lsctp.Gia.ToString();

            ViewBag.maphong = smaphong;
            ViewBag.songuoi = ssonguoi;
            ViewBag.gia     = sgia;
            ViewBag.Pic     = sPic;
            ViewBag.maloai  = smaloai;
            return(View(lsvt));
        }
Пример #2
0
        public GioDatHang(string Maphong)
        {
            sMaphong = Maphong;
            ChiTietPhongDTO ctptemp = ctp.getListChiTietPhongById(sMaphong);

            sAnhbia = ctptemp.Anhbia;
            var lstngaydatphong = entity.ngaydatphongs.ToList();

            foreach (ngaydatphong dd in lstngaydatphong)
            {
                dNgayden = dd.ngayden.Value.Year + "-" + dd.ngayden.Value.Month + "-" + dd.ngayden.Value.Day + " 00:00:00";
                dNgaydi  = dd.ngaydi.Value.Year + "-" + dd.ngaydi.Value.Month + "-" + dd.ngaydi.Value.Day + " 23:59:59";
            }
            iSonguoi = ctptemp.Songuoi;
            sLoai    = ctptemp.Maloai;
            iGia     = ctptemp.Gia;
        }
        public ActionResult KetQuaTimKiem(int?page, string sDateCome, string sDateLeave, int sPeople)
        {
            ViewBag.DateCome  = sDateCome;
            ViewBag.DateLeave = sDateLeave;
            ViewBag.People    = sPeople;
            //Phân trang
            int pageNumber = (page ?? 1);
            int pageSize   = 6;
            IList <PhongDTO>        lstKQTK = phong.getListPhongAll();
            IList <ChiTietPhongDTO> listctp = new List <ChiTietPhongDTO>();

            if (lstKQTK.Count == 0)
            {
                ViewBag.ThongBao = "Không tìm thấy phòng nào";
                return(View());
            }
            else
            {
                foreach (PhongDTO p in lstKQTK)
                {
                    if (kiemtraphong(p.Maphong, sDateCome, sDateLeave))
                    {
                        ChiTietPhongDTO lsctp = ctp.getListChiTietPhongById(p.Maphong);
                        if (lsctp.Songuoi >= sPeople)
                        {
                            listctp.Add(lsctp);
                        }
                    }
                }
            }

            ngaydatphong date = new ngaydatphong();

            date.ngayden = DateTime.Parse(sDateCome);
            date.ngaydi  = DateTime.Parse(sDateLeave);
            entity.ngaydatphongs.Add(date);
            entity.SaveChanges();

            ViewBag.ThongBao = "Đã tìm thấy " + listctp.Count + " kết quả!";
            return(View(listctp.ToPagedList(pageNumber, pageSize)));
        }
        public ActionResult KetQuaTimKiem(FormCollection f, int?page)
        {
            string sDateCome  = f["date"].ToString() + " 00:00:00";
            string sDateLeave = f["date2"].ToString() + " 23:59:59";
            int    sPeople    = int.Parse(f["txtTimKiem1"].ToString());

            ViewBag.DateCome  = sDateCome;
            ViewBag.DateLeave = sDateLeave;
            ViewBag.People    = sPeople;
            //Phân trang
            int pageNumber = (page ?? 1);
            int pageSize   = 6;
            IList <PhongDTO>        lstKQTK = phong.getListPhongAll();
            IList <ChiTietPhongDTO> listctp = new List <ChiTietPhongDTO>();

            if (lstKQTK.Count == 0)
            {
                ViewBag.ThongBao = "Không tìm thấy phòng nào";
                return(View());
            }
            else
            {
                foreach (PhongDTO p in lstKQTK)
                {
                    if (kiemtraphong(p.Maphong, sDateCome, sDateLeave))
                    {
                        ChiTietPhongDTO lsctp = ctp.getListChiTietPhongById(p.Maphong);
                        if (lsctp.Songuoi >= sPeople)
                        {
                            listctp.Add(lsctp);
                        }
                    }
                }
            }

            ViewBag.ThongBao = "Đã tìm thấy " + listctp.Count + " kết quả!";
            return(View(listctp.ToPagedList(pageNumber, pageSize)));
        }