public ActionResult BatchMaintainRoom()
        {
            var        hotelId = UserContext.CurrentUser.HotelId;
            HttpCookie TadyNum = new HttpCookie("TadyNum");

            TadyNum["num"] = "0";
            Response.Cookies.Add(TadyNum);
            var      now      = DateTime.Now;
            DateTime yuLiTime = now;

            yuLiTime          = now.Date.AddDays(1).AddHours(12);
            ViewBag.BeginTime = now.ToString("yyyy-MM-dd HH:mm:ss");
            ViewBag.EndTime   = yuLiTime.ToString("yyyy-MM-dd HH:mm:ss");

            var treedata = RoomBll.GetFloorTreeData(hotelId);

            ViewBag.Rooms    = RoomBll.GetAllRoomData2(hotelId);
            ViewBag.TreeData = treedata;
            PreLoadFTData();
            var simpleModels = new List <object>();
            var models       = _ft_rooms;
            var roomRegs     = _ft_roomregs;

            foreach (var item in models)
            {
                item.RoomReg = roomRegs.Where(a => a.Id == item.RoomRegId).FirstOrDefault();
                LoadRoomInfo(item);
                simpleModels.Add(RoomToSRoom(item));
            }
            ViewBag.SRooms = simpleModels;

            return(View(UserContext.CurrentUser));
        }
        public ActionResult GetFullData(long[] RoomIds)
        {
            var hotelId = UserContext.CurrentUser.HotelId;

            if (RoomIds.Length > 0)
            {
                return(GetFullData2(RoomIds));
            }
            var rooms = new List <object>();

            foreach (var RoomId in RoomIds)
            {
                var item = RoomBll.GetById(RoomId);
                if (item.RoomRegId != 0)
                {
                    item.RoomReg = RoomRegBll.GetById(item.RoomRegId);
                }

                LoadRoomInfo(item);

                // var sroom = RoomToSRoom(item);
                rooms.Add(RoomToSRoom(item));
            }

            return(Content(JsonConvert.SerializeObject(new { Rooms = rooms })));
        }
        private void PreLoadFTData()
        {
            var hotelId = UserContext.CurrentUser.HotelId;

            if (!_ft_isLoaded)
            {
                _ft_isLoaded           = true;
                _ft_rooms              = RoomBll.GetListBy(hotelId);
                _ft_roomregs           = RoomRegBll.GetListByHotelId(hotelId);
                _ft_members            = MemberBll.GetList(hotelId);
                _ft_membersType        = MemberTypeBll.GetList(hotelId);
                _ft_RoomRegGuestInfoCN = RoomRegGuestInfoCNBll.GetListByHotelId(hotelId);
                _ft_RoomRegGuestInfoEN = RoomRegGuestInfoENBll.GetListByHotelId(hotelId);
                _ft_MaterialLease      = MaterialLeaseBll.GetListByHotel(hotelId);
                _ft_RoomType           = RoomTypeBll.GetListByHotelId(hotelId);
                _ft_RoomYdRecord       = RoomYdRecordBll.GetListByHotel(hotelId);
                _ft_GlobalFeeSet       = GlobalFeeSetBll.GetByHotelId(hotelId);
                _ft_MaintainRoom       = MaintainRoomBll.GetListByHotelId(hotelId);
                _ft_RoomSelfuse        = RoomSelfBll.GetListByHotelId(hotelId);
                _ft_RoomYD             = RoomYdBll.GetListByHotel(hotelId);
                _ft_RoomSet            = RoomSetBll.GetBy(hotelId);
                if (_ft_RoomSet == null)
                {
                    _ft_RoomSet = RoomSetBll.GetBy(0);
                }
            }
        }
        public ActionResult getRoomSet()
        {
            var hotelId = UserContext.CurrentUser.HotelId;
            var data    = RoomBll.GetRoomSet(hotelId);

            return(Content(JsonConvert.SerializeObject(data)));
        }
        public ActionResult ChangeRoom(long roomId, long roomRegId = 0)
        {
            var hotelId = UserContext.CurrentUser.HotelId;

            if (roomRegId != 0)
            {
                ViewBag.RoomRegId = roomRegId;
                var rg = RoomRegBll.GetById(roomRegId);

                ViewBag.RoomId = rg.RoomId;
            }
            else
            {
                ViewBag.RoomId = roomId;

                var model = RoomBll.GetById(roomId);
                if (model == null)
                {
                    model = new Room();
                }
                ViewBag.RoomRegId = model.RoomRegId;
            }

            return(View(UserContext.CurrentUser));
        }
        /// <summary>
        /// 房间留言
        /// </summary>
        /// <param name="roomId"></param>
        /// <returns></returns>
        public ActionResult _SelMessage(long roomId)
        {
            var hotelId = UserContext.CurrentUser.HotelId;

            ViewBag.HotelId = hotelId;
            ViewBag.RoomId  = roomId;
            var room = RoomBll.GetById(roomId);

            if (room != null)
            {
                var msg = RoomBll.GetMessage(roomId);
                if (msg == null)
                {
                    msg = new RoomMessage();
                }
                ViewBag.Message   = msg;
                ViewBag.RoomRegId = room.RoomRegId;
                ViewBag.Room      = room;
                ViewBag.RoomReg   = RoomRegBll.GetById(room.RoomRegId);
            }
            else
            {
                ViewBag.Message   = new RoomMessage();
                ViewBag.Room      = new Hotel.Model.Room();
                ViewBag.RoomRegId = 0;
                ViewBag.RoomReg   = new Hotel.Model.RoomReg();
            }

            return(View());
        }
        public ActionResult GetRoomShowData(long roomId)
        {
            var apiResult = new APIResult();
            var hotelId   = UserContext.CurrentUser.HotelId;

            try
            {
                var item = RoomBll.GetById(roomId);
                if (item.RoomRegId != 0)
                {
                    item.RoomReg = RoomRegBll.GetById(item.RoomRegId);
                }

                LoadRoomInfo(item);

                return(Json(RoomToSRoom(item)));
            }
            catch (Exception ex)
            {
                apiResult.Ret = -1;
                apiResult.Msg = ex.Message;
                if (!(ex is OperationExceptionFacade))
                {
                    LogFactory.GetLogger().Log(LogLevel.Error, ex);
                }
            }

            return(Json(apiResult));
        }
        public ActionResult _Material(long roomId)
        {
            ViewBag.RoomId = roomId;

            var room = RoomBll.GetById(roomId);

            ViewBag.RoomTypeId = room.RoomTypeId;
            ViewBag.RoomRegId  = room.RoomRegId;

            if (room.LastCleanEmployeeId != 0)
            {
                if (room.FjState != FjStateEnum.脏房)
                {
                    ViewBag.EmployeeId = room.LastCleanEmployeeId;
                    var employee = EmployeeBll.GetById(room.LastCleanEmployeeId);
                    ViewBag.EmployeeName = employee.Name;
                }


                ViewBag.IsMaterialChangeEveryday = room.IsMaterialChangeEveryday;
                ViewBag.IsMaterialChangeWash     = room.IsMaterialChangeWash;
            }
            else
            {
                ViewBag.IsMaterialChangeEveryday = true;
                ViewBag.IsMaterialChangeWash     = true;
            }



            return(View());
        }
        public string GetListB_Room(long roomId)
        {
            var room   = RoomBll.GetById(roomId);
            var models = DisposableMaterialBll.GetList(UserContext.CurrentUser.HotelId);

            models = models.Where(a => !a.IsChangeEveryday).ToList();

            LoadQuantity(models, room.RoomTypeId);
            LoadRoomQuantity(models, roomId);
            return(JsonConvert.SerializeObject(models));
        }
        public ActionResult SplitRoom(long roomId)
        {
            var hotelId = UserContext.CurrentUser.HotelId;

            ViewBag.RoomId = roomId;

            var model = RoomBll.GetById(roomId);

            ViewBag.RoomRegId = model.RoomRegId;
            return(View(UserContext.CurrentUser));
        }
        /// <summary>
        /// 获取具体房间信息for联房
        /// </summary>
        /// <param name="roomId"></param>
        /// <returns></returns>
        public string GetRoomForLF(long roomId)
        {
            var model = RoomBll.GetById(roomId);
            List <RoomPrice> priceList = null;

            if (model == null)
            {
                model = new Room();
            }

            return(JsonConvert.SerializeObject(new { Room = model, PriceList = priceList }));
        }
        public ActionResult _Split(long roomId)
        {
            ViewBag.RoomId = roomId;

            var room = RoomBll.GetById(roomId);

            ViewBag.RoomTypeId = room.RoomTypeId;
            ViewBag.RoomRegId  = room.RoomRegId;



            return(View());
        }
