public string GetPager() { var pager = HolidaySetBll.GetList(UserContext.CurrentUser.HotelId); return(JsonConvert.SerializeObject(pager)); }
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 })); }