Exemple #1
0
        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 = Miaow.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);
        }
Exemple #2
0
 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 = Miaow.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);
 }