Exemplo n.º 1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         try
         {
             long a = 0;
             ToCityName   = ReadXmlHelper.GetToCityNameByCode(ToCityCode, out a);
             FromCityName = ReadXmlHelper.GetFromCityNameByCode(FromCityCode, out a);
             //LogHelper.WriteLog(string.Format("TripType:{0},FromCityCode:{1},ToCityCode:{2},TripDate:{3},BackDate:{4}", this.TripType, this.FromCityCode, this.ToCityCode, this.TripDate, this.BackDate));
             FlightTotal ftinfo = (FlightTotal)Session[string.Format("TicketsSessionKey2_{0}_{1}_{2}_{3}_{4}", this.TripType, this.FromCityCode, this.ToCityCode, Convert.ToDateTime(this.TripDate).ToString("yyyyMMdd"), Convert.ToDateTime(this.BackDate).ToString("yyyyMMdd"))];
             if (ftinfo != null)
             {
                 foreach (FlightRoundTrip item in ftinfo.result)
                 {
                     bool isContains = false;
                     foreach (FlightInfo fInfo in item.ListInterFlightInfo)
                     {
                         if (DataGuid == fInfo.dataId)
                         {
                             isContains  = true;
                             flightround = item;
                             break;
                         }
                     }
                     if (isContains)
                     {
                         break;
                     }
                 }
             }
             else
             {
                 if (Session[string.Format("TicketsSessionKey_limit_{0}", DataGuid)] != null)
                 {
                     flightround = (FlightRoundTrip)Session[string.Format("TicketsSessionKey_limit_{0}", DataGuid)];
                 }
                 else
                 {
                     this.GetSource();
                 }
             }
         }
         catch (Exception ex)
         {
             //LogHelper.WriteLog(ex.StackTrace+ex.ToString()+ ex.Message);
         }
     }
 }
