Ejemplo n.º 1
0
        /// <summary>
        /// 指令结果解析适配器.
        /// </summary>
        /// <param name="Msg">指令结果集合.</param>
        /// <returns></returns>
        protected override ASyncResult ResultAdapter(string Msg)
        {
            AVResult result = new AVResult()
            {
                getDate = this.orgDate, getDst = this.destCity, getOrg = orgCity, AvSegment = new List <AvItem>()
            };

            foreach (Flight seg in new AnalysisAVH().ParseAVH(this.__AvCommand, Msg).Flights)
            {
                AvItem AvSegment = new AvItem()
                {
                    getAirline    = seg.FlightNO,
                    getArritime   = seg.ArrivalTime.Insert(2, ":"),
                    getCarrier    = seg.Airline,
                    getDeptime    = seg.DepartureTime.Insert(2, ":"),
                    getDstcity    = seg.ArrivalAirport,
                    getMeal       = seg.Meal.Trim().Length > 0,
                    getPlanestyle = seg.AircraftType,
                    getOrgcity    = seg.DepartureAirport,
                    getStopnumber = int.Parse(seg.Stop),
                    isCodeShare   = seg.CodeShare,
                    getLink       = seg.Connect,
                    getDepdate    = queryDate,
                    getArridate   = queryDate,
                    getCabins     = new List <AvItemCabinChar>(),
                };
                foreach (FlightCarbin carbin in seg.Carbins.Where <FlightCarbin>(CARBIN => @"123456789A".IndexOf(CARBIN.Number) >= 0))
                {
                    AvSegment.getCabins.Add(new AvItemCabinChar()
                    {
                        getCode     = carbin.Carbin,
                        getAvalibly = carbin.Number,
                    });
                }
                result.AvSegment.Add(AvSegment);
            }
            return(result);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// 指令结果解析适配器.
 /// </summary>
 /// <param name="Msg">指令结果集合.</param>
 /// <returns></returns>
 protected override ASyncResult ResultAdapter(string Msg)
 {
     AVResult result = new AVResult() { getDate=this.orgDate, getDst=this.destCity, getOrg=orgCity,  AvSegment=new List<AvItem>()};
     foreach (Flight seg in new AnalysisAVH().ParseAVH(this.__AvCommand, Msg).Flights) {
         AvItem AvSegment = new AvItem() {
          getAirline=seg.FlightNO,
           getArritime=seg.ArrivalTime.Insert(2,":"),
            getCarrier=seg.Airline,
          getDeptime = seg.DepartureTime.Insert(2, ":"),
              getDstcity=seg.ArrivalAirport,
               getMeal=seg.Meal.Trim().Length>0,
                getPlanestyle=seg.AircraftType,
                 getOrgcity=seg.DepartureAirport,
                  getStopnumber=int.Parse( seg.Stop),
                   isCodeShare=seg.CodeShare,
                    getLink=seg.Connect,
                     getDepdate=queryDate,
                     getArridate=queryDate,
                     getCabins=new List<AvItemCabinChar>(),
         };
         foreach (FlightCarbin carbin in seg.Carbins.Where<FlightCarbin>(CARBIN=>@"123456789A".IndexOf(CARBIN.Number)>=0)) {
             AvSegment.getCabins.Add(new AvItemCabinChar() {
                  getCode=carbin.Carbin,
                   getAvalibly=carbin.Number,
             });
         }
         result.AvSegment.Add(AvSegment);
     }
     return result;
 }