Example #1
0
 public ReportViewer(PhieuDatPhong phieudatphong) : this()
 {
     this.phieudatphong = phieudatphong;
     //reportHoaDon.CreateDocument();
     documentViewer1.DocumentSource = phieudatphong;
     documentViewer1.Zoom           = 0.83f;
 }
Example #2
0
        public async Task <IActionResult> Create(PhieuDatPhong inputModel)
        {
            await _PhieuDatPhongManager.Create(inputModel);

            ViewData["successMsg"] = "thêm mới thành công";
            return(RedirectToAction("danh-sach-nhom-phong", "nhom-phong"));
        }
Example #3
0
        public async Task <IActionResult> Update(PhieuDatPhong model)
        {
            var data = await _PhieuDatPhongManager.Find_By_Id(model.Id);

            if (data != null)
            {
                await _PhieuDatPhongManager.Update(model);

                ViewData["successMsg"] = "Sửa thành công";
            }

            return(Redirect("/nhom-phong/danh-sach-nhom-phong"));
        }
Example #4
0
        public async Task Update(PhieuDatPhong inputModel)
        {
            try
            {
                await _unitOfWork.PhieuDatPhongRepository.Update(inputModel);

                await _unitOfWork.SaveChange();
            }
            catch (Exception ex)
            {
                await _unitOfWork.Rollback();

                throw ex;
            }
        }
Example #5
0
        public async Task <PhieuDatPhong> Create(PhieuDatPhong inputModel)
        {
            try
            {
                var result = await _unitOfWork.PhieuDatPhongRepository.Add(inputModel);

                await _unitOfWork.SaveChange();

                return(result);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public ActionResult AddItem(int MaPhong)
        {
            var phong = new DanhSachPhongDao().ViewDentail(MaPhong);
            var cart  = Session[DatPhongSesstion];

            if (cart != null)
            {
                var list = (List <PhieuDatPhong>)cart;
                if (list.Exists(x => x.Phong.MaPhong == MaPhong))
                {
                    foreach (var item in list)
                    {
                        if (item.Phong.MaPhong == MaPhong)
                        {
                            ModelState.AddModelError("", "Phòng đã Có");
                        }
                        else
                        {
                            //trong
                        }
                    }
                }
                else
                {
                    //Tạo mới đối tượng
                    var item = new PhieuDatPhong();
                    item.Phong = phong;
                    list.Add(item);
                }
                //Gán vào Session
                Session[DatPhongSesstion] = list;
            }
            else
            {
                //tạo mới đối tượng
                var item = new PhieuDatPhong();
                item.Phong = phong;

                var list = new List <PhieuDatPhong>();
                list.Add(item);
                //Gán vào session
                Session[DatPhongSesstion] = list;
            }
            return(RedirectToAction("Index"));
        }
        public ActionResult Xoa(int maPhong)
        {
            //===========tự làm================
            var           sessionCart = (List <PhieuDatPhong>)Session[DatPhongSesstion];
            PhieuDatPhong sanpham     = sessionCart.SingleOrDefault(x => x.Phong.MaPhong == maPhong);

            if (sanpham != null)
            {
                sessionCart.RemoveAll(x => x.Phong.MaPhong == maPhong);
                return(RedirectToAction("Index"));
            }

            if (sessionCart.Count == 0)
            {
                return(RedirectToAction("Index", "ConFirmDatPhong"));
            }

            return(RedirectToAction("Index"));
        }
Example #8
0
        public async Task <IActionResult> Delete(PhieuDatPhong model)
        {
            try
            {
                var item = await _PhieuDatPhongManager.Find_By_Id(model.Id);

                //item.TinhTrang = false;
                await _PhieuDatPhongManager.Update(item);

                return(Json(new
                {
                    data = true
                }));
            }
            catch (Exception ex)
            {
                return(Json(new
                {
                    data = false
                }));
            }
        }