Exemplo n.º 2
0
    /// <summary>
    /// 获取feiying网手工数据
    /// </summary>
    /// <returns></returns>
    private FlightRoundTrip GetFeiying580()
    {
        DataRow         dr    = null;
        DataSet         ds    = null;
        FlightRoundTrip rTrip = null;
        string          str   = "select FY_Ticket.*,FY_FromCity.chName as fromCityname,FY_Airline.airlineCode as airlineCode,FY_FromCity.cityCode as fromCityCode, FY_ToCity.chName as toCityname,FY_ToCity.cityCode as toCityCode, FY_Airline.chName as airname,FY_Airline.planNum as planNum,FY_Airline.age as age,FY_Airline.aId as airId ,FY_Airline.logoPic as logoPic,FY_Airline.smallPic as smallPic, fAirport.chName as fAirportName,fAirport.airPortCode as fAirportCode, tAirport.chName as tAirportName,tAirport.airPortCode as tAirportCode,tAirport.description as tairportdescription from FY_Ticket left join FY_FromCity on FY_FromCity.fId=FY_Ticket.fromCity left join FY_ToCity on FY_ToCity.tId=FY_Ticket.toCity left join FY_Airline on FY_Airline.aId=FY_Ticket.airLine  left join FY_Airport as  fAirport on fAirport.apId=FY_Ticket.fromPort left join FY_Airport as tAirport on tAirport.apId=FY_Ticket.toPort  where FY_Ticket.tId=" + DataGuid;

        try
        {
            ds = SqlHelper.ExecuteDataset(SqlHelper.ConnString_select, CommandType.Text, str);
            if (ds != null && ds.Tables[0].Rows.Count != 0)
            {
                dr = ds.Tables[0].Rows[0];

                rTrip = new FlightRoundTrip();
                List <FlightInfo>  listF  = new List <FlightInfo>();
                List <FlightInfo2> listF2 = new List <FlightInfo2>();
                if (Convert.ToInt32(TripType) == 0)
                {
                    #region 单程
                    List <FlightDetail> listDeteil = new List <FlightDetail>();
                    FlightInfo          finfo      = new FlightInfo();
                    finfo.Data        = Guid.NewGuid().ToString("N").ToUpper();
                    finfo.Source      = "feiying";
                    finfo.TicketPrice = decimal.Parse(dr["untaxPrice"].ToString());
                    finfo.XmlInfo     = dr["tid"].ToString();
                    finfo.Tid         = dr["tid"].ToString();

                    FlightDetail fdInfo = new FlightDetail();
                    fdInfo.AirCompanyCode = dr["airlineCode"].ToString();
                    fdInfo.StartCityCode  = dr["fromCityCode"].ToString();
                    fdInfo.StartCityName  = ReadXmlHelper.GetAirPortNameByCode(dr["fromCityCode"].ToString());
                    fdInfo.BeginCityName  = dr["fromCityname"].ToString();

                    //如果有中转,则到达城市、机场等替换为中转地
                    if (string.IsNullOrEmpty(dr["relayPort"].ToString()))
                    {
                        fdInfo.EndCityCode = dr["toCityCode"].ToString();
                        fdInfo.EndCityName = ReadXmlHelper.GetAirPortNameByCode(dr["toCityCode"].ToString());
                        fdInfo.ToCityName  = dr["toCityname"].ToString();
                    }
                    else
                    {
                        string[] array = dr["relayPort"].ToString().Split('-');
                        fdInfo.EndCityCode = array[0];
                        fdInfo.EndCityName = ReadXmlHelper.GetAirPortNameByCode(array[0]);
                        long a = 0;//纯粹接收参数
                        fdInfo.ToCityName = ReadXmlHelper.GetToCityNameByCode(array[0], out a);
                    }

                    fdInfo.FromTime   = DateTime.Parse(ReadTime(this.TripDate, 0));
                    fdInfo.ArriveTime = ReadTime(fdInfo.FromTime);
                    listDeteil.Add(fdInfo);
                    //如果有中转
                    if (!string.IsNullOrEmpty(dr["relayPort"].ToString()))
                    {
                        FlightDetail fdInfo2 = new FlightDetail();
                        fdInfo2.AirCompanyCode = string.Empty;       //dr["airlineCode"].ToString();
                        fdInfo2.StartCityCode  = fdInfo.EndCityCode; //dr["fromCityCode"].ToString();
                        fdInfo2.EndCityCode    = dr["toCityCode"].ToString();
                        fdInfo2.StartCityName  = ReadXmlHelper.GetAirPortNameByCode(fdInfo.EndCityCode);
                        fdInfo2.EndCityName    = ReadXmlHelper.GetAirPortNameByCode(dr["toCityCode"].ToString());
                        fdInfo2.BeginCityName  = fdInfo.ToCityName;//dr["fromCityname"].ToString();
                        fdInfo2.ToCityName     = dr["toCityname"].ToString();
                        fdInfo2.FromTime       = ReadTime(fdInfo.ArriveTime);
                        fdInfo2.ArriveTime     = ReadTime(fdInfo2.FromTime);
                        listDeteil.Add(fdInfo2);
                    }
                    finfo.ListInterFlightDetails = listDeteil;
                    listF.Add(finfo);
                    #endregion
                }
                else
                {
                    #region 去程
                    List <FlightDetail> listDeteil = new List <FlightDetail>();
                    FlightInfo          finfo      = new FlightInfo();
                    finfo.Data        = Guid.NewGuid().ToString("N").ToUpper();
                    finfo.Source      = "feiying";
                    finfo.TicketPrice = decimal.Parse(dr["untaxPrice"].ToString());
                    finfo.XmlInfo     = dr["tid"].ToString();
                    finfo.Tid         = dr["tid"].ToString();

                    FlightDetail fdInfo = new FlightDetail();
                    fdInfo.AirCompanyCode = dr["airlineCode"].ToString();
                    fdInfo.StartCityCode  = dr["fromCityCode"].ToString();
                    fdInfo.StartCityName  = ReadXmlHelper.GetAirPortNameByCode(dr["fromCityCode"].ToString());
                    fdInfo.BeginCityName  = dr["fromCityname"].ToString();

                    //如果有中转,则到达城市、机场等替换为中转地
                    if (string.IsNullOrEmpty(dr["relayPort"].ToString()))
                    {
                        fdInfo.EndCityCode = dr["toCityCode"].ToString();
                        fdInfo.EndCityName = ReadXmlHelper.GetAirPortNameByCode(dr["toCityCode"].ToString());
                        fdInfo.ToCityName  = dr["toCityname"].ToString();
                    }
                    else
                    {
                        string[] array = dr["relayPort"].ToString().Split('-');
                        fdInfo.EndCityCode = array[0];
                        fdInfo.EndCityName = ReadXmlHelper.GetAirPortNameByCode(array[0]);
                        long a = 0;//纯粹接收参数
                        fdInfo.ToCityName = ReadXmlHelper.GetToCityNameByCode(array[0], out a);
                    }

                    fdInfo.FromTime   = DateTime.Parse(ReadTime(this.TripDate, 0));
                    fdInfo.ArriveTime = ReadTime(fdInfo.FromTime);
                    listDeteil.Add(fdInfo);
                    //如果有中转
                    if (!string.IsNullOrEmpty(dr["relayPort"].ToString()))
                    {
                        FlightDetail fdInfo2 = new FlightDetail();
                        fdInfo2.AirCompanyCode = string.Empty;       //dr["airlineCode"].ToString();
                        fdInfo2.StartCityCode  = fdInfo.EndCityCode; //dr["fromCityCode"].ToString();
                        fdInfo2.EndCityCode    = dr["toCityCode"].ToString();
                        fdInfo2.StartCityName  = ReadXmlHelper.GetAirPortNameByCode(fdInfo.EndCityCode);
                        fdInfo2.EndCityName    = ReadXmlHelper.GetAirPortNameByCode(dr["toCityCode"].ToString());
                        fdInfo2.BeginCityName  = fdInfo.ToCityName;//dr["fromCityname"].ToString();
                        fdInfo2.ToCityName     = dr["toCityname"].ToString();
                        fdInfo2.FromTime       = ReadTime(fdInfo.ArriveTime);
                        fdInfo2.ArriveTime     = ReadTime(fdInfo2.FromTime);
                        listDeteil.Add(fdInfo2);
                    }
                    finfo.ListInterFlightDetails = listDeteil;
                    listF.Add(finfo);
                    #endregion

                    #region 返程
                    List <FlightDetail> listDeteil2 = new List <FlightDetail>();
                    FlightInfo2         finfo2      = new FlightInfo2();
                    finfo2.Source      = "feiying";
                    finfo2.TicketPrice = decimal.Parse(dr["untaxPrice"].ToString());

                    FlightDetail fdbkInfo = new FlightDetail();
                    fdbkInfo.AirCompanyCode = dr["airlineCode"].ToString();
                    fdbkInfo.StartCityCode  = dr["toCityCode"].ToString();
                    fdbkInfo.StartCityName  = fdInfo.EndCityName;//使用去程的到达机场作为返回的出发机场 //ReadXmlHelper.GetAirPortNameByCode(dr["toCityCode"].ToString());
                    fdbkInfo.BeginCityName  = dr["toCityname"].ToString();

                    //如果有中转,则到达城市、机场等替换为中转地
                    if (string.IsNullOrEmpty(dr["relayPort"].ToString()))
                    {
                        fdbkInfo.EndCityCode = dr["fromCityCode"].ToString();
                        fdbkInfo.EndCityName = fdInfo.StartCityName;//使用去程的出发机场作为返回的到达机场 //ReadXmlHelper.GetAirPortNameByCode(dr["fromCityCode"].ToString());
                        fdbkInfo.ToCityName  = dr["fromCityname"].ToString();
                    }
                    else
                    {
                        string[] array = dr["relayPort"].ToString().Split('-');
                        fdbkInfo.EndCityCode = array[0];
                        fdbkInfo.EndCityName = fdInfo.EndCityName;
                        long a = 0;                              //纯粹接收参数
                        fdbkInfo.ToCityName = fdInfo.ToCityName; //ReadXmlHelper.GetToCityNameByCode(array[0], out a);
                    }

                    fdbkInfo.FromTime   = DateTime.Parse(ReadTime(this.BackDate, 0));
                    fdbkInfo.ArriveTime = ReadTime(fdbkInfo.FromTime);
                    listDeteil2.Add(fdbkInfo);
                    //如果有中转
                    if (!string.IsNullOrEmpty(dr["relayPort"].ToString()))
                    {
                        FlightDetail fdbkInfo2 = new FlightDetail();
                        fdbkInfo2.AirCompanyCode = string.Empty;         //dr["airlineCode"].ToString();
                        fdbkInfo2.StartCityCode  = fdbkInfo.EndCityCode; //dr["fromCityCode"].ToString();
                        fdbkInfo2.EndCityCode    = dr["fromCityCode"].ToString();
                        fdbkInfo2.StartCityName  = fdbkInfo.EndCityName; //使用第一次中转的到达机场作为第二次中转的出发机场 //ReadXmlHelper.GetAirPortNameByCode(fdbkInfo.EndCityCode);
                        fdbkInfo2.EndCityName    = fdInfo.StartCityName; //使用去程的出发机场作为返回的到达机场 //ReadXmlHelper.GetAirPortNameByCode(dr["fromCityCode"].ToString());
                        fdbkInfo2.BeginCityName  = fdInfo.ToCityName;    //使用去程的到达城市作为返回的出发城市 //dr["fromCityname"].ToString();
                        fdbkInfo2.ToCityName     = dr["fromCityname"].ToString();
                        fdbkInfo2.FromTime       = ReadTime(fdbkInfo.ArriveTime);
                        fdbkInfo2.ArriveTime     = ReadTime(fdbkInfo2.FromTime);
                        listDeteil2.Add(fdbkInfo2);
                    }
                    finfo2.ListInterFlightDetails = listDeteil2;
                    listF2.Add(finfo2);
                    #endregion
                }
                rTrip.ListInterFlightInfo  = listF;
                rTrip.ListInterFlightInfo2 = listF2;
            }
            return(rTrip);
        }
        catch (Exception)
        {
            return(null);
        }
    }
