public ActionResult AddHotelComm(FormCollection f) { if (f != null) { try { iPow.Infrastructure.Data.DataSys.Sys_HotelComm hc = new Infrastructure.Data.DataSys.Sys_HotelComm(); #region init hc.AddTime = System.DateTime.Now; //hc.CommID = Bll.DbSys.Db.Sys_HotelComm.Max(e => e.CommID) + 1; if (f["Content"] != null) { hc.Content = f["Content"]; } if (f["HotelID"] != null) { hc.HotelID = int.Parse(f["HotelID"].ToString()); } hc.Ip = iPow.Infrastructure.Crosscutting.Function.StringHelper.GetRealIP(); if (hc.Ip == "::1") { hc.Ip = "127.0.0.1"; } if (f["Sroce"] != null) { hc.Point = int.Parse(f["Sroce"].ToString()); } hc.UserID = 0; if (f["UserName"] != null) { hc.UserName = f["UserName"].ToString(); } #endregion hotelCommRepository.Add(hc); hotelCommRepository.Uow.Commit(); var hotelInfo = hotelPropertyInfoRepository.GetList(e => e.ID == hc.HotelID).FirstOrDefault(); hotelInfo.CommCount += 1; hotelPropertyInfoRepository.Uow.Commit(); int total = 0; List <iPow.Domain.Dto.Sys_HotelCommDto> hcs = hotelCommSysService.GetHotelCommPageListByHotelId(hc.HotelID, 1, 5, ref total); PagedList <iPow.Domain.Dto.Sys_HotelCommDto> hcList = null; if (hcs != null && hcs.Count() > 0) { hcList = new PagedList <iPow.Domain.Dto.Sys_HotelCommDto>(hcs, 1, commPageSize, total); } ViewBag.hotelid = hc.HotelID; return(PartialView("HotelCommListPartial", hcList)); } catch { return(Json("", JsonRequestBehavior.AllowGet)); } } return(Json("", JsonRequestBehavior.AllowGet)); }
/// <summary> /// 获得所有的Hotal By City + 分页 /// </summary> /// <param name="city"></param> /// <param name="pi"></param> /// <param name="take"></param> /// <returns></returns> public PagedList <iPow.Domain.Dto.Sys_HotelPropertyInfoDto> GetAllHotelByCity(string city, int pi, int take) { var res = hotelPropertyInfoRepository.GetList(d => d.City == city) .OrderByDescending(e => e.VisitCount).AsEnumerable(); int total = res.Count(); //if (res.Count() < 15) // pi = pi - 1; //pi = (pi - 1) > 0 ? (pi - 1) : 0; res = res.Skip(((pi - 1) > 0 ? (pi - 1) : 0) * take).Take(take); var temp = new Webdiyer.WebControls.Mvc.PagedList <iPow.Domain.Dto.Sys_HotelPropertyInfoDto>(res.ToDto(), pi, take, total); return(temp); }
public bool DeleteTrue(IList <int> idList, iPow.Infrastructure.Data.DataSys.Sys_AdminUser operUser) { var res = false; if (idList != null && idList.Count > 0) { var delete = hotelPropertyInfoRepository.GetList(e => idList.Contains(e.ID)).ToList(); if (delete != null && delete.Count > 0) { res = DeleteTrue(delete, operUser); } } return(res); }
/// <summary> /// Gets the tour detail hotel by id and day. /// </summary> /// <param name="id">The id.</param> /// <param name="day">The day.</param> /// <returns></returns> public IQueryable <Dto.TourDetailHotelDto> GetTourDetailHotelByIdAndDay(int id, int day) { IQueryable <Dto.TourDetailHotelDto> data = null; var hotelList = GetSightOrHotelIdList(id, "hotel", day); data = hotelPropertyInfoRepository.GetList(e => hotelList.Contains(e.ID)) .Select(e => new Dto.TourDetailHotelDto { Address = e.Address, HotelId = e.HotelID, IdentityId = e.ID, MinPrice = (e.MinPrice == null ? 0.0 : e.MinPrice), Name = e.HotelName, PlanId = id, Type = e.HotelClass }).AsQueryable(); return(data); }
public JsonResult AjaxCheckTargetName(string id) { var res = false; var targetTypeStr = Request["targetType"]; if (targetTypeStr != null && !string.IsNullOrEmpty(id)) { var targetType = targetTypeStr.ToString(); id = id.Trim(); if (string.Compare(targetType, "sight", false) == 0) { res = sightInfoRepository.GetList().Where(e => e.Title == id).Any(); } else if (string.Compare(targetType, "hotel", false) == 0) { res = hotelPropertyInfoRepository.GetList().Where(e => e.HotelName == id).Any(); } else { res = true; } } return(Json(res, JsonRequestBehavior.AllowGet)); }
/// <summary> /// Inits the cir hotel info. /// 初始化当前景区附近的酒店信息列表 /// 前10条 /// </summary> /// <param name="sight">The sight.</param> /// <param name="take">The take.</param> /// <returns></returns> public List <iPow.Domain.Dto.Sys_HotelPropertyInfoDto> GetCirHotelListBySight(iPow.Domain.Dto.Sys_SightInfoDto sight, int take) { var sightCirHotelIdList = sightInfoCirHotelRepository.GetList(e => e.SightId == sight.ParkID).Select(e => e.HotelId); var hi = (from e in hotelPropertyInfoRepository.GetList() where sightCirHotelIdList.Contains(e.ID) && !string.IsNullOrEmpty(e.latitude) && !string.IsNullOrEmpty(e.longitude) orderby e.VisitCount descending select e).Take(take).ToList(); #region modified by yjihrp 2012.3.28.16.05 //景区表添加 //var cir = sight.CirHotelID; //List<iPow.Infrastructure.Data.DataSys.Sys_HotelPropertyInfo> hi = null; //if (!string.IsNullOrEmpty(cir)) //{ // cir = (cir.Length > 1 && (cir.LastIndexOf(',') == 0)) ? cir.Substring(0, cir.Length - 1) : cir; // string[] cirStrArray = cir.Split(','); // List<int?> cirList = new List<int?>(); // for (int i = 0; i < cirStrArray.Length; i++) // { // int temp = 0; // int.TryParse(cirStrArray[i], out temp); // if (temp != 0) // { cirList.Add(temp); } // } // hi = (from e in hotelPropertyInfoRepository.GetList() // where cirList.Contains(e.ID) && // !string.IsNullOrEmpty(e.latitude) && // !string.IsNullOrEmpty(e.longitude) // orderby e.VisitCount descending // select e).Take(take).ToList(); //} #endregion return(hi.ToDto().ToList()); }
/// <summary> /// Gets the search tour model advanced. /// </summary> /// <param name="search">The search.</param> /// <param name="sort">The sort.</param> /// <param name="min">The min.</param> /// <param name="max">The max.</param> /// <param name="day">The day.</param> /// <param name="type">The type.</param> /// <param name="pageIndex">Index of the page.</param> /// <param name="take">The take.</param> /// <param name="total">The total.</param> /// <returns></returns> public IQueryable <Dto.SearchTourDto> GetSearchTourModelAdvanced(string search, string sort, int min, int max, int day, List <string> type, int pageIndex, int take, ref int total) { IQueryable <Dto.SearchTourDto> data = null; var temp = tourPlanRepository.GetList(e => e.IsDelete == 0) //search .Where(e => e.PlanTitle.Contains(search) || e.Destination.Contains(search) || e.Remark.Contains(search)) .Select(e => new Dto.SearchTourDto { ViCount = e.VisitCount, Id = e.PlanID, PlanTitle = e.PlanTitle, Days = e.Days, TopReason = e.Destination, PlanTotalMoney = tourPlanDetailRepository.GetList(c => c.PlanID == e.PlanID).Sum(d => d.CurrentPrice), UserName = e.UserName, ClassId = e.PlanClass, AddTime = e.AddTime }); //day if (day != 0) { temp = temp.Where(e => e.Days <= day); } //type if (type.Count > 0) { temp = temp.Where(e => tourPlanDetailRepository.GetList(t => hotelPropertyInfoRepository.GetList(q => tourPlanDetailRepository.GetList(d => d.DetailType == "hotel") .Select(d => d.SightIDOrHotelID).Distinct().Contains(q.HotelID)) .Where(w => type.Contains(w.HotelClass)) .Select(r => r.HotelID) .Contains(t.SightIDOrHotelID)) .Select(y => y.PlanID) .Distinct().Contains(e.Id) ); } //min and max //0-200 //200-400 //400-600 if (min >= 0 && max > 0) { temp = temp.Where(e => (e.PlanTotalMoney == null ? 0.0 : (int)e.PlanTotalMoney) >= min && e.PlanTotalMoney <= max); } //600- else if (max <= 0) { temp = temp.Where(e => (e.PlanTotalMoney == null ? 0.0 : e.PlanTotalMoney) >= min); } else { } //total total = temp.Count(); //sort if (sort.ToLower().CompareTo("priceasc") == 0) { temp = temp.OrderBy(e => e.PlanTotalMoney); } else if (sort.ToLower().CompareTo("pricedesc") == 0) { temp = temp.OrderByDescending(e => e.PlanTotalMoney); } else if (sort.ToLower().CompareTo("daysasc") == 0) { temp = temp.OrderBy(e => e.Days); } else if (sort.ToLower().CompareTo("daysdesc") == 0) { temp = temp.OrderByDescending(e => e.Days); } else { temp = temp.OrderByDescending(e => e.ViCount); } //pi data = temp.Skip(((pageIndex - 1) < 0 ? 0 : (pageIndex - 1)) * take) .Take(take).AsQueryable(); return(data); }
public iPow.Domain.Dto.Sys_HotelPropertyInfoDto GetHotelInfoByID(int Id) { var res = hotelPropertyInfoRepository.GetList(e => e.HotelID == Id).First(); return(res.ToDto()); }
/// <summary> /// Gets the hotel info count. /// </summary> /// <returns></returns> public int GetHotelInfoCount() { return(hotelPropertyInfoRepository.GetList().Count()); }