Example #1
0
        public RoomForGetHotelList getRoomForGetHotelList(string hotelId, string roomTypeId
                                                          , DateTime checkInDate, DateTime checkOutDate, int ratePlanId)
        {
            RoomForGetHotelList room = new RoomForGetHotelList();

            if (!this.login())
            {
                return(room);
            }
            GetHotelListRequest req = new GetHotelListRequest();

            req.RequestHead = this.requestHead;
            GetHotelConditionForGetHotelList conditon = new GetHotelConditionForGetHotelList();

            conditon.HotelId      = hotelId;
            conditon.RoomTypeID   = roomTypeId;
            conditon.CheckInDate  = checkInDate;
            conditon.CheckOutDate = checkOutDate;
            if (ratePlanId != 0)
            {
                conditon.RatePlanID = ratePlanId;
            }
            req.GetHotelCondition = conditon;
            GetHotelListResponse res = elongService.GetHotelList(req);

            if (res.HotelCount == 1)
            {
                if (res.Hotels[0].Rooms.Length == 1)
                {
                    room = res.Hotels[0].Rooms[0];
                }
            }
            return(room);
        }
Example #2
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));
        }
Example #3
0
        public PageList <HotelForGetHotelList> getHotelList(GetHotelConditionForGetHotelList condition)
        {
            PageList <HotelForGetHotelList> pagerList = null;

            if (!this.login())
            {
                return(pagerList);
            }
            GetHotelListRequest req = new GetHotelListRequest();

            req.RequestHead       = this.requestHead;
            req.GetHotelCondition = condition;
            GetHotelListResponse res = elongService.GetHotelList(req);

            HotelForGetHotelList[] hotels = res.Hotels;
            int total = res.HotelCount;
            IList <HotelForGetHotelList> listHotels = new List <HotelForGetHotelList>(hotels);

            pagerList = new PageList <HotelForGetHotelList>(listHotels, total);
            return(pagerList);
        }
Example #4
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());
        }
Example #5
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));
        }
Example #6
0
 public PageList<HotelForGetHotelList> getHotelList(GetHotelConditionForGetHotelList condition)
 {
     PageList<HotelForGetHotelList> pagerList = null;
     if (!this.login())
     {
         return pagerList;
     }
     GetHotelListRequest req = new GetHotelListRequest();
     req.RequestHead = this.requestHead;
     req.GetHotelCondition = condition;
     GetHotelListResponse res = elongService.GetHotelList(req);
     HotelForGetHotelList[] hotels = res.Hotels;
     int total = res.HotelCount;
     IList<HotelForGetHotelList> listHotels = new List<HotelForGetHotelList>(hotels);
     pagerList = new PageList<HotelForGetHotelList>(listHotels, total);
     return pagerList;
 }
Example #7
0
 public RoomForGetHotelList getRoomForGetHotelList(string hotelId, string roomTypeId
       , DateTime checkInDate,DateTime checkOutDate,int ratePlanId)
 {
     RoomForGetHotelList room = new RoomForGetHotelList();
     if (!this.login())
     {
         return room;
     }
     GetHotelListRequest req = new GetHotelListRequest();
     req.RequestHead = this.requestHead;
     GetHotelConditionForGetHotelList conditon = new GetHotelConditionForGetHotelList();
     conditon.HotelId = hotelId;
     conditon.RoomTypeID = roomTypeId;
     conditon.CheckInDate = checkInDate;
     conditon.CheckOutDate = checkOutDate;
     if (ratePlanId != 0)
     {
         conditon.RatePlanID = ratePlanId;
     }
     req.GetHotelCondition = conditon;
     GetHotelListResponse res = elongService.GetHotelList(req);
     if (res.HotelCount == 1) {
         if (res.Hotels[0].Rooms.Length == 1) {
             room = res.Hotels[0].Rooms[0];
         }
     }
     return room;
 }
Example #8
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);
        }
Example #9
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();
        }
Example #10
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);
 }