Exemplo n.º 3
0
    /// <summary>
    /// 机票具体信息查询接口
    /// </summary>
    public AiFeiTicketInfo TicketInfo(string num)
    {
        try
        {
            string url = aifeServerUrl + ticketInfoUrl + _account + num;
            //string url = "http://localhost:4896/web/af.html";
            WebRequest request = WebRequest.Create(url);
            request.Timeout = 5000;
            WebResponse response     = request.GetResponse();
            string      responseText = new System.IO.StreamReader(response.GetResponseStream()).ReadToEnd();

            string[] ticketOptions = responseText.Split('^');

            if (ticketOptions.Length == 22)
            {
                AiFeiTicketInfo afte = new AiFeiTicketInfo();
                afte.fromCityCode = ticketOptions[0];
                long id = 0;
                afte.fromCityName    = ReadXmlHelper.GetFromCityNameByCode(ticketOptions[0].ToString(), out id);
                afte.toCityCode      = ticketOptions[1];
                afte.toCityName      = ReadXmlHelper.GetToCityNameByCode(ticketOptions[1].ToString(), out id);
                afte.fromAirportCode = ticketOptions[2];
                afte.fromAirportName = ReadXmlHelper.GetAirPortNameByCode(ticketOptions[2]);
                afte.toAirportCode   = ticketOptions[3];
                afte.toAirportName   = ReadXmlHelper.GetAirPortNameByCode(ticketOptions[3]);
                afte.airlineName     = ticketOptions[4];


                if (ticketOptions[5] == "SF")
                {
                    afte.tripType = "1";
                }
                else if (ticketOptions[5] == "DC")
                {
                    afte.tripType = "0";
                }

                afte.ft            = ticketOptions[6];
                afte.cangwei       = ticketOptions[7];
                afte.untaxprice    = ticketOptions[8];
                afte.shortstayDate = ticketOptions[9];

                afte.longstayDate    = ticketOptions[10];
                afte.childPrice      = ticketOptions[11];
                afte.fromsaleDate    = ticketOptions[12];
                afte.tosaleDate      = ticketOptions[13];
                afte.fromtripDate    = ticketOptions[14];
                afte.totripDate      = ticketOptions[15];
                afte.returnMoney     = ticketOptions[16];
                afte.updateProvision = ticketOptions[17];

                afte.wuji           = ticketOptions[18];
                afte.xingli         = ticketOptions[19];
                afte.limitProvision = ticketOptions[20];

                return(afte);
            }
        }
        catch
        {
            return(null);
        }
        return(null);
    }
