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 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 }))); }
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 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 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()); }
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()); }
/// <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 })); } }
/// <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(""); }
public string GetRoomInfo(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(); } Hotel.Model.RoomReg reg = null; if (model.RoomRegId != 0) { reg = RoomRegBll.GetById(model.RoomRegId); } var roomType = RoomTypeBll.GetById(model.RoomTypeId); var HolidaySet = HolidaySetBll.GetList(UserContext.CurrentUser.HotelId); var WeekendSet = WeekendSetBll.GetByHotelId(UserContext.CurrentUser.HotelId); var SalePrice = model.Price; //价 double SaleRate = 1.0; //折扣率 if (roomType.IsAllowWeekendRoom) //周末价判断 { if (WeekendSet.IsMonday && DateTime.Now.DayOfWeek == DayOfWeek.Monday) { SalePrice = roomType.WeekendPrice; } if (WeekendSet.IsTuesday && DateTime.Now.DayOfWeek == DayOfWeek.Tuesday) { SalePrice = roomType.WeekendPrice; } if (WeekendSet.IsWednesday && DateTime.Now.DayOfWeek == DayOfWeek.Wednesday) { SalePrice = roomType.WeekendPrice; } if (WeekendSet.IsThursday && DateTime.Now.DayOfWeek == DayOfWeek.Thursday) { SalePrice = roomType.WeekendPrice; } if (WeekendSet.IsFriday && DateTime.Now.DayOfWeek == DayOfWeek.Friday) { SalePrice = roomType.WeekendPrice; } if (WeekendSet.IsSaturday && DateTime.Now.DayOfWeek == DayOfWeek.Saturday) { SalePrice = roomType.WeekendPrice; } if (WeekendSet.IsSunday && DateTime.Now.DayOfWeek == DayOfWeek.Sunday) { SalePrice = roomType.WeekendPrice; } } if (roomType.IsAllowHolidayRoom) //假日价 { foreach (var h in HolidaySet) { var start = TypeConvert.IntToDateTime(h.StartDate); var end = TypeConvert.IntToDateTime(h.EndDate).AddDays(1).AddSeconds(-1); //定位在这天最后一秒 if (DateTime.Now > start && DateTime.Now < end) { SalePrice = roomType.HolidayPrice; } } } SaleRate = Convert.ToDouble(SalePrice) / Convert.ToDouble(model.Price); return(JsonConvert.SerializeObject(new { Room = model, RoomPrice = roomType.Price, SalePrice = SalePrice, SaleRate = SaleRate, PriceList = priceList, RoomReg = reg })); }
// GET: RoomReg public ActionResult Index(long roomId) { var user = UserContext.CurrentUser; var hotelId = user.HotelId; var room = RoomBll.GetById(roomId); var globalFeeSet = GlobalFeeSetBll.GetByHotelId(hotelId); ViewBag.HotelId = hotelId; ViewBag.RoomId = roomId; ViewBag.GlobalFeeSet = globalFeeSet; var now = DateTime.Now; DateTime yuLiTime = now; //如果是6点,那么当天6点之后开的房间就是第二天中午退房,0点到6点开房就是当天中午退房 if (now.Hour >= 0 && now.Hour <= globalFeeSet.QTAfterPointToNextDay) { //当天中午退房 yuLiTime = now.Date.AddHours(globalFeeSet.QTExitPoint); } else { //第二天中午退房 yuLiTime = now.Date.AddDays(1).AddHours(globalFeeSet.QTExitPoint); } //var yltime = ""; //if (now.Hour > globalFeeSet.QTAfterPointToNextDay) //{ // //第二天退房 // yltime = now.AddDays(1).ToShortDateString() + $" {globalFeeSet.QTExitPoint}:00:00"; //} //else //{ // //当天退房 // yltime = now.ToShortDateString() + $" {globalFeeSet.QTExitPoint}:00:00"; //} ViewBag.CurrentTime = now.ToString("yyyy-MM-dd HH:mm:ss"); ViewBag.yltime = yuLiTime.ToString("yyyy-MM-dd HH:mm:ss"); var my = UserBll.GetById(user.Id); ViewBag.MyKdzk = my == null ? 10 : my.CanSale; //获取登记单 var roomReg = new Model.RoomReg(); if (room != null) { if (room.FjState == FjStateEnum.干净房) { roomReg = new Model.RoomReg(); } else { roomReg = RoomRegBll.GetById(room.RoomRegId); if (roomReg == null) { roomReg = new Model.RoomReg(); } } if ((int)roomReg.FjState >= (int)FjStateEnum.脏房) { // return Content("房间状态不允许开房登记"); } //if(roomReg.FjState ==4) // roomReg = new Model.RoomReg(); } ViewBag.PanelHeight = 300; if (Session["PanelHeight"] != null) { ViewBag.PanelHeight = Convert.ToInt32(Session["PanelHeight"]); } if (room == null) { room = new Room(); ViewBag.IsEmptyRoom = true; } else { ViewBag.IsEmptyRoom = false; } ViewBag.Room = room; return(View(roomReg)); }