Exemple #1
0
        //生成国外航班的FlightResponse返回值
        private IntlFlightResponse GenerateResultsFromIntl(OTA_IntlFlightSearchCallReturnEntiy _returnEntity)
        {
            List<ShoppingResultInfo> resultInfos = _returnEntity.ShoppingResults;
            IntlFlightResponse ifr = new IntlFlightResponse();
            List<IntlFlightResponseData> li = new List<IntlFlightResponseData>();
            foreach (ShoppingResultInfo sri in resultInfos)
            {
                //航程信息
                IntlFlightResponseData ifrd = new IntlFlightResponseData();
                foreach (FlightsInfo fi in sri.FlightInfos)
                {
                    //航程价格
                    PriceInfo pi = sri.PolicyInfos[0].PriceInfos[0];
                    ifrd.standardPrice = pi.Price;
                    ifrd.fuelCharge = pi.FuelCharge;
                    ifrd.tax = pi.Tax;
                    ifrd.ShoppingInfoID = sri.PolicyInfos[0].ShoppingInfoID;
                    Routing routing = new Routing();
                    //航班信息
                    int countStop = -1;
                    foreach (Flight f in fi.Flights)
                    {
                        countStop++;
                        if (countStop == 0)
                        {
                            ifrd.departCity = f.DCityName;
                            ifrd.airline = f.AirLineName;
                            ifrd.dPort = f.DPortName;
                            ifrd.arriveTime = f.ATimeString;
                            ifrd.takeOffTime = f.DTimeString;
                            ifrd.provider = "携程旅行网";
                        }
                        ifrd.craftType += f.CraftType + "; ";
                        ifrd.flight += f.FlightNo + "; ";
                        ifrd.TotalRoutings = countStop;
                        ifrd.aPort = f.APortName;
                        ifrd.arriveCity = f.ACityName;

                        routing.DCode = f.DCity;
                        routing.ACode = f.ACity;
                        routing.DAirport = f.DPort;
                        routing.AAirport = f.APort;
                        routing.Airline = f.Airline;
                        routing.SeatClass = "M";
                        routing.FlightNo = f.FlightNo;
                        routing.OperatorNo = f.CarrierFlightNo;
                        routing.No = f.No;
                        routing.SegmentInfoNo = fi.SegmentInfoNo;

                        ifrd.Routings.Add(routing);
                    }
                }
                ifr.SetFlightResponseData(ifrd);
            }
            return ifr;
        }
 public void SetReturnEntity(APICallProxy apiCallProxy)
 {
     returnEntity = (OTA_IntlFlightSearchCallReturnEntiy)apiCallProxy.CallAPISyn(flight);
 }