Exemplo n.º 4
0
    public ArrayList AiFeiTickets(string Dpt, string Arr, string ToTime, string ReTime, string Cate, int airlineId, ref ArrayList allAirlines)
    {
        ArrayList ticketsList = this.GlobalTicket(Dpt, Arr, ToTime, ReTime, Cate);
        ArrayList tickets     = new ArrayList();

        //查找airlineId信息

        string airlineCode = null;

        if (airlineId > 0)
        {
            airlineCode = ReadXmlHelper.GetAirLineCodeByID(airlineId);
        }


        foreach (object obj in ticketsList)
        {
            AiFeiTicket       aifeiTicket = new AiFeiTicket();
            AiFeiTicketEntity ticketObj   = (AiFeiTicketEntity)obj;
            aifeiTicket.price      = Convert.ToInt32(ticketObj.ticketPrice);
            aifeiTicket.ticketCode = ticketObj.ticketCode;

            bool hasairline = false;
            foreach (AiFeiAirline v in allAirlines)
            {
                if (v.airlineCode.Trim() == (ticketObj.airlineCode + "").Trim() && !string.IsNullOrEmpty(ticketObj.airlineCode))
                {
                    hasairline = true;
                }
            }
            if (!hasairline)
            {
                //查找airline信息
                long   airlineId11      = 0;
                string airlineSmallPic1 = string.Empty;
                string airline1         = ReadXmlHelper.GetAirLineNameByCode(ticketObj.airlineCode, out airlineId11, out airlineSmallPic1);

                AiFeiAirline afa = new AiFeiAirline();
                afa.airlineId   = airlineId11.ToString();
                afa.airlineCode = ticketObj.airlineCode;
                afa.airlineName = airline1;
                afa.airlinePic  = airlineSmallPic1;
                allAirlines.Add(afa);
            }


            if (airlineCode != null)
            {
                if (!airlineCode.Equals(ticketObj.airlineCode))
                {
                    continue;
                }
            }

            aifeiTicket.fromCityCode = ticketObj.fromCity;
            long fromCityId = 0;
            aifeiTicket.fromCity   = ReadXmlHelper.GetFromCityNameByCode(ticketObj.fromCity, out fromCityId);
            aifeiTicket.fromCityId = fromCityId.ToString();

            //查找city信息
            //string str = "select * from FY_FromCity where cityCode='" + ticketObj.fromCity.Trim() + "'";
            //DataSet ds = SqlHelper.ExecuteDataset(SqlHelper.ConnString_select, CommandType.Text, str);
            //if (ds != null)
            //{
            //    aifeiTicket.fromCity = ds.Tables[0].Rows[0]["chName"].ToString();
            //    aifeiTicket.fromCityId = ds.Tables[0].Rows[0]["fId"].ToString();
            //}
            //else
            //{
            //    aifeiTicket.fromCity = "";
            //    aifeiTicket.fromCityId = "0";
            //}

            aifeiTicket.toCityCode = ticketObj.toCity;
            long toCityId = 0;
            aifeiTicket.toCity   = ReadXmlHelper.GetToCityNameByCode(ticketObj.toCity, out toCityId);
            aifeiTicket.toCityId = toCityId.ToString();

            //查找city信息
            //str = "select * from FY_ToCity where cityCode='" + ticketObj.toCity.Trim() + "'";
            //ds = SqlHelper.ExecuteDataset(SqlHelper.ConnString_select, CommandType.Text, str);
            //if (ds != null)
            //{
            //    aifeiTicket.toCity = ds.Tables[0].Rows[0]["chName"].ToString();
            //    aifeiTicket.toCityId = ds.Tables[0].Rows[0]["tId"].ToString();
            //}
            //else
            //{
            //    aifeiTicket.toCity = "";
            //    aifeiTicket.toCityId = "0";
            //}

            aifeiTicket.airlineCode = ticketObj.airlineCode;


            //查找airline信息
            long   airlineId1      = 0;
            string airlineSmallPic = string.Empty;
            string airline         = ReadXmlHelper.GetAirLineNameByCode(ticketObj.airlineCode, out airlineId1, out airlineSmallPic);
            aifeiTicket.airline         = airline;
            aifeiTicket.airlineId       = airlineId1.ToString();
            aifeiTicket.airlineSmallPic = airlineSmallPic;

            //str = "select * from FY_Airline where airlineCode='" + ticketObj.airlineCode.Trim() +"'";
            //ds = SqlHelper.ExecuteDataset(SqlHelper.ConnString_select, CommandType.Text, str);

            //if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
            //{
            //    aifeiTicket.airline =  ;
            //    aifeiTicket.airlineId = ds.Tables[0].Rows[0]["aId"].ToString();
            //    aifeiTicket.airlineSmallPic = ds.Tables[0].Rows[0]["smallPic"].ToString();
            //}
            //else
            //{
            //    aifeiTicket.airline = "";
            //    aifeiTicket.airlineId = "0";
            //}

            aifeiTicket.sourceType = "aifei";
            if (ticketObj.type == "SF")
            {
                aifeiTicket.tripType = "1";
            }
            else if (ticketObj.type == "DC")
            {
                aifeiTicket.tripType = "0";
            }
            //aifeiTicket.isRelay = ticketObj.type;

            //查找税费信息
            //string str = "select * from FY_Tax where airline='" + aifeiTicket.airlineId + "' and fromCity='" + fromCityId + "' and toCity='" + toCityId + "'";
            //DataSet ds = SqlHelper.ExecuteDataset(SqlHelper.ConnString_select, CommandType.Text, str);
            //if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
            //{
            //    aifeiTicket.tax = ds.Tables[0].Rows[0]["tax"].ToString();
            //}
            //else
            //{
            //    aifeiTicket.tax = "---";
            //}


            //本地查询航班信息 from to airline fromtime

            /*
             * ArrayList flightList = getFlightMsg(aifeiTicket.fromCityCode, aifeiTicket.toCityCode, aifeiTicket.airlineCode, ToTime);
             * if(flightList == null){
             *      //增加航班信息缓存
             *      //请求航班信息
             *      flightList = this.GlobalFlight(aifeiTicket.fromCityCode, aifeiTicket.toCityCode, aifeiTicket.airlineCode, "Y", 1, ToTime);
             *      //flightList = new ArrayList();
             * }
             * aifeiTicket.flights = flightList;
             */

            tickets.Add(aifeiTicket);
        }
        //this.GlobalFlight(string fromCode,string toCode,string airLineCode,string cls,int num,string goTime);

        return(tickets);
    }