Exemple #13
0
        public ActionResult Edit(long id = 0)
        {
            if (id == 0)
            {
                return(View(new Hotel.Model.Room()
                {
                    HotelId = UserContext.CurrentUser.HotelId
                }));
            }
            var info = RoomBll.GetById(id);

            return(View(info));
        }
        public ActionResult _SelTyly(long roomId)
        {
            ViewBag.RoomId = roomId;
            var room = RoomBll.GetById(roomId);
            var msg  = RoomBll.GetSpecialMessage(roomId);

            if (msg == null)
            {
                msg = new RoomMessage();
            }
            ViewBag.Message = msg;

            ViewBag.LockBz = room.LockBz;
            return(View());
        }
        /// <summary>
        /// 获取具体房间信息
        /// </summary>
        /// <param name="roomId"></param>
        /// <returns></returns>
        public string GetRoom(long roomId)
        {
            var model = RoomBll.GetById(roomId);
            List <RoomPrice> priceList = null;

            if (model != null)
            {
                //根据房型id获取房价方案
                priceList = RoomPriceBll.GetList(UserContext.CurrentUser.HotelId, model.RoomTypeId);
            }
            else
            {
                model = new Room();
            }
            return(JsonConvert.SerializeObject(new { Room = model, PriceList = priceList }));
        }
        public string GetNewRoomPrice(int type, long fnid, long roomId)
        {
            var now = DateTime.Now;

            var room     = RoomBll.GetById(roomId);
            var roomType = RoomTypeBll.GetById(room.RoomTypeId);

            if (type == (int)KaifangFangshiEnum.钟点房)
            {
                //钟点房
                var hourRoomList = HourRoomBll.GetList(UserContext.CurrentUser.HotelId);
                if (hourRoomList == null || hourRoomList.Count == 0)
                {
                    return(JsonConvert.SerializeObject(new { Ret = -1, Msg = "无钟点房方案" }));
                }
                var hourRoom = hourRoomList[0];//默认选择第一个
                if (fnid != 0 && hourRoomList.Any(a => a.Id == fnid))
                {
                    hourRoom = hourRoomList.FirstOrDefault(a => a.Id == fnid);
                }
                var yltime = now.AddMinutes(hourRoom.Minute).ToString("yyyy-MM-dd HH:mm:ss");


                return(JsonConvert.SerializeObject(new { Ret = 0, Id = hourRoom.Id, RoomPrice = hourRoom.Price }));
            }
            else if (type == (int)KaifangFangshiEnum.时段房)
            {
                //时段房
                var periodRoomList = PeriodRoomBll.GetList(UserContext.CurrentUser.HotelId);
                if (periodRoomList == null || periodRoomList.Count == 0)
                {
                    return(JsonConvert.SerializeObject(new { Ret = -1, Msg = "无时段房方案" }));
                }

                if (fnid != 0 && periodRoomList.Any(a => a.Id == fnid))
                {
                    var periodRoom  = periodRoomList.FirstOrDefault(a => a.Id == fnid);
                    var CurrentTime = now.ToString("yyyy-MM-dd HH:mm:ss");
                    var YlTime      = now.ToShortDateString() + $" {periodRoom.EndPoint}:00:00";
                    return(JsonConvert.SerializeObject(new { Ret = 0, Id = periodRoom.Id, RoomPrice = periodRoom.Price }));
                }

                return(JsonConvert.SerializeObject(new { Ret = -1, Msg = "无匹配的时段房方案,请手动选择" }));
            }
            return("");
        }
        public ActionResult _BatchMaterial(string roomIds)
        {
            ViewBag.RoomIds = roomIds;

            var roomids = roomIds.Split(',');
            var room    = RoomBll.GetById(Convert.ToInt64(roomids[0]));

            ViewBag.RoomId     = room.Id;
            ViewBag.RoomTypeId = room.RoomTypeId;
            ViewBag.RoomRegId  = room.RoomRegId;

            ViewBag.IsMaterialChangeEveryday = true;
            ViewBag.IsMaterialChangeWash     = true;



            return(View());
        }
