コード例 #1
0
ファイル: FlightHelper.cs プロジェクト: yeziyll/xml2013
 public FlightResponseData SearchDmstFlightInResults(string _flightNo)
 {
     FlightResponseData data = new FlightResponseData();
     XmlDocument xmldoc = new XmlDocument();
     xmldoc.Load(AppDomain.CurrentDomain.BaseDirectory + "/CtripData/D_FlightData.xml");
     XmlNodeList li = xmldoc.SelectNodes(XPATH);
     foreach (XmlNode xn in li)
     {
         if (xn.InnerText == _flightNo)
         {
             XmlNode parent = xn.ParentNode;
             data.adultOilFee = System.Convert.ToDecimal(parent.SelectSingleNode("AdultOilFee").InnerText);
             data.adultTax = System.Convert.ToDecimal(parent.SelectSingleNode("AdultTax").InnerText);
             data.standardPrice = System.Convert.ToDecimal(parent.SelectSingleNode("StandardPrice").InnerText);
             return data;
         }
     }
     return data;
 }
コード例 #2
0
ファイル: FlightResponse.cs プロジェクト: yeziyll/xml2013
 public void SetFlightResponseData(FlightResponseData data)
 {
     li.Add(data);
 }
コード例 #3
0
ファイル: FlightHelper.cs プロジェクト: yeziyll/xml2013
 public FlightResponse SearchDmstFlightInResults(string dFlight, string aFlight)
 {
     FlightResponseData data = new FlightResponseData();
     XmlDocument xmldoc = new XmlDocument();
     xmldoc.Load(AppDomain.CurrentDomain.BaseDirectory + "/CtripData/D_FlightData.xml");
     XmlNodeList routes = xmldoc.SelectNodes("/FlightResponses/FlightRoute");
     FlightResponse response = new FlightResponse();
     bool flag = true;
     foreach(XmlNode route in routes)
     {
         XmlNodeList li = route.SelectNodes("FlightResponse");
         foreach (XmlNode xn in li)
         {
             if (xn.InnerText == dFlight && flag)
             {
                 XmlNode parent = xn.ParentNode;
                 data.adultOilFee = System.Convert.ToDecimal(parent.SelectSingleNode("AdultOilFee").InnerText);
                 data.adultTax = System.Convert.ToDecimal(parent.SelectSingleNode("AdultTax").InnerText);
                 data.standardPrice = System.Convert.ToDecimal(parent.SelectSingleNode("StandardPrice").InnerText);
                 response.SetFlightResponseData(data);
             } else
                 if (xn.InnerText == aFlight && !flag)
                 {
                     XmlNode parent = xn.ParentNode;
                     data.adultOilFee = System.Convert.ToDecimal(parent.SelectSingleNode("AdultOilFee").InnerText);
                     data.adultTax = System.Convert.ToDecimal(parent.SelectSingleNode("AdultTax").InnerText);
                     data.standardPrice = System.Convert.ToDecimal(parent.SelectSingleNode("StandardPrice").InnerText);
                     response.SetFlightResponseData(data);
                 }
         }
     }
     return response;
 }
コード例 #4
0
ファイル: FlightHelper.cs プロジェクト: yeziyll/xml2013
        //生成国内航班的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;
        }
コード例 #5
0
ファイル: PriceHelper.cs プロジェクト: yeziyll/xml2013
        /*
        public RS_FlightDetail GetFlightAgency(string _flight)
        {
        }*/
        private RS_FlightDetail ReplaceFlightDetail(RS_FlightDetail dfd, FlightResponseData frd)
        {
            Agency ag = new Agency();
            ag.AgencyName = frd.provider;
            ag.price = frd.standardPrice.ToString();
            dfd.AgencyList.Add(ag);
            if (System.Convert.ToDecimal(dfd.MinPrice) > frd.standardPrice)
                dfd.MinPrice = ag.price;
            dfd.Airline = frd.airline;
            dfd.CraftType = frd.craftType;
            dfd.APort = frd.aPort;
            dfd.ArriveTime = frd.arriveTime.ToUniversalTime().ToString();
            dfd.DPort = frd.dPort;
            dfd.OilFee = frd.adultOilFee.ToString();
            dfd.Tax = frd.adultTax.ToString();
            dfd.TakeOffTime = frd.takeOffTime.ToUniversalTime().ToString();

            return dfd;
        }