Exemple #1
0
        private SearchHotelsByIdRequest1 ConvertToTouricoHotelSearchRequest(HotelAvailabilityProviderReq request)
        {
            SearchHotelsByIdRequest sRequest = new SearchHotelsByIdRequest();

            sRequest.CheckIn          = request.CheckInDate;
            sRequest.CheckOut         = request.CheckOutDate;
            sRequest.RoomsInformation = new RoomInfo[] { new RoomInfo {
                                                             AdultNum = request.TotalAdults,
                                                             ChildNum = 0, ChildAges = new ChildAge[] { new ChildAge {
                                                                                                            age = 0
                                                                                                        } }
                                                         } };
            int i = 0;

            HotelIdInfo[] hIdInfo = new HotelIdInfo[request.HotelCodes.Count];
            foreach (var hotelcode in request.HotelCodes)
            {
                HotelIdInfo hinfo = new HotelIdInfo();
                hinfo.id   = Convert.ToInt32(hotelcode);
                hIdInfo[i] = hinfo;   i++;
            }

            sRequest.HotelIdsInfo = hIdInfo;

            SearchHotelsByIdRequest1 returnRequest = new SearchHotelsByIdRequest1();

            returnRequest.AuthenticationHeader = Helper.GetTouricoAuthHeader();
            returnRequest.request = sRequest;

            return(returnRequest);
        }
Exemple #2
0
        public SearchResult Execute(SearchHotelsByIdRequest sReq)
        {
            //default features
            var features = new Feature[]{ new Feature { name = "OriginalImageSize" , value = "true" }  };

            var sreq = this.Execute(GetHeader(), sReq, GetFeature());

            return sreq;
        }
Exemple #3
0
        public SearchResult Execute(SearchHotelsByIdRequest sReq)
        {
            //default features
            var features = new Feature[] { new Feature {
                                               name = "OriginalImageSize", value = "true"
                                           } };

            var sreq = this.Execute(GetHeader(), sReq, GetFeature());

            return(sreq);
        }
Exemple #4
0
        public SearchResult Execute(AuthenticationHeader authHeader, SearchHotelsByIdRequest sReq, Feature[] features)
        {
            //instantiate HotelFlowClient
            _hotelflowClient = new HotelFlowClient();

            //search Hotels
            var sreq = _hotelflowClient.SearchHotelsById(authHeader, sReq, features);

            //close instance
            _hotelflowClient.Close();

            return sreq;
        }
Exemple #5
0
        public SearchResult Execute(AuthenticationHeader authHeader, SearchHotelsByIdRequest sReq, Feature[] features)
        {
            //instantiate HotelFlowClient
            _hotelflowClient = new HotelFlowClient();

            //search Hotels
            var sreq = _hotelflowClient.SearchHotelsById(authHeader, sReq, features);

            //close instance
            _hotelflowClient.Close();

            return(sreq);
        }
Exemple #6
0
        // public ActionResult CheckAvailability(int hotelId)
        public ActionResult CheckAvailability(FormCollection collection)
        {
            //AuthHeader
            Common.hotelflowSvc.AuthenticationHeader auth = new AuthenticationHeader();
            auth.LoginName = "Tra105";
            auth.Password  = "******";

            //SearchHotelRequest
            Common.hotelflowSvc.SearchHotelsByIdRequest reqCriteria = new SearchHotelsByIdRequest();
            reqCriteria.HotelIdsInfo = new HotelIdInfo[] {
                new HotelIdInfo {
                    id = Convert.ToInt32(collection["hotelCode"])
                }
            };

            reqCriteria.CheckIn  = Convert.ToDateTime(collection["startDate"]);
            reqCriteria.CheckOut = Convert.ToDateTime(collection["endDate"]);

            ViewBag.StartDate = reqCriteria.CheckIn;
            ViewBag.EndDate   = reqCriteria.CheckOut;

            reqCriteria.RoomsInformation = new RoomInfo[] {
                new RoomInfo {
                    AdultNum  = 1,
                    ChildAges = new ChildAge[] { new ChildAge {
                                                     age = 5
                                                 } },
                    ChildNum = 1
                }
            };

            HotelFlowClient client = new HotelFlowClient();
            SearchResult    sreq   = client.CheckAvailabilityAndPrices(auth, reqCriteria, new Feature[] { new Feature {
                                                                                                              name = "OriginalImageSize", value = "true"
                                                                                                          } });

            client.Close();


            return(View("Available", sreq.HotelList));
        }
Exemple #7
0
        private SearchHotelsByIdRequest1 ConvertToTouricoHotelSearchRequest(HotelAvailabilityProviderReq request)
        {
            SearchHotelsByIdRequest sRequest = new SearchHotelsByIdRequest();

            sRequest.CheckIn          = request.CheckInDate;
            sRequest.CheckOut         = request.CheckOutDate;
            sRequest.RoomsInformation = new RoomInfo[] { new RoomInfo {
                                                             AdultNum = request.TotalAdults,
                                                             ChildNum = 0, ChildAges = new ChildAge[] { new ChildAge {
                                                                                                            age = 0
                                                                                                        } }
                                                         } };
            int i = 0;

            HotelIdInfo[] hIdInfo = new HotelIdInfo[request.HotelCodes.Count];
            foreach (var hotelcode in request.HotelCodes)
            {
                HotelIdInfo hinfo = new HotelIdInfo();
                hinfo.id   = Convert.ToInt32(hotelcode);
                hIdInfo[i] = hinfo;   i++;
            }

            sRequest.HotelIdsInfo = hIdInfo;

            SearchHotelsByIdRequest1 returnRequest = new SearchHotelsByIdRequest1();

            returnRequest.request = sRequest;

            //Temp Add Auth Header to Test: musanka
            var authHeader = new AuthenticationHeader();

            //TODO: Move to config setting
            authHeader.LoginName = "Tra105";
            authHeader.Password  = "******";

            returnRequest.AuthenticationHeader = authHeader;

            return(returnRequest);
        }
        // public ActionResult CheckAvailability(int hotelId)
        public ActionResult CheckAvailability(FormCollection collection)
        {
            //AuthHeader
            Common.hotelflowSvc.AuthenticationHeader auth = new AuthenticationHeader();
            auth.LoginName = "Tra105";
            auth.Password = "******";

            //SearchHotelRequest
            Common.hotelflowSvc.SearchHotelsByIdRequest reqCriteria = new SearchHotelsByIdRequest();
            reqCriteria.HotelIdsInfo = new HotelIdInfo[] {
                                                    new HotelIdInfo { id = Convert.ToInt32(collection["hotelCode"]) }
            };

            reqCriteria.CheckIn = Convert.ToDateTime(collection["startDate"]);
            reqCriteria.CheckOut = Convert.ToDateTime(collection["endDate"]);

            ViewBag.StartDate = reqCriteria.CheckIn;
            ViewBag.EndDate = reqCriteria.CheckOut;

            reqCriteria.RoomsInformation = new RoomInfo[] {
                                                                new RoomInfo {
                                                                               AdultNum = 1,
                                                                               ChildAges =  new ChildAge[] { new ChildAge { age = 5 } },
                                                                               ChildNum  = 1
                                                                }};

            HotelFlowClient client = new HotelFlowClient();
            SearchResult sreq = client.CheckAvailabilityAndPrices(auth, reqCriteria, new Feature[] { new Feature { name = "OriginalImageSize", value = "true" } });
            client.Close();

            return View("Available", sreq.HotelList);
        }