Exemple #18
0
        public ActionResult Delete(long id)
        {
            var apiResult = new APIResult();

            try
            {
                RoomBll.Delete(id);
            }
            catch (Exception ex)
            {
                apiResult.Ret = -1;
                apiResult.Msg = ex.Message;
                if (!(ex is OperationExceptionFacade))
                {
                    LogFactory.GetLogger().Log(LogLevel.Error, ex);
                }
            }
            return(Json(apiResult));
        }
        public string BatchRoomList(int page, int rows, long buildId, long floorId, string roomNO, string changeType)
        {
            var models = RoomBll.GetPager(page, rows, UserContext.CurrentUser.HotelId, buildId, floorId, roomNO, changeType);



            foreach (var item in models.rows)
            {
                if (item.RoomRegId != 0)
                {
                    item.RoomReg = RoomRegBll.GetById(item.RoomRegId);
                }


                LoadRoomInfo2(item);
            }

            return(JsonConvert.SerializeObject(models));
        }
        public ActionResult SaveSpecialMessage(long roomId, RoomMessage msg)
        {
            var apiResult = new APIResult();

            try
            {
                RoomBll.SaveSpecialMessage(roomId, msg.MsgContent, msg.IsEnabled);
            }
            catch (Exception ex)
            {
                apiResult.Ret = -1;
                apiResult.Msg = ex.Message;
                if (!(ex is OperationExceptionFacade))
                {
                    LogFactory.GetLogger().Log(LogLevel.Error, ex);
                }
            }

            return(Json(apiResult));
        }
        /// <summary>
        /// 提交换房
        /// </summary>
        /// <param name="OldRoomId"></param>
        /// <param name="NewRoomId"></param>
        /// <param name="Remark"></param>
        /// <param name="RoomPriceFaId"></param>
        /// <param name="ChangeType"></param>
        /// <returns></returns>
        public ActionResult SaveChangeRoom(RoomChangeRecord data)
        {
            var apiResult = new APIResult();

            try
            {
                RoomBll.SaveChangeRoom(data);
            }
            catch (Exception ex)
            {
                apiResult.Ret = -1;
                apiResult.Msg = ex.Message;
                if (!(ex is OperationExceptionFacade))
                {
                    LogFactory.GetLogger().Log(LogLevel.Error, ex);
                }
            }

            return(Json(apiResult));
        }
        public ActionResult SaveBatchRoomStatus(long[] roomIds, string changeType, long EmployeeId = 0)
        {
            var apiResult = new APIResult();

            try
            {
                RoomBll.SaveBatchRoomStatus(roomIds, changeType, EmployeeId);
            }
            catch (Exception ex)
            {
                apiResult.Ret = -1;
                apiResult.Msg = ex.Message;
                if (!(ex is OperationExceptionFacade))
                {
                    LogFactory.GetLogger().Log(LogLevel.Error, ex);
                }
            }

            return(Json(apiResult));
        }
        public ActionResult SetStartCleanRoom(long roomId, long employeeId)
        {
            var apiResult = new APIResult();

            try
            {
                RoomBll.SetStartCleanRoom(roomId, employeeId);
            }
            catch (Exception ex)
            {
                apiResult.Ret = -1;
                apiResult.Msg = ex.Message;
                if (!(ex is OperationExceptionFacade))
                {
                    LogFactory.GetLogger().Log(LogLevel.Error, ex);
                }
            }

            return(Json(apiResult));
        }
        /// <summary>
        /// 脏住房清理干净
        /// </summary>
        /// <param name="roomId"></param>
        /// <returns></returns>
        public JsonResult ZZFSetToClean(long roomId)
        {
            var apiResult = new APIResult();

            try
            {
                RoomBll.ZZFSetToClean(roomId);
            }
            catch (Exception ex)
            {
                apiResult.Ret = -1;
                apiResult.Msg = ex.Message;
                if (!(ex is OperationExceptionFacade))
                {
                    LogFactory.GetLogger().Log(LogLevel.Error, ex);
                }
            }

            return(Json(apiResult));
        }
