Exemplo n.º 1
0
        public tbl_HotelsConfig getConfigHotel()
        {
            tbl_HotelsConfig oConfig = null;

            //search again
            using (var db = _connectionData.OpenDbConnection())
            {
                var query = db.From <tbl_HotelsConfig>().Where(e2 => e2.SysHotelID == comm.GetHotelId());
                oConfig = db.Select(query).FirstOrDefault();
            }
            if (oConfig == null)
            {
                oConfig = new tbl_HotelsConfig()
                {
                    startCheckin     = 12,
                    startCheckout    = 10,
                    startNight1      = 21,
                    startNight2      = 5,
                    startRoundMain   = 15,
                    startRoundExatra = 15
                }
            }
            ;
            return(oConfig);
        }
    }
        public int UpdateOrInsert(tbl_HotelsConfig obj)
        {
            try
            {
                using (var db = _connectionData.OpenDbConnection())
                {
                    if (obj.Id > 0)
                    {
                        db.Update(obj);
                    }
                    else
                    {
                        db.Insert(obj);
                    }

                    return(1);
                }
            }
            catch (Exception ex)
            {
                return(0);

                throw;
            }
        }
        public ActionResult UpdateOrInsert(tbl_HotelsConfig obj)
        {
            int result = 0;

            result = _svustomerArrive.UpdateOrInsert(obj);
            return(Json(new { result = result }, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 4
0
        // GET: RoomCheckOut
        public ActionResult Index(int checkinID)
        {
            //checkinID = 9;
            var model = new PaymentCheckOutModel();

            //thông tin khách hàng
            model.InforCustomer = _svustomerArrive.GetCustomerRoomByCheckInID(checkinID);
            if (model.InforCustomer == null)
            {
                return(Redirect("CustomerPayCheckOutFalse"));
            }
            var listRoomPrice = new List <RoomPriceEstimateModel>();

            //okie
            ViewBag.Leave_Date = model.InforCustomer.Leave_Date.GetValueOrDefault(DateTime.Now);
            TimeSpan         tm     = DateTime.Now.Subtract(model.InforCustomer.Arrive_Date.GetValueOrDefault(DateTime.Now));
            tbl_HotelsConfig config = (new CommService()).getConfigHotel();

            ViewBag.totalHours = tm.Hours + (tm.Minutes > (config.startRoundMain ?? 0)?1:0);

            //DateTime dateToArrive= model.InforCustomer.Leave_Date.GetValueOrDefault(DateTime.Now);
            //if (dateToArrive.CompareTo(DateTime.Now) > 0) dateToArrive = DateTime.Now;
            model.InforCustomer.Leave_Date = DateTime.Now;
            listRoomPrice =
                new EstimatePrice1Service().caculatePrice(model.InforCustomer.SysHotelID.GetValueOrDefault(0),
                                                          -1,
                                                          model.InforCustomer.roomid.GetValueOrDefault(0),
                                                          model.InforCustomer.Room_Type_ID.GetValueOrDefault(0),
                                                          model.InforCustomer.Arrive_Date.GetValueOrDefault(DateTime.Now),
                                                          model.InforCustomer.Leave_Date.GetValueOrDefault(DateTime.Now), -1
                                                          , model.InforCustomer.Number_People, model.InforCustomer.Number_Children);
            //danh sách giá phòng
            model.GetListPriceEstimate = listRoomPrice;

            var cService = _svustomerArrive.GetListCustomerServices(checkinID);

            // danh sách dịnh vụ đã sử dụng
            model.GetListCustomerServices = cService.Where(x => x.UnitID > 0).ToList();

            // danh sách dịnh vụ khác đã sử dụng
            model.GetListCustomerOtherServices = cService.Where(x => x.UnitID == 0).ToList();
            // danh sách dịch vụ
            model.GetProductList = _svustomerArrive.GetlistProduct(model.InforCustomer.SysHotelID.GetValueOrDefault(),
                                                                   model.InforCustomer.roomid.GetValueOrDefault(0));
            return(View(model));
        }