private List<Entity.Hotel> GetHotelsData(string city, int numberOfAdults, DateTime arrivalDate, DateTime departureDate) { var result = new List<Entity.Hotel>(); var hotelServicesClient = new HotelServicesClient(); var request = new HotelListRequest(); request.arrivalDate = arrivalDate.ToString("MM/dd/yyyy"); request.departureDate = departureDate.ToString("MM/dd/yyyy"); request.city = city; request.cid = 55505; request.apiKey = "qb8es7zetcad5s5atuadxt3f"; var room = new Room(); room.numberOfAdults = numberOfAdults; request.RoomGroup = new[] { room }; hotelServicesClient.Open(); var hotelListResponse = hotelServicesClient.getList(request); var rooms = new List<HotelRoomResponse>(); foreach (HotelSummary hotelSummary in hotelListResponse.HotelList.HotelSummary) { var roomRequest = new HotelRoomAvailabilityRequest(); roomRequest.cid = 55505; roomRequest.apiKey = "qb8es7zetcad5s5atuadxt3f"; roomRequest.hotelId = hotelSummary.hotelId; roomRequest.arrivalDate = arrivalDate.ToString("MM/dd/yyyy"); roomRequest.departureDate = departureDate.ToString("MM/dd/yyyy"); roomRequest.RoomGroup = new[] { room }; var hotelRoomResponse = hotelServicesClient.getAvailability(roomRequest); foreach (HotelRoomResponse roomResponse in hotelRoomResponse.HotelRoomResponse) { result.Add(new Entity.Hotel(hotelSummary.name, roomResponse.RateInfo.ChargeableRateInfo.commissionableUsdTotal, roomResponse.RateInfo.ChargeableRateInfo.currencyCode, @"http://media.expedia.com/" + hotelSummary.thumbNailUrl, city, roomResponse.rateDescription)); } } return result; }
/// <summary> /// Create a new Room object. /// </summary> /// <param name="id">Initial value of the Id property.</param> /// <param name="roomNo">Initial value of the RoomNo property.</param> public static Room CreateRoom(global::System.Int32 id, global::System.String roomNo) { Room room = new Room(); room.Id = id; room.RoomNo = roomNo; return room; }
/// <summary> /// Deprecated Method for adding a new object to the Rooms EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToRooms(Room room) { base.AddObject("Rooms", room); }