Exemplo n.º 5
0
    /// <summary>
    /// 获取Fei580票价
    /// </summary>
    /// <returns></returns>
    protected List <FlightRoundTrip> getFei580Ticekt()
    {
        #region SQL语句
        StringBuilder str = new StringBuilder();
        str.Append("select top 100 percent");
        str.Append(" FY_Ticket.tid,FY_Ticket.untaxPrice,FY_Ticket.relayPort,FY_Ticket.tripType,");
        str.Append(" FY_FromCity.cityCode as fromCityCode,");
        str.Append(" FY_ToCity.cityCode as toCityCode,");
        str.Append(" FY_Tax.tax,");
        str.Append(" FY_FromCity.chName as fromCityname,FY_FromCity.fId,FY_Airline.aId,FY_ToCity.tId as toId,");
        str.Append(" FY_ToCity.chName as toCityname,FY_Airline.airlineCode as airlineCode,FY_Airline.chName as airname, FY_Airline.smallPic as smallPic from FY_Ticket ");
        str.Append(" left join FY_FromCity on FY_FromCity.fId=FY_Ticket.fromCity");
        str.Append(" left join FY_ToCity on FY_ToCity.tId=FY_Ticket.toCity");
        str.Append(" left join FY_Airline on FY_Airline.aId=FY_Ticket.airLine");
        str.Append(" left join FY_Tax on (FY_Ticket.tripType =FY_Tax.taxType and FY_Ticket.airLine = FY_Tax.airline and FY_Ticket.toCity = FY_Tax.toCity and FY_Ticket.fromCity = FY_Tax.fromCity)");
        str.Append(" where 1=1 ");
        if (this.tripType != 2)
        {
            str.Append(" and (FY_Ticket.tripType=" + this.tripType + ")");
        }
        if (this.fromcity != 0)
        {
            str.Append(" and (FY_FromCity.fId=" + this.fromcity + ")");
        }
        if (!string.IsNullOrEmpty(this.tocityName1))
        {
            str.Append(" and (FY_ToCity.chName like '%" + tocityName1 + "%')");
        }
        if (!string.IsNullOrEmpty(this.tripDate))
        {
            str.Append(" and (FY_Ticket.fromtripDate<='" + tripDate + "' and FY_Ticket.totripDate>='" + tripDate + "' )");
        }
        if (!string.IsNullOrEmpty(this.tripDate) && !string.IsNullOrEmpty(this.backDate) && this.tripType != 0)
        {
            int day = (Convert.ToDateTime(backDate) - Convert.ToDateTime(tripDate)).Days;
            str.Append(" and DateDiff(d,FY_Ticket.fromtripDate,FY_Ticket.totripDate) >= " + day);
        }
        str.Append(" and (FY_Ticket.tosaleDate>='" + DateTime.Now.ToString("yyyy-MM-dd") + "')");
        if (!string.IsNullOrEmpty(this.airlineId))
        {
            str.Append(" and (FY_Airline.aId=" + airlineId + ")");
        }
        if (string.IsNullOrEmpty(this.orderStr))
        {
            str.Append(" order by FY_Ticket.untaxPrice asc ,FY_Ticket.tId desc");
        }
        else
        {
            str.Append(" order by FY_Ticket." + this.orderStr + " asc ,FY_Ticket.tId desc");
        }
        #endregion
        DataSet   ds = SqlHelper.ExecuteDataset(SqlHelper.ConnString_select, CommandType.Text, str.ToString());
        DataTable dt = ds.Tables[0];

        List <FlightRoundTrip> ListRTrip = new List <FlightRoundTrip>();

        foreach (DataRow dr in dt.Rows)
        {
            FlightRoundTrip    rTrip  = new FlightRoundTrip();
            List <FlightInfo>  listF  = new List <FlightInfo>();
            List <FlightInfo2> listF2 = new List <FlightInfo2>();
            if (Convert.ToInt32(dr["tripType"]) == 0)
            {
                #region 单程
                List <FlightDetail> listDeteil = new List <FlightDetail>();
                FlightInfo          finfo      = new FlightInfo();
                finfo.Data        = Guid.NewGuid().ToString("N").ToUpper();
                finfo.Source      = "feiying";
                finfo.TicketPrice = decimal.Parse(dr["untaxPrice"].ToString());
                finfo.XmlInfo     = dr["tid"].ToString();
                finfo.Tid         = dr["tid"].ToString();

                FlightDetail fdInfo = new FlightDetail();
                fdInfo.AirCompanyCode = dr["airlineCode"].ToString();
                fdInfo.StartCityCode  = dr["fromCityCode"].ToString();
                fdInfo.StartCityName  = ReadXmlHelper.GetAirPortNameByCode(dr["fromCityCode"].ToString());
                fdInfo.BeginCityName  = dr["fromCityname"].ToString();

                //如果有中转,则到达城市、机场等替换为中转地
                if (string.IsNullOrEmpty(dr["relayPort"].ToString()))
                {
                    fdInfo.EndCityCode = dr["toCityCode"].ToString();
                    fdInfo.EndCityName = ReadXmlHelper.GetAirPortNameByCode(dr["toCityCode"].ToString());
                    fdInfo.ToCityName  = dr["toCityname"].ToString();
                }
                else
                {
                    string[] array = dr["relayPort"].ToString().Split('-');
                    fdInfo.EndCityCode = array[0];
                    fdInfo.EndCityName = ReadXmlHelper.GetAirPortNameByCode(array[0]);
                    long a = 0;//纯粹接收参数
                    fdInfo.ToCityName = ReadXmlHelper.GetToCityNameByCode(array[0], out a);
                }

                fdInfo.FromTime   = DateTime.Parse(ReadTime(this.tripDate, 0));
                fdInfo.ArriveTime = ReadTime(fdInfo.FromTime);
                listDeteil.Add(fdInfo);
                //如果有中转
                if (!string.IsNullOrEmpty(dr["relayPort"].ToString()))
                {
                    FlightDetail fdInfo2 = new FlightDetail();
                    fdInfo2.AirCompanyCode = string.Empty;       //dr["airlineCode"].ToString();
                    fdInfo2.StartCityCode  = fdInfo.EndCityCode; //dr["fromCityCode"].ToString();
                    fdInfo2.EndCityCode    = dr["toCityCode"].ToString();
                    fdInfo2.StartCityName  = ReadXmlHelper.GetAirPortNameByCode(fdInfo.EndCityCode);
                    fdInfo2.EndCityName    = ReadXmlHelper.GetAirPortNameByCode(dr["toCityCode"].ToString());
                    fdInfo2.BeginCityName  = fdInfo.ToCityName;//dr["fromCityname"].ToString();
                    fdInfo2.ToCityName     = dr["toCityname"].ToString();
                    fdInfo2.FromTime       = ReadTime(fdInfo.ArriveTime);
                    fdInfo2.ArriveTime     = ReadTime(fdInfo2.FromTime);
                    listDeteil.Add(fdInfo2);
                }
                finfo.ListInterFlightDetails = listDeteil;
                listF.Add(finfo);
                #endregion
            }
            else
            {
                #region 去程
                List <FlightDetail> listDeteil = new List <FlightDetail>();
                FlightInfo          finfo      = new FlightInfo();
                finfo.Data        = Guid.NewGuid().ToString("N").ToUpper();
                finfo.Source      = "feiying";
                finfo.TicketPrice = decimal.Parse(dr["untaxPrice"].ToString());
                finfo.XmlInfo     = dr["tid"].ToString();
                finfo.Tid         = dr["tid"].ToString();

                FlightDetail fdInfo = new FlightDetail();
                fdInfo.AirCompanyCode = dr["airlineCode"].ToString();
                fdInfo.StartCityCode  = dr["fromCityCode"].ToString();
                fdInfo.StartCityName  = ReadXmlHelper.GetAirPortNameByCode(dr["fromCityCode"].ToString());
                fdInfo.BeginCityName  = dr["fromCityname"].ToString();

                //如果有中转,则到达城市、机场等替换为中转地
                if (string.IsNullOrEmpty(dr["relayPort"].ToString()))
                {
                    fdInfo.EndCityCode = dr["toCityCode"].ToString();
                    fdInfo.EndCityName = ReadXmlHelper.GetAirPortNameByCode(dr["toCityCode"].ToString());
                    fdInfo.ToCityName  = dr["toCityname"].ToString();
                }
                else
                {
                    string[] array = dr["relayPort"].ToString().Split('-');
                    fdInfo.EndCityCode = array[0];
                    fdInfo.EndCityName = ReadXmlHelper.GetAirPortNameByCode(array[0]);
                    long a = 0;//纯粹接收参数
                    fdInfo.ToCityName = ReadXmlHelper.GetToCityNameByCode(array[0], out a);
                }

                fdInfo.FromTime   = DateTime.Parse(ReadTime(this.tripDate, 0));
                fdInfo.ArriveTime = ReadTime(fdInfo.FromTime);
                listDeteil.Add(fdInfo);
                //如果有中转
                if (!string.IsNullOrEmpty(dr["relayPort"].ToString()))
                {
                    FlightDetail fdInfo2 = new FlightDetail();
                    fdInfo2.AirCompanyCode = string.Empty;       //dr["airlineCode"].ToString();
                    fdInfo2.StartCityCode  = fdInfo.EndCityCode; //dr["fromCityCode"].ToString();
                    fdInfo2.EndCityCode    = dr["toCityCode"].ToString();
                    fdInfo2.StartCityName  = ReadXmlHelper.GetAirPortNameByCode(fdInfo.EndCityCode);
                    fdInfo2.EndCityName    = ReadXmlHelper.GetAirPortNameByCode(dr["toCityCode"].ToString());
                    fdInfo2.BeginCityName  = fdInfo.ToCityName;//dr["fromCityname"].ToString();
                    fdInfo2.ToCityName     = dr["toCityname"].ToString();
                    fdInfo2.FromTime       = ReadTime(fdInfo.ArriveTime);
                    fdInfo2.ArriveTime     = ReadTime(fdInfo2.FromTime);
                    listDeteil.Add(fdInfo2);
                }
                finfo.ListInterFlightDetails = listDeteil;
                listF.Add(finfo);
                #endregion

                #region 返程
                List <FlightDetail> listDeteil2 = new List <FlightDetail>();
                FlightInfo2         finfo2      = new FlightInfo2();
                finfo2.Source      = "feiying";
                finfo2.TicketPrice = decimal.Parse(dr["untaxPrice"].ToString());

                FlightDetail fdbkInfo = new FlightDetail();
                fdbkInfo.AirCompanyCode = dr["airlineCode"].ToString();
                fdbkInfo.StartCityCode  = dr["toCityCode"].ToString();
                fdbkInfo.StartCityName  = fdInfo.EndCityName;//使用去程的到达机场作为返回的出发机场 //ReadXmlHelper.GetAirPortNameByCode(dr["toCityCode"].ToString());
                fdbkInfo.BeginCityName  = dr["toCityname"].ToString();

                //如果有中转,则到达城市、机场等替换为中转地
                if (string.IsNullOrEmpty(dr["relayPort"].ToString()))
                {
                    fdbkInfo.EndCityCode = dr["fromCityCode"].ToString();
                    fdbkInfo.EndCityName = fdInfo.StartCityName;//使用去程的出发机场作为返回的到达机场 //ReadXmlHelper.GetAirPortNameByCode(dr["fromCityCode"].ToString());
                    fdbkInfo.ToCityName  = dr["fromCityname"].ToString();
                }
                else
                {
                    string[] array = dr["relayPort"].ToString().Split('-');
                    fdbkInfo.EndCityCode = array[0];
                    fdbkInfo.EndCityName = fdInfo.EndCityName;
                    long a = 0;                              //纯粹接收参数
                    fdbkInfo.ToCityName = fdInfo.ToCityName; //ReadXmlHelper.GetToCityNameByCode(array[0], out a);
                }

                fdbkInfo.FromTime   = DateTime.Parse(ReadTime(this.backDate, 0));
                fdbkInfo.ArriveTime = ReadTime(fdbkInfo.FromTime);
                listDeteil2.Add(fdbkInfo);
                //如果有中转
                if (!string.IsNullOrEmpty(dr["relayPort"].ToString()))
                {
                    FlightDetail fdbkInfo2 = new FlightDetail();
                    fdbkInfo2.AirCompanyCode = string.Empty;         //dr["airlineCode"].ToString();
                    fdbkInfo2.StartCityCode  = fdbkInfo.EndCityCode; //dr["fromCityCode"].ToString();
                    fdbkInfo2.EndCityCode    = dr["fromCityCode"].ToString();
                    fdbkInfo2.StartCityName  = fdbkInfo.EndCityName; //使用第一次中转的到达机场作为第二次中转的出发机场 //ReadXmlHelper.GetAirPortNameByCode(fdbkInfo.EndCityCode);
                    fdbkInfo2.EndCityName    = fdInfo.StartCityName; //使用去程的出发机场作为返回的到达机场 //ReadXmlHelper.GetAirPortNameByCode(dr["fromCityCode"].ToString());
                    fdbkInfo2.BeginCityName  = fdInfo.ToCityName;    //使用去程的到达城市作为返回的出发城市 //dr["fromCityname"].ToString();
                    fdbkInfo2.ToCityName     = dr["fromCityname"].ToString();
                    fdbkInfo2.FromTime       = ReadTime(fdbkInfo.ArriveTime);
                    fdbkInfo2.ArriveTime     = ReadTime(fdbkInfo2.FromTime);
                    listDeteil2.Add(fdbkInfo2);
                }
                finfo2.ListInterFlightDetails = listDeteil2;
                listF2.Add(finfo2);
                #endregion
            }
            rTrip.ListInterFlightInfo  = listF;
            rTrip.ListInterFlightInfo2 = listF2;
            ListRTrip.Add(rTrip);
        }
        return(ListRTrip);
    }