public ActionResult SearchAdvanced(string b, string or, int min, int max, int d, string t, int pi) { SearchInfoDto data = new SearchInfoDto(); data.Bide = Server.UrlDecode(b); List <string> hotelList = new List <string>(); if (!string.IsNullOrEmpty(t)) //判断是否为空 { t = Server.UrlDecode(t); var typeList = t.Split('|').ToList(); hotelList.AddRange(typeList); } int total = 0; IQueryable <SearchTourDto> iq = null; PagedList <SearchTourDto> model = null; if (!string.IsNullOrEmpty(b)) { iq = searchService.GetSearchTourModelAdvanced(data.Bide, or, min, max, d, hotelList, (pi <= 0 ? 1 : pi), pageSize, ref total); model = new PagedList <SearchTourDto>(iq, pi, pageSize, total); } data.Bide = b; ViewBag.para = data; ViewBag.sort = or; ViewBag.day = d; ViewBag.min = min; ViewBag.max = max; ViewBag.hotel = t; return(View(model)); }
public ViewResult Index(FormCollection f) { string bide = string.Empty; string comeTime = string.Empty; string leaveTime = string.Empty; string key = string.Empty; //入住地 if (f["txtBide"] != null) { bide = f["txtBide"].ToString(); } //入住时间 if (f["txtComeTime"] != null) { comeTime = f["txtComeTime"].ToString(); } //离店时间 if (f["txtLeaveTime"] != null) { leaveTime = f["txtLeaveTime"].ToString(); } //关键词 if (f["txtKeyword"] != null) { key = f["txtKeyword"].ToString(); } SearchInfoDto sm = new SearchInfoDto(); sm.Bide = bide; sm.Key = key + ""; try { sm.ComeTime = DateTime.Parse(comeTime); sm.LeaveTime = DateTime.Parse(leaveTime); } catch { } int total = 0; if (!string.IsNullOrEmpty(bide)) { var keyCopy = iPow.Infrastructure.Crosscutting.Function.StringHelper.StrToUrlGbk(key); var data = hotelSearchService.GetHotelSearchModel(comeTime.Replace("-", "_"), bide, keyCopy); total = data.total; sm.HotelBaseInfo = new Webdiyer.WebControls.Mvc.PagedList <SearchHotelDetailDto>(data.hotel_list, 1, pageSize, total); } return(View(sm)); }
/// <summary> /// Inits the sight info. /// </summary> /// <param name="str">The STR.</param> /// <param name="pageIndex">Index of the page.</param> /// <param name="pageSize">Size of the page.</param> /// <returns></returns> public SearchInfoDto GetSearchModel(string str, int?pageIndex, int?pageSize) { SearchInfoDto data = new SearchInfoDto(); iPow.Infrastructure.Crosscutting.Comm.Service.SightInfoSearchService sightInfoService = new Infrastructure.Crosscutting.Comm.Service.SightInfoSearchService(); var sortCity = sightInfoService.GetSearchModel(str); data.SightInfoList = AddSortSightInfoByGlobal(sortCity.ToList(), (int)pageIndex, (int)pageSize) .AsQueryable().ToPagedList(pageIndex ?? 1, pageSize ?? 10); return(data); }
public ViewResult Index(FormCollection f) { SearchInfoDto data = new SearchInfoDto(); if (f["txtDays"] != null) { //字符串表现形式转换为等同它的32位有效字符 data.Days = int.Parse(f["txtDays"].ToString()); } if (f["txtMoney"] != null) { data.Money = int.Parse(f["txtMoney"].ToString()); } if (f["txtSearch"] != null) { data.Bide = f["txtSearch"].ToString(); } if (f["RadioGroup1"] != null) { data.Type = f["RadioGroup1"].ToString(); } int total = 0; IQueryable <SearchTourDto> iq = searchService.GetSearchTourModel(data, 1, pageSize, ref total); PagedList <SearchTourDto> model = new PagedList <SearchTourDto>(iq, 1, pageSize, total); data.Bide = Server.UrlEncode(data.Bide); ViewBag.para = data; #region add var searchInfo = new Sys_SearchInfo(); searchInfo.Ip = iPow.Infrastructure.Crosscutting.Function.StringHelper.GetRealIP(); if (searchInfo.Ip.Equals("::1")) { searchInfo.Ip = "127.0.0.1"; } searchInfo.KeyWord = Server.UrlDecode(data.Bide); //searchInfo.SearchID = searchInfoReopsitory.GetList().Max(d=> d.); searchInfo.AddTime = System.DateTime.Now; searchInfo.City = String.Empty; try { searchInfoReopsitory.Add(searchInfo); searchInfoReopsitory.Uow.Commit(); } catch (Exception ex) { string massage = ex.Message; } #endregion return(View(model)); }
public ActionResult Result(string b, int d, string t, int p, int pi) { SearchInfoDto data = new SearchInfoDto(); data.Bide = Server.UrlDecode(b); data.Days = d; data.Type = t; data.Money = p; int total = 0; IQueryable <SearchTourDto> iq = searchService.GetSearchTourModel(data, (pi <= 0 ? 1 : pi), pageSize, ref total); PagedList <SearchTourDto> model = new PagedList <SearchTourDto>(iq, (pi <= 0 ? 1 : pi), pageSize, total); data.Bide = Server.UrlEncode(data.Bide); ViewBag.para = data; return(View(model)); }
public ActionResult SearchAll(FormCollection f) { SearchInfoDto data = new SearchInfoDto(); string sorter = "def"; int min = -1; int max = -1; int day = 0; List <string> hotelList = new List <string>(); #region sorter if (f["sorter"] != null) { sorter = f["sorter"].ToString(); } #endregion #region price if (f["priceFilter1"] != null) { min = 0; max = 200; } if (f["priceFilter2"] != null) { min = 201; max = 400; } if (f["priceFilter3"] != null) { min = 401; max = 600; } if (f["priceFilter4"] != null) { min = 601; max = 0; } #endregion #region day if (f["daysFilter2"] != null) { day = 2; } if (f["daysFilter4"] != null) { day = 4; } if (f["daysFilter6"] != null) { day = 6; } if (f["daysFilter8"] != null) { day = -1; } #endregion #region hotelList if (f["hotelFilter1"] != null) { hotelList.Add("招待所"); } if (f["hotelFilter2"] != null) { hotelList.Add("度假村"); } if (f["hotelFilter3"] != null) { hotelList.Add("农家乐"); } if (f["hotelFilter4"] != null) { hotelList.Add("三星级"); } if (f["hotelFilter5"] != null) { hotelList.Add("四星级"); } if (f["hotelFilter6"] != null) { hotelList.Add("五星级"); } if (f["hotelFilter7"] != null) { hotelList.Add("经济型酒店"); } if (f["hotelFilter8"] != null) { hotelList.Add("酒店式公寓"); } #endregion #region bide if (f["txtBide"] != null) { data.Bide = f["txtBide"]; } #endregion int total = 0; IQueryable <SearchTourDto> iq = null; PagedList <SearchTourDto> model = null; if (!string.IsNullOrEmpty(data.Bide)) { iq = searchService.GetSearchTourModelAdvanced(data.Bide, sorter, min, max, day, hotelList, 1, pageSize, ref total); model = new PagedList <SearchTourDto>(iq, 1, pageSize, total); } data.Bide = Server.UrlEncode(data.Bide); string typeList = string.Empty; foreach (var item in hotelList) { typeList += item + "|"; } if (typeList.Length > 1) { typeList = typeList.Remove(typeList.Length - 1, 1); } ViewBag.para = data; ViewBag.sort = sorter; ViewBag.day = day; ViewBag.min = min; ViewBag.max = max; ViewBag.hotel = Server.UrlEncode(typeList); return(View(model)); }
public ViewResult SearchAll(string bide, string key, string cometime, string leavetime, int?min, int?max, string starts, string mintomax, int pi) { SearchInfoDto sm = new SearchInfoDto(); sm.Bide = bide; sm.Key = key; DateTime come = System.DateTime.Now; DateTime leave = System.DateTime.Now.AddDays(2); try { come = DateTime.Parse(cometime); leave = DateTime.Parse(leavetime); } catch { } sm.ComeTime = come; sm.LeaveTime = leave; int total = 0; pi = pi <= 0 ? 1 : pi; if (string.IsNullOrEmpty(starts)) { starts = "all"; } if (string.IsNullOrEmpty(mintomax)) { mintomax = "def"; } ViewBag.min = min; ViewBag.max = max; ViewBag.mintomax = mintomax; ViewBag.starts = starts; if (!string.IsNullOrEmpty(bide)) { var keyCopy = iPow.Infrastructure.Crosscutting.Function.StringHelper.StrToUrlGbk(key); var strMin = "0"; if (min == null) { strMin = "0"; } else { strMin = min.ToString(); } var strMax = "0"; if (max == null) { strMax = "0"; } else { strMax = max.ToString(); } var strType = ""; strType = GetHotelType(starts); var order = "0"; order = GetOrderType(mintomax); if (pi < 0) { pi = 1; } var data = hotelSearchService.GetHotelSearchModel(come.ToString("yyyy-MM-dd").Replace("-", "_"), bide, keyCopy, pi.ToString(), strMin, strMax, strType, order); total = data.total; sm.HotelBaseInfo = new Webdiyer.WebControls.Mvc.PagedList <SearchHotelDetailDto>(data.hotel_list, pi, pageSize, total); } return(View(sm)); }