Esempio n. 1
0
        //生成国内航班的FlightResponse返回值
        private FlightResponseList GenerateResultsFromDmst(OTA_FlightSearchCallReturnEntity _returnEntity)
        {
            FlightResponseList frl = new FlightResponseList();
            List<DomesticFlightRoute> routes = _returnEntity.FlightRoutes;
            CityCodeTranslator cct = new CityCodeTranslator();
            AirlineCodeTranslator act = new AirlineCodeTranslator();
            AirportCodeTranslator apct = new AirportCodeTranslator();
            foreach (DomesticFlightRoute r in routes)
            {
                List<DomesticFlightData> flightList = r.FlightsList;
                FlightResponse fr = new FlightResponse();
                foreach (DomesticFlightData d in flightList)
                {
                    FlightResponseData frd = new FlightResponseData();
                    frd.adultOilFee = d.AdultOilFee;
                    frd.adultTax = d.AdultTax;
                    frd.airline = act.TranslateToName(d.AirlineCode);
                    frd.craftType = d.CraftType;
                    frd.aPort = apct.TranslateToName(d.APortCode);
                    frd.arriveCity = cct.TranslateToName(d.ArriveCityCode);
                    frd.departCity = cct.TranslateToName(d.DepartCityCode);
                    frd.arriveTime = d.ArriveTime;
                    frd.dPort = apct.TranslateToName(d.DPortCode);
                    frd.flight = d.Flight;
                    frd.priceType = d.PriceType;
                    frd.standardPrice = d.Price;
                    frd.subClass = d.SubClass;
                    frd.takeOffTime = d.TakeOffTime;
                    frd.provider = "携程旅行网";

                    fr.SetFlightResponseData(frd);
                }
                fr.GetFlightReponseData().Sort();
                frl.SetFlightResponse(fr);
            }
            this.GenerateXmlFileFromDmst(frl);
            return frl;
        }
Esempio n. 2
0
        //设置国外往返机票搜索信息
        public IntlFlightResponseList SearchIntlRoundTripFlight(String _departCity, String _arriveCity, DateTime _departDate, DateTime _backDate)
        {
            //搜索出发机票
            FlightRoute goRoute = new FlightRoute();
            CityCodeTranslator cct = new CityCodeTranslator();
            goRoute.DepartCity = cct.TranslateToCode(_departCity);
            goRoute.ArriveCity = cct.TranslateToCode(_arriveCity);
            goRoute.DepartDate = _departDate;//出发日期

            IntlRoundFlightSearch irfs = new IntlRoundFlightSearch();
            irfs.AddRoutes(goRoute, _departDate, _backDate);//返程日期
            irfs.SetReturnEntity(apiCallProxy);

            IntlFlightResponse ifr = this.GenerateResultsFromIntl(irfs.returnEntity);

            //搜索返程机票
            irfs.AddRouting(ifr.GetFlightReponseData()[0].Routings);
            irfs.SetShoppingInfoID(ifr.GetFlightReponseData()[0].ShoppingInfoID);
            irfs.SetReturnEntity(apiCallProxy);

            IntlFlightResponse ifr2 = this.GenerateResultsFromIntl(irfs.returnEntity);
            IntlFlightResponseList ifrl = new IntlFlightResponseList();
            ifrl.SetFlightResponse(ifr);
            ifrl.SetFlightResponse(ifr2);
            this.GenerateXmlFileFromIntl(ifrl);

            /*
            IntlFlightResponseList result = new IntlFlightResponseList();
            IntlFlightResponse response = new IntlFlightResponse();
            IntlFlightResponse response2 = new IntlFlightResponse();
            response.SetFlightResponseData(ifr.GetFlightReponseData()[0]);
            response.SetFlightResponseData(ifr2.GetFlightReponseData()[0]);
            result.SetFlightResponse(response);
            result.SetFlightResponse(response2);
             */

            return ifrl;
        }
Esempio n. 3
0
        //设置国内往返机票搜索信息
        public FlightResponseList SearchDmstRoundTripFlight(String _departCity, String _arriveCity, DateTime _departDate, DateTime _backDate)
        {
            FlightRoute goRoute = new FlightRoute();
            CityCodeTranslator cct = new CityCodeTranslator();
            goRoute.DepartCity = cct.TranslateToCode(_departCity);
            goRoute.ArriveCity = cct.TranslateToCode(_arriveCity);
            goRoute.DepartDate = _departDate;//出发日期

            RoundFlightSearch rfs = new RoundFlightSearch(new DateTime(2013, 2, 20));//订票日期
            rfs.AddRoutes(goRoute, _backDate);//返程日期
            rfs.SetReturnEntity(apiCallProxy);
            FlightResponseList frl = this.GenerateResultsFromDmst(rfs.returnEntity);

            /*
            FlightResponseList result = new FlightResponseList();
            FlightResponse response = new FlightResponse();
            FlightResponse response2 = new FlightResponse();
            response.SetFlightResponseData(frl.GetFlightReponse()[0].GetFlightReponseData()[0]);
            result.SetFlightResponse(response);
            response2.SetFlightResponseData(frl.GetFlightReponse()[1].GetFlightReponseData()[0]);
            result.SetFlightResponse(response2);*/

            return frl;
        }
Esempio n. 4
0
        //设置国外单程机票搜索信息
        public IntlFlightResponseList SearchIntlOneWayFlight(String _departCity, String _arriveCity, DateTime _departDate)
        {
            FlightRoute route = new FlightRoute();
            CityCodeTranslator cct = new CityCodeTranslator();
            route.DepartCity = cct.TranslateToCode(_departCity);
            route.ArriveCity = cct.TranslateToCode(_arriveCity);
            route.DepartDate = _departDate;//出发日期

            IntlSingleFlightSearch isfs = new IntlSingleFlightSearch(route);
            isfs.SetReturnEntity(apiCallProxy);

            IntlFlightResponse ifr = this.GenerateResultsFromIntl(isfs.returnEntity);
            IntlFlightResponseList ifrl = new IntlFlightResponseList();
            ifrl.SetFlightResponse(ifr);
            this.GenerateXmlFileFromIntl(ifrl);

            /*
            IntlFlightResponseList result = new IntlFlightResponseList();
            IntlFlightResponse response = new IntlFlightResponse();
            response.SetFlightResponseData(ifr.GetFlightReponseData()[0]);
            result.SetFlightResponse(response);
             */

            return ifrl;
        }
Esempio n. 5
0
        //设置国内单程机票搜索信息 returnEntity
        public FlightResponseList SearchDmstOneWayFlight(String _departCity, String _arriveCity, DateTime _departDate)
        {
            FlightRoute route = new FlightRoute();
            CityCodeTranslator cct = new CityCodeTranslator();
            route.DepartCity = cct.TranslateToCode(_departCity);
            route.ArriveCity = cct.TranslateToCode(_arriveCity);
            route.DepartDate = _departDate;//出发日期

            SingleFlightSearch sfs = new SingleFlightSearch(new DateTime(), route);//订票日期
            sfs.SetReturnEntity(apiCallProxy);
            FlightResponseList frl = this.GenerateResultsFromDmst(sfs.returnEntity);

            /*
            FlightResponseList result = new FlightResponseList();
            FlightResponse response = new FlightResponse();
            response.SetFlightResponseData(frl.GetFlightReponse()[0].GetFlightReponseData()[0]);
            result.SetFlightResponse(response);*/

            return frl;
        }