Exemplo n.º 1
0
        public ActionResult DoSearch()
        {
            ELongApiBiz elongBiz = ELongApiBiz.GetInstant();
            GetHotelConditionForGetHotelList condition = new GetHotelConditionForGetHotelList();

            condition = WebUtil.Eval(condition, "", "");
            PageList <HotelForGetHotelList> hotels = elongBiz.getHotelList(condition);

            return(JsonText(hotels, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 2
0
        public ActionResult TableHotelRoomPriceInfo2(string hotelId, DateTime checkInDate, DateTime checkOutDate)
        {
            ELongApiBiz elongBiz = ELongApiBiz.GetInstant();
            //PriceHotel[] priceInfo = elongBiz.getHotelRoomPrice(hotelId, checkInDate, checkOutDate);
            GetHotelConditionForGetHotelList condition = new GetHotelConditionForGetHotelList();

            condition.CheckInDate  = checkInDate;
            condition.CheckOutDate = checkOutDate;
            condition.HotelId      = hotelId;

            HotelForGetHotelList hotel = elongBiz.getHotelList(condition).ElementAt <HotelForGetHotelList>(0);
            ICriteria            icr   = BaseZdBiz.CreateCriteria <HotelRoomModel>();

            icr.Add(Restrictions.Eq("hotelFk", hotelId));
            IList <HotelRoomModel> rooms = icr.List <HotelRoomModel>();

            ViewData[typeof(HotelRoomModel).Name]       = rooms;
            ViewData[typeof(HotelForGetHotelList).Name] = hotel;
            ViewData["checkInDate"]  = checkInDate.ToString(DateTimeUtil.PATTERN_DB_DATE);
            ViewData["checkOutDate"] = checkOutDate.ToString(DateTimeUtil.PATTERN_DB_DATE);
            return(View());
        }
Exemplo n.º 3
0
        public ActionResult ViewHotelSearch(string viewName, string cityName, DateTime?checkInDate, DateTime?checkOutDate, string keyword, string hotelId
                                            , string star, string priceRegexp, string geoLlId, string geoClId, string geoDid, string brandName, string orderbyCode, string orderbyType
                                            , decimal?startLng, decimal?endLng, decimal?startLat, decimal?endLat, string geoMode, int?radius
                                            )
        {
            ELongApiBiz elongBiz = ELongApiBiz.GetInstant();
            GeoBiz      geoBiz   = GeoBiz.GetInstant();

            string cityId = geoBiz.GetGeoByCityName(cityName).cityCode;
            ToyzNumberRangeObject            priceRange = null;
            GetHotelConditionForGetHotelList condition  = new GetHotelConditionForGetHotelList();

            condition.CheckInDate  = checkInDate ?? this.getDefaultCheckInDate();
            condition.CheckOutDate = checkOutDate ?? this.getDefaultCheckOutDate();
            condition.CityId       = cityId;
            //condition.HotelName = keyword;
            condition.MaxRows   = this.getPager().size;
            condition.PageIndex = this.getPager().page;

            if (string.IsNullOrEmpty(geoMode) || geoMode == "0")
            {
                if (!string.IsNullOrEmpty(keyword))
                {
                    condition.HotelName = keyword;
                }

                if (!string.IsNullOrEmpty(hotelId))
                {
                    condition.HotelId = hotelId;
                    condition.CityId  = null;
                }

                if (!string.IsNullOrEmpty(brandName))
                {
                    condition.HotelName = brandName;
                }
                if (!string.IsNullOrEmpty(star))
                {
                    condition.StarCode = star;
                }

                if (!string.IsNullOrEmpty(priceRegexp))
                {
                    priceRegexp = HttpUtility.UrlDecode(priceRegexp);
                    IToyzObjcet toyzPrice = NumberUtil.ParseToyz(priceRegexp);
                    priceRange = toyzPrice as ToyzNumberRangeObject;
                    if (priceRange != null)
                    {
                        condition.LowestRate  = priceRange.min;
                        condition.HighestRate = priceRange.max;
                    }
                }

                if (!string.IsNullOrEmpty(geoLlId))
                {
                    condition.LandmarkLocationID = geoLlId;
                }
                else if (!string.IsNullOrEmpty(geoClId))
                {
                    condition.CommercialLocationId = geoClId;
                }
                else if (!string.IsNullOrEmpty(geoDid))
                {
                    condition.DistrictId = geoDid;
                }
            }
            else if (geoMode == "1")
            {
                condition.StartLatitude  = startLat ?? 0;
                condition.StartLongitude = startLng ?? 0;
                condition.EndLatitude    = endLat ?? 0;
                condition.EndLongitude   = endLng ?? 0;

                condition.PositionModeCode = geoMode;
            }
            else if (geoMode == "2")
            {
                condition.StartLatitude    = startLat ?? 0;
                condition.StartLongitude   = startLng ?? 0;
                condition.EndLatitude      = condition.StartLatitude;
                condition.EndLongitude     = condition.StartLongitude;
                condition.PositionModeCode = geoMode;
                condition.Radius           = radius ?? 0;
            }



            if (!string.IsNullOrEmpty(orderbyCode))
            {
                condition.OrderByCode   = orderbyCode;
                condition.OrderTypeCode = orderbyType;
            }
            else
            {
                condition.OrderTypeCode = "desc";
            }



            PageList <HotelForGetHotelList> hotels = elongBiz.getHotelList(condition);

            /*
             * if(priceRegexp!=null){
             *  foreach (HotelForGetHotelList hotel in hotels) {
             *      foreach()
             *      RoomForGetHotelList[] rooms = hotel.Rooms;
             *  }
             */



            IList <string> hotelIds = new List <string>();

            foreach (HotelForGetHotelList hotel in hotels)
            {
                hotelIds.Add(hotel.HotelId);
            }


            ICriteria icr = BaseZdBiz.CreateCriteria <HotelDetailModel>();

            icr.Add(Restrictions.In("id", hotelIds.ToArray()));

            IList <HotelDetailModel> hotelDetails = icr.List <HotelDetailModel>();

            icr = BaseZdBiz.CreateCriteria <HotelFeatrueInfoModel>();
            icr.Add(Restrictions.In("hotelId", hotelIds.ToArray()));
            IList <HotelFeatrueInfoModel> hotelFeats = icr.List <HotelFeatrueInfoModel>();

            Dictionary <string, HotelDetailModel>      dictHotelDetails = hotelDetails.ToDictionary(p => p.id);
            Dictionary <string, HotelFeatrueInfoModel> dictHotelFeat    = hotelFeats.ToDictionary(p => p.hotelId);

            ViewData[typeof(PageList <HotelForGetHotelList>).Name]       = hotels;
            ViewData[typeof(Dictionary <string, HotelDetailModel>).Name] = dictHotelDetails;
            ViewData[typeof(HotelFeatrueInfoModel).Name] = dictHotelFeat;
            ViewData[typeof(ToyzNumberRangeObject).Name] = priceRange;
            return(View(viewName));
        }