Exemple #25
0
        public JsonResult Edit(Hotel.Model.Room model)
        {
            var apiResult = new APIResult();

            try
            {
                RoomBll.AddOrUpdate(model, UserContext.CurrentUser.HotelId);
            }
            catch (Exception ex)
            {
                apiResult.Ret = -1;
                apiResult.Msg = ex.Message;
                if (!(ex is OperationExceptionFacade))
                {
                    LogFactory.GetLogger().Log(LogLevel.Error, ex);
                }
            }

            return(Json(apiResult));
        }
        /// <summary>
        /// 房态里面单个房间的HTML部分
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ActionResult _Room(long id)
        {
            var hotelId = UserContext.CurrentUser.HotelId;
            var roomSet = RoomSetBll.GetBy(hotelId);

            if (roomSet == null)
            {
                roomSet = RoomSetBll.GetBy(0);
            }


            var today = Convert.ToDateTime(DateTime.Now.ToShortDateString());

            var item = RoomBll.GetById(id);

            if (item.RoomRegId != 0)
            {
                item.RoomReg = roomRegs.Where(a => a.Id == item.RoomRegId).FirstOrDefault();
            }
            LoadRoomInfo(item);
            return(View(item));
        }
        /// <summary>
        /// 凌晨房检测,返回凌晨价
        /// </summary>
        /// <param name="roomId"></param>
        /// <returns></returns>
        public string LCRoomCheck(long roomId)
        {
            try
            {
                var hotelId  = UserContext.CurrentUser.HotelId;
                var model    = RoomBll.GetById(roomId);
                var roomType = RoomTypeBll.GetById(model.RoomTypeId);
                var setting  = GlobalFeeSetBll.GetByHotelId(hotelId);

                var now = DateTime.Now;

                if (now.Hour >= setting.LCStartFeePoint && now.Hour <= setting.LCEndFeePoint)
                {
                    return(JsonConvert.SerializeObject(new { IsLC = true, RoomPrice = roomType.MorningPrice }));
                }
                return(JsonConvert.SerializeObject(new { IsLC = false }));
            }
            catch
            {
                return(JsonConvert.SerializeObject(new { IsLC = false }));
            }
        }
        public JsonResult SaveRoomsMaterial(string dataJson, Room model, string Ids)
        {
            var apiResult = new APIResult();

            try
            {
                var data = new System.Web.Script.Serialization.JavaScriptSerializer().Deserialize <List <DisposableMaterial> >(dataJson);

                RoomBll.SaveRoomsMaterial(data, model, Ids);
            }
            catch (Exception ex)
            {
                apiResult.Ret = -1;
                apiResult.Msg = ex.Message;
                if (!(ex is OperationExceptionFacade))
                {
                    LogFactory.GetLogger().Log(LogLevel.Error, ex);
                }
            }

            return(Json(apiResult));
        }
        /// <summary>
        /// 选择房号界面获取房号列表
        /// </summary>
        /// <param name="roomTypeId"></param>
        /// <returns></returns>
        public string GetRoomList(long roomTypeId, long buildId = 0, long floorId = 0, string roomNO = "")
        {
            var models = RoomBll.GetListBy2(UserContext.CurrentUser.HotelId, buildId, floorId, roomTypeId, roomNO);

            return(JsonConvert.SerializeObject(models));
        }
        /// <summary>
        /// 根据开房方式获取预离时间,同时绑定钟点房方案id或时段房方案id
        /// 20190828同时绑定价格
        /// </summary>
        /// <returns></returns>
        public string GetYlTimeByKffs(long roomRegId, int type, int rzDays, long fnid = 0, long roomId = 0)
        {
            var roomReg = RoomRegBll.GetById(roomRegId);
            var now     = DateTime.Now;

            if (roomReg != null)
            {
                now = TypeConvert.IntToDateTime(roomReg.RegTime);
            }

            var room     = RoomBll.GetById(roomId);
            var roomType = RoomTypeBll.GetById(room.RoomTypeId);

            if (type == (int)KaifangFangshiEnum.全天房 || type == (int)KaifangFangshiEnum.长包房 || type == (int)KaifangFangshiEnum.免费房)
            {
                var globalFeeSet = GlobalFeeSetBll.GetByHotelId(UserContext.CurrentUser.HotelId);
                if (globalFeeSet == null)
                {
                    return(JsonConvert.SerializeObject(new { Ret = 0, CurrentTime = now.ToString("yyyy-MM-dd HH:mm:ss"), YlTime = "" }));
                }

                var yltime = now;
                //如果是6点,那么当天6点之后开的房间就是第二天中午退房,0点到6点开房就是当天中午退房
                if (now.Hour >= 0 && now.Hour <= globalFeeSet.QTAfterPointToNextDay)
                {
                    //当天中午退房
                    yltime = now.Date.AddDays(rzDays - 1).AddHours(globalFeeSet.QTExitPoint);
                }
                else
                {
                    //第二天中午退房
                    yltime = now.Date.AddDays(1 + (rzDays - 1)).AddHours(globalFeeSet.QTExitPoint);
                }

                if (type != (int)KaifangFangshiEnum.免费房)
                {
                    return(JsonConvert.SerializeObject(new {
                        Ret = 0,
                        CurrentTime = now.ToString("yyyy-MM-dd HH:mm:ss"),
                        YlTime = yltime.ToString("yyyy-MM-dd HH:mm:ss"),
                        RoomPrice = roomType.Price
                    }));
                }

                return(JsonConvert.SerializeObject(new { Ret = 0, CurrentTime = now.ToString("yyyy-MM-dd HH:mm:ss"), YlTime = yltime.ToString("yyyy-MM-dd HH:mm:ss") }));
            }
            else if (type == (int)KaifangFangshiEnum.钟点房)
            {
                //钟点房
                var hourRoomList = HourRoomBll.GetList(UserContext.CurrentUser.HotelId);
                if (hourRoomList == null || hourRoomList.Count == 0)
                {
                    return(JsonConvert.SerializeObject(new { Ret = -1, Msg = "无钟点房方案" }));
                }
                var hourRoom = hourRoomList[0];//默认选择第一个
                if (fnid != 0 && hourRoomList.Any(a => a.Id == fnid))
                {
                    hourRoom = hourRoomList.FirstOrDefault(a => a.Id == fnid);
                }
                var yltime = now.AddMinutes(hourRoom.Minute).ToString("yyyy-MM-dd HH:mm:ss");


                return(JsonConvert.SerializeObject(new { Ret = 0, CurrentTime = now.ToString("yyyy-MM-dd HH:mm:ss"), YlTime = yltime, Id = hourRoom.Id, RoomPrice = hourRoom.Price }));
            }
            else if (type == (int)KaifangFangshiEnum.时段房)
            {
                //时段房
                var periodRoomList = PeriodRoomBll.GetList(UserContext.CurrentUser.HotelId);
                if (periodRoomList == null || periodRoomList.Count == 0)
                {
                    return(JsonConvert.SerializeObject(new { Ret = -1, Msg = "无时段房方案" }));
                }

                if (fnid != 0 && periodRoomList.Any(a => a.Id == fnid))
                {
                    var periodRoom  = periodRoomList.FirstOrDefault(a => a.Id == fnid);
                    var CurrentTime = now.ToString("yyyy-MM-dd HH:mm:ss");
                    var YlTime      = now.ToShortDateString() + $" {periodRoom.EndPoint}:00:00";
                    return(JsonConvert.SerializeObject(new { Ret = 0, CurrentTime = CurrentTime, YlTime = YlTime, Id = periodRoom.Id, RoomPrice = periodRoom.Price }));
                }
                else
                {
                    foreach (var periodRoom in periodRoomList)
                    {
                        if (now.Hour >= periodRoom.StartPoint && now.Hour <= periodRoom.EndPoint)
                        {
                            var CurrentTime = now.ToString("yyyy-MM-dd HH:mm:ss");
                            var YlTime      = now.ToShortDateString() + $" {periodRoom.EndPoint}:00:00";
                            return(JsonConvert.SerializeObject(new { Ret = 0, CurrentTime = CurrentTime, YlTime = YlTime, Id = periodRoom.Id, RoomPrice = periodRoom.Price }));
                        }
                    }
                }

                return(JsonConvert.SerializeObject(new { Ret = -1, Msg = "无匹配的时段房方案,请手动选择" }));
            }
            return("");
        }