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); } } }
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); }
/// <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); }