/// <summary> ///把数据里的坐标处理为临时坐标 /// </summary> /// <param name="arcBuildings"></param> /// <returns></returns> static public List <TemplateLine> createMyTempline(List <ArcBuilding> arcBuildings) { ReadXmlHelper readXmlHelper = new ReadXmlHelper(); List <TemplateLine> templateLines = new List <TemplateLine>(); foreach (ArcBuilding arcBuilding in arcBuildings) { foreach (string coords in arcBuilding.coords)//遍历建筑物中的坐标串 { TemplateLine templateLine = new TemplateLine(); List <Coordinate> coordinates = new List <Coordinate>(); coordinates = readXmlHelper.ConvertCoordFromString(coords);//坐标字符串形成一个坐标串 // coordinates = readXmlHelper.deleteOppositeVector(coordinates); templateLine.Id = arcBuilding.ArcEntityId; templateLine.coords = (coordinates); templateLines.Add(templateLine); } foreach (string coords in arcBuilding.LinearCoords)//遍历线串 { TemplateLine templateLine = new TemplateLine(); List <Coordinate> coordinates = new List <Coordinate>(); coordinates = readXmlHelper.ConvertCoordFromString(coords);//坐标字符串形成一个坐标串 // coordinates = readXmlHelper.deleteOppositeVector(coordinates);//删除有闭合回环的线 templateLine.Id = arcBuilding.ArcEntityId; templateLine.coords = (coordinates); templateLines.Add(templateLine); } } return(templateLines); }
protected string display_route(string route) { string result = string.Empty; string[] array = route.Split('-'); foreach (string s in array) { result += ReadXmlHelper.GetAirPortNameByCode(s) + "-"; } return(result.TrimEnd('-')); }
protected string printf_flights(AiFeiTicket aft, string type) { if (type.Equals("from")) { string str = ""; if (aft.tripType.Equals("1")) { str += "<li class='lititle1'>" + ReadXmlHelper.GetAirPortNameByCode(aft.fromCityCode) + "</li><li class='lititle2'>起飞:" + convertDate(ajaxToTime, readTimeFromCookie(aft.fromCityCode, aft.toCityCode, aft.airlineCode, "toDt", ajaxToTime)) + "</li>"; str += "<li class='lititle1'>" + ReadXmlHelper.GetAirPortNameByCode(aft.toCityCode) + "</li><li class='lititle2'>起飞:" + convertDate(ajaxFromTime, readTimeFromCookie(aft.toCityCode, aft.fromCityCode, aft.airlineCode, "toDt", ajaxFromTime)) + "</li>"; } if (aft.tripType.Equals("0")) { str += "<li class='lititle1'>" + ReadXmlHelper.GetAirPortNameByCode(aft.fromCityCode) + "</li><li class='lititle2'>起飞:" + convertDate(ajaxToTime, readTimeFromCookie(aft.fromCityCode, aft.toCityCode, aft.airlineCode, "toDt", ajaxToTime)) + "</li>"; } return(str); } else if (type.Equals("to")) { string str = ""; if (aft.tripType.Equals("1")) { str += "<li class='lititle1'>" + ReadXmlHelper.GetAirPortNameByCode(aft.toCityCode) + "</li><li class='lititle2'>到达:" + convertDate(ajaxToTime, readTimeFromCookie(aft.fromCityCode, aft.toCityCode, aft.airlineCode, "arriveDt", ajaxToTime)) + "</li>"; str += "<li class='lititle1'>" + ReadXmlHelper.GetAirPortNameByCode(aft.fromCityCode) + "</li><li class='lititle2'>到达:" + convertDate(ajaxFromTime, readTimeFromCookie(aft.toCityCode, aft.fromCityCode, aft.airlineCode, "arriveDt", ajaxFromTime)) + "</li>"; } if (aft.tripType.Equals("0")) { str += "<li class='lititle1'>" + ReadXmlHelper.GetAirPortNameByCode(aft.toCityCode) + "</li><li class='lititle2'>到达:" + convertDate(ajaxToTime, readTimeFromCookie(aft.fromCityCode, aft.toCityCode, aft.airlineCode, "arriveDt", ajaxToTime)) + "</li>"; } return(str); } else if (type.Equals("line")) { string str = ""; if (aft.tripType.Equals("1")) { str += "<li class='lititle1'><img src='/images/sgo.gif'/>→</li><li class='lititle2'> </li>"; str += "<li class='lititle1'><img src='/images/sback.gif'/>→</li><li class='lititle2'> </li>"; } if (aft.tripType.Equals("0")) { str += "<li class='lititle1'><img src='/images/sgo.gif'/>→</li><li class='lititle2'> </li>"; } return(str); } return(""); }
/// <summary> /// 推送带参数信息 /// </summary> /// <returns></returns> public ActionResult MassTextingPram() { string accessToken = WxHelper.GetWXAccessToken(WxConfig.AppId, WxConfig.Secret); string msgUrl = "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=" + accessToken; string openid = "oQSqlxIdxzhOrxtxKI9z-KYGRAec"; string xmlMsg = ReadXmlHelper.GetXmlValue(Server.MapPath("/Config/WX.xml"), "PushMsg"); string pushMsg = string.Format(xmlMsg, openid); //string pushMsg = string.Format(xmlMsg, openid, "", "", ""); string result = WxHelper.HttpPostRequest(msgUrl, pushMsg); return(Content(result)); }
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); } } }
protected string printf_flights(FeiYingFlight toFlight, FeiYingFlight backFlight, string type, string ticketType) { if (type.Equals("from")) { string str = ""; if (toFlight != null) { str += "<li class='lititle1'>" + ReadXmlHelper.GetAirPortNameByCode(from) + "</li><li class='lititle2'>起飞:" + convertDate(totime, toFlight.startTime) + "</li>"; } if (backFlight != null) { str += "<li class='lititle1'>" + ReadXmlHelper.GetAirPortNameByCode(to) + "</li><li class='lititle2'>起飞:" + convertDate(fromtime, backFlight.startTime) + "</li>"; } return(str); } else if (type.Equals("to")) { string str = ""; if (toFlight != null) { str += "<li class='lititle1'>" + ReadXmlHelper.GetAirPortNameByCode(to) + "</li><li class='lititle2'>到达:" + convertDate(totime, toFlight.startTime, toFlight.arriveTime) + "</li>"; } if (backFlight != null) { str += "<li class='lititle1'>" + ReadXmlHelper.GetAirPortNameByCode(from) + "</li><li class='lititle2'>到达:" + convertDate(fromtime, backFlight.startTime, backFlight.arriveTime) + "</li>"; } return(str); } else if (type.Equals("line")) { string str = ""; if (toFlight != null) { str += "<li class='lititle1'><img src='/images/sgo.gif'/>→</li><li class='lititle2'> </li>"; } if (backFlight != null) { str += "<li class='lititle1'><img src='/images/sback.gif'/>→</li><li class='lititle2'> </li>"; } return(str); } return(""); }
/// <summary> /// 获取所有模式 /// </summary> /// <returns></returns> public static List <LBModel> FindModels(List <string> listModelNames) { List <LBModel> listLBModels = new List <LBModel>(); foreach (string name in listModelNames) { LBModel lbModel = ReadXmlHelper.getListBoxMsgs(WriteXmlHelper.FILE_MODEL + name + ".xml"); lbModel.ModelName = name; listLBModels.Add(lbModel); //if (lbModel.Active) { // listLBModels.Add(lbModel); //} } return(listLBModels); }
static void Main(string[] args) { int pageSize = 10; int minval = Convert.ToInt32(ConfigurationManager.AppSettings["MinValue"]); int maxval = Convert.ToInt32(ConfigurationManager.AppSettings["MaxValue"]); string Creation_Time = ConfigurationManager.AppSettings["Time"]; string fileName = DateTime.Now.ToString("yyyMMddHHmmss") + "log.txt"; string where = " and QS.creation_time<'" + Creation_Time + "'"; #region for (int i = minval; i < maxval; i++) { var sql = ReadXmlHelper.GetXmlValue(Environment.CurrentDirectory + "/../../SQLXml.xml", "GetExcutePage"); sql = string.Format(sql, where, (i - 1) * pageSize + 1, i * pageSize); //DataTable dt = SqlHelper.ExecuteTable(SqlHelper.GetConnection("GoalConStr"), CommandType.Text, sql); SqlDataReader reader = SqlHelper.ExecuteReader(SqlHelper.GetConnection("GoalConStr"), CommandType.Text, sql); //生成语句 //GenerateSqlByRender(reader); //sql方法 DataBulkCopy(reader); Console.WriteLine(i); WriteLog(fileName, ConvertLog(i, where, pageSize)); } #endregion //Console.WriteLine(json); //string aa = Console.ReadLine(); //Console.WriteLine(aa); //new Plinq().AddList(); //new Plinq().ConcurrentBag(); //new ThreadDemo().ParallelInvokeMethod(); Console.ReadLine(); }
protected void Page_Load(object sender, EventArgs e) { string contrast_str = ""; if (Request.Cookies["contrast_str"] == null) { Response.Cookies["contrast_str"].Value = contrast_str; Response.Cookies["contrast_str"].Expires = DateTime.Now.AddDays(1); } else { contrast_str = Request.Cookies["contrast_str"].Value; } if (Request.QueryString["addId"] != null && Request.QueryString["addId"] != "") { string addId = Request.QueryString["addId"].ToString(); if (contrast_str.IndexOf(addId + ",") == -1) { contrast_str = contrast_str + addId + ","; Response.Cookies["contrast_str"].Value = contrast_str; Response.Cookies["contrast_str"].Expires = DateTime.Now.AddDays(1); } } if (Request.QueryString["delId"] != null && Request.QueryString["delId"] != "") { string delId = Request.QueryString["delId"].ToString(); if (contrast_str.IndexOf(delId + ",") > -1) { contrast_str = contrast_str.Replace(delId + ",", ""); Response.Cookies["contrast_str"].Value = contrast_str; Response.Cookies["contrast_str"].Expires = DateTime.Now.AddDays(1); } } contrast_array = contrast_str.Split(",".ToCharArray()); contrast_num = contrast_array.Length - 1; DataRow = new DataRow[contrast_num]; for (int i = 0; i < contrast_num; i++) { string idString = contrast_array[i].ToString(); if (idString.IndexOf("kabe") == -1) { int tid = Convert.ToInt32(contrast_array[i].ToString()); DataRow[i] = GetTicketDetail(tid); } else { kabe_flight flight = null; string[] array = idString.Split('_'); ArrayList tickets = (ArrayList)Session[string.Format("TicketsSessionKey_{0}_{1}_{2}_{3}_{4}", array[1], array[2], array[3], array[4], array[5])]; if (tickets == null || tickets.Count == 0) { Response.Redirect("/index.aspx"); return; } foreach (kabe_flight f in tickets) { if (f.ticketId == array[6]) { flight = f; } } if (flight == null) { Response.Redirect("/index.aspx"); return; } //查询机场信息 string logopic = string.Empty; string airchName = string.Empty; string planNum = string.Empty; string age = string.Empty; string smallPic = string.Empty; string logoPic = string.Empty; string airId = string.Empty; string tairportdescription = string.Empty; string airlineSql = "select chName,planNum,age,aid,airlineCode,description,smallPic,logoPic from FY_Airline where airlineCode='" + flight.airline + "'"; DataSet airlineDS = SqlHelper.ExecuteDataset(SqlHelper.ConnString_select, CommandType.Text, airlineSql); if (airlineDS != null && airlineDS.Tables.Count > 0 && airlineDS.Tables[0].Rows.Count > 0) { airchName = airlineDS.Tables[0].Rows[0]["chName"].ToString(); airId = airlineDS.Tables[0].Rows[0]["aid"].ToString(); smallPic = airlineDS.Tables[0].Rows[0]["smallPic"].ToString(); logoPic = airlineDS.Tables[0].Rows[0]["logoPic"].ToString(); tairportdescription = airlineDS.Tables[0].Rows[0]["description"].ToString(); planNum = airlineDS.Tables[0].Rows[0]["planNum"].ToString(); age = airlineDS.Tables[0].Rows[0]["age"].ToString(); } int days = new Random().Next(-60, -5); string fromCityName = string.Empty, toCityName = string.Empty; //出发 到达 航司 查询转机信息 DataTable dt = new DataTable(); dt.Columns.Add("fromCity"); dt.Columns.Add("toCity"); dt.Columns.Add("fromCityname"); dt.Columns.Add("fromCityCode"); dt.Columns.Add("toCityname"); dt.Columns.Add("toCityCode"); dt.Columns.Add("addtime"); dt.Columns.Add("untaxPrice"); dt.Columns.Add("tripType"); dt.Columns.Add("tId"); dt.Columns.Add("fAirportCode"); dt.Columns.Add("fromPort"); dt.Columns.Add("tAirportName"); dt.Columns.Add("logoPic"); dt.Columns.Add("airname"); dt.Columns.Add("planNum"); dt.Columns.Add("age"); dt.Columns.Add("smallPic"); dt.Columns.Add("bagPrice"); dt.Columns.Add("engerTicket"); dt.Columns.Add("seatShip"); dt.Columns.Add("shortstayDate"); dt.Columns.Add("attPrice"); dt.Columns.Add("longstayDate"); dt.Columns.Add("childPrice"); dt.Columns.Add("fromsaleDate"); dt.Columns.Add("tosaleDate"); dt.Columns.Add("fromtripDate"); dt.Columns.Add("totripDate"); dt.Columns.Add("returnMoney"); dt.Columns.Add("updateProvision"); dt.Columns.Add("limitProvision"); dt.Columns.Add("fAirportName"); dt.Columns.Add("tAirportCode"); dt.Columns.Add("toPort"); dt.Columns.Add("airId"); dt.Columns.Add("score"); dt.Columns.Add("zongping"); dt.Columns.Add("xiai"); dt.Columns.Add("xiaofei"); dt.Columns.Add("manyi"); dt.Columns.Add("fuwu"); dt.Columns.Add("relayPort"); dt.Columns.Add("returnTip"); dt.Columns.Add("tairportdescription"); dt.Columns.Add("startTime"); dt.Columns.Add("arriveTime"); dt.Rows.Add(getFromCityIdByCode(array[2], out fromCityName), getToCityIdByCode(array[3], out toCityName), fromCityName, array[2], toCityName, array[3], "2013-06-08", flight.adultprice, Convert.ToInt32(flight.ft) - 1, "tId", flight.depport, ReadXmlHelper.GetAirPortNameByCode(flight.depport), ReadXmlHelper.GetAirPortNameByCode(flight.arrport), logoPic, airchName, planNum, age, smallPic, string.Empty, //bagPrice "电子客票", //engerTicket this.display_seat(flight.deproute.seat), "30", //shortstayDate string.Empty, //attPrice "180", //afti.longstayDate, flight.childprice, Convert.ToDateTime(flight.deproute.depdate).AddDays(days).ToString("yyyy-MM-dd"), //convertDate(afti.fromsaleDate.Trim()), flight.deproute.depdate, //convertDate(afti.tosaleDate.Trim()), flight.deproute.depdate, //convertDate(afti.fromtripDate.Trim()), flight.deproute.arrdate, //convertDate(afti.totripDate.Trim()), string.Empty, //afti.returnMoney, string.Empty, //afti.updateProvision, "<p>1.此票价为净价,不含任何费用<br /> 2.票价如有更改,恕不另行通知<br /> 3.不可签转,不可更改行程<br /> 4.所有航段必须有确认的订座,不可开OPEN票. <br /> 5.退票手续 :可退票,需缴纳手续费<br /> 6.误机(NOSHOW) :需收取误机费<br /> 7.更改订座 : 允许更改。乘客必须于出发日之前取消原订的航班,否则按照 '误机' 处理<br /> 8.儿童票价 :成人票价的75% <br /> 9.婴儿票价 :使用 IATA 公布成人票价的10%<br /> </p>", //afti.limitProvision, ReadXmlHelper.GetAirPortNameByCode(flight.depport), // afti.fromAirportName, flight.arrport, //afti.toAirportCode, "toPort", airId, "100", //afti.score, "3", //afti.zongping, "2", //afti.xiai, "4", //afti.xiaofei, "4", //afti.manyi, "4", //afti.fuwu, flight.deproute.route, "returnTip", tairportdescription, flight.deproute.depdate + " " + flight.deproute.deptime.Insert(2, ":"), flight.deproute.arrdate + " " + flight.deproute.arrtime.Insert(2, ":")); DataRow[i] = dt.Rows[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); } }
protected void GetAiFeiTickets() { //获得页面参数 string dpt = ""; string arr = ""; string toTime = ""; string reTime = ""; string cate = ""; //出发城市 if (fromCity.SelectedValue != "" && fromCity.SelectedValue != "0") { //获得出发城市三字码 string cityCodeSql = "select cityCode from FY_FromCity where fId='" + fromCity.SelectedValue + "'"; DataSet dsCityCode = SqlHelper.ExecuteDataset(SqlHelper.ConnString_select, CommandType.Text, cityCodeSql); if (dsCityCode != null) { dpt = dsCityCode.Tables[0].Rows[0]["cityCode"].ToString(); } } else { return; } //目的城市 if (txtSearch_tocity.Value.Trim() != "") { //获得目的城市三字码 arr = txtSearch_tocity.Value.Trim().Substring(0, 3); } else { return; } //获得出发时间 if (fromtripDate_more.Value.Trim() != "") { toTime = fromtripDate_more.Value.Trim().Replace("-", ""); } else { return; } //获得到达时间 if (totripDate_more.Value.Trim() != "") { reTime = totripDate_more.Value.Trim().Replace("-", ""); } else { return; } //获得客票类型 if (cateSelect.Value.Trim() != "") { cate = cateSelect.Value.Trim(); } else { return; } //请求客票 AiFeiService aifeiService = new AiFeiService(); ArrayList data = aifeiService.GlobalTicket(dpt, arr, toTime, reTime, cate); ArrayList tickets = new ArrayList(); //排序爱飞机票 foreach (AiFeiTicketEntity orderTicket in data) { //过滤日期 DateTime dt = Convert.ToDateTime(orderTicket.totripDate.Substring(0, 4) + "-" + orderTicket.totripDate.Substring(4, 2) + "-" + orderTicket.totripDate.Substring(6, 2)); if ((dt - DateTime.Now).Days < 0) { continue; } //获取中转 FeiYingFlight toFlight = aifeiService.getFlightMsg2(orderTicket.fromCity, orderTicket.toCity, orderTicket.airlineCode, ""); if (toFlight != null) { if (string.IsNullOrEmpty(toFlight.relayPort)) { orderTicket.relayPort = "直飞"; } else { orderTicket.relayPort = ReadXmlHelper.GetAirPortNameByCode(toFlight.relayPort); } } if (tickets.Count == 0) { tickets.Add(orderTicket); } else { for (int i = 0; i < tickets.Count; i++) { AiFeiTicketEntity aft = (AiFeiTicketEntity)tickets[i]; if (tickets.Count <= i + 1) { tickets.Add(orderTicket); break; } else { AiFeiTicketEntity next = (AiFeiTicketEntity)tickets[i + 1]; if (Convert.ToDecimal(orderTicket.ticketPrice) > Convert.ToDecimal(aft.ticketPrice) && Convert.ToDecimal(orderTicket.ticketPrice) <= Convert.ToDecimal(next.ticketPrice)) { tickets.Insert(i + 1, orderTicket); break; } } } } } this.GetData = tickets; rptshopnews.DataSource = tickets; rptshopnews.DataBind(); }
protected void GetSearchTicket() { //从本地数据库查询 DataSet ds = new DataSet(); //查找航空公司名称 构造航空公司排序数组 string str = @"select top 100 percent"; str += " FY_Ticket.tid,FY_Ticket.untaxPrice,FY_Ticket.relayPort,FY_Ticket.tripType,"; str += " FY_FromCity.cityCode as fromCityCode,"; str += " FY_ToCity.cityCode as toCityCode,"; str += " FY_Tax.tax,"; str += " FY_FromCity.chName as fromCityname,FY_FromCity.fId,FY_Airline.aId,FY_ToCity.tId as toId,"; str += " FY_ToCity.chName as toCityname,FY_Airline.airlineCode as airlineCode,FY_Airline.chName as airname, FY_Airline.smallPic as smallPic from FY_Ticket "; str += " left join FY_FromCity on FY_FromCity.fId=FY_Ticket.fromCity"; str += " left join FY_ToCity on FY_ToCity.tId=FY_Ticket.toCity"; str += " left join FY_Airline on FY_Airline.aId=FY_Ticket.airLine"; str += " 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 += " where 1=1 "; //查找航空公司 string strAirline = @"select FY_Ticket.airLine,min(FY_Ticket.untaxPrice) as untaxPrice "; strAirline += " from FY_Ticket"; strAirline += " left join FY_FromCity on FY_FromCity.fId=FY_Ticket.fromCity"; strAirline += " left join FY_ToCity on FY_ToCity.tId=FY_Ticket.toCity"; strAirline += " left join FY_Tax on (FY_Ticket.airLine = FY_Tax.airline and FY_Ticket.toCity = FY_Tax.toCity and FY_Ticket.fromCity = FY_Tax.fromCity)"; strAirline += " where 1=1 "; if (tripTypeInt != 2) { str += " and (FY_Ticket.tripType=" + tripTypeInt + ")"; strAirline += " and (FY_Ticket.tripType=" + tripTypeInt + ")"; } if (fromCityId != 0) { str += " and (FY_FromCity.fId=" + fromCityId + ")"; strAirline += " and (FY_FromCity.fId=" + fromCityId + ")"; } if (toCityNameStr != "") { str += " and (FY_ToCity.chName like '%" + toCityNameStr + "%')"; strAirline += " and (FY_ToCity.chName like '%" + toCityNameStr + "%')"; } if (tripDateStr != "") { str += " and (FY_Ticket.fromtripDate<='" + tripDateStr + "' and FY_Ticket.totripDate>='" + tripDateStr + "' )"; strAirline += " and (FY_Ticket.fromtripDate<='" + tripDateStr + "' and FY_Ticket.totripDate>='" + tripDateStr + "' )"; } if (tripDateStr != "" && backDateStr != "" && tripTypeInt != 0) { int day = (Convert.ToDateTime(backDateStr) - Convert.ToDateTime(tripDateStr)).Days; str += " and DateDiff(d,FY_Ticket.fromtripDate,FY_Ticket.totripDate) >= " + day; strAirline += " and DateDiff(d,FY_Ticket.fromtripDate,FY_Ticket.totripDate) >= " + day; } str += " and (FY_Ticket.tosaleDate>='" + DateTime.Now.ToString("yyyy-MM-dd") + "')"; strAirline += " and (FY_Ticket.tosaleDate>='" + DateTime.Now.ToString("yyyy-MM-dd") + "')"; if (airlineId != 0) { str += " and (FY_Airline.aId=" + airlineId + ")"; } if (getorderStr != "") { str += " order by FY_Ticket." + getorderStr + " asc ,FY_Ticket.tId desc"; } else { str += " order by FY_Ticket.untaxPrice asc ,FY_Ticket.tId desc"; } ArrayList allAirlines = new ArrayList(); strAirline += " group by FY_Ticket.airLine order by min(FY_Ticket.untaxPrice) asc"; //查询航空公司 DataSet dsStrAirLine = SqlHelper.ExecuteDataset(SqlHelper.ConnString_select, CommandType.Text, strAirline); if (dsStrAirLine != null) { foreach (DataRow drAifeiAirline in dsStrAirLine.Tables[0].Rows) { AiFeiAirline afa = new AiFeiAirline(); afa.minPrice = drAifeiAirline["untaxPrice"].ToString(); afa.airlineId = drAifeiAirline["airLine"].ToString(); string code = string.Empty; string pic = string.Empty; afa.airlineName = ReadXmlHelper.GetAirLineNameByID(Convert.ToInt64(afa.airlineId), out code, out pic); afa.airlinePic = pic; afa.airlineCode = code; //if(allAirlines.Count<11) allAirlines.Add(afa); } } //从爱飞网获得数据并排序 AiFeiService aifeiService = new AiFeiService(); //ArrayList = aifeiService.GlobalTicket(dpt, arr, toTime, reTime, cate); ///dpt 出发三字码 arr 到达三字码 /// string arr = getToCityCodeByName(toCityNameStr); string dpt = getFromCityCodeByName(fromCityName); //string cate = "ALL"; string cate = "SF"; ArrayList aifeiTickets = new ArrayList(); if (tripTypeInt == 0) { cate = "DC"; aifeiTickets = aifeiService.AiFeiTickets(dpt, arr, ajaxToTime, ajaxFromTime, cate, airlineId, ref allAirlines);//过滤航空公司 } else if (tripTypeInt == 1) { cate = "SF"; aifeiTickets = aifeiService.AiFeiTickets(dpt, arr, ajaxToTime, ajaxFromTime, cate, airlineId, ref allAirlines);//过滤航空公司 } else if (tripTypeInt == 2) { System.Threading.AutoResetEvent resetEvent = new System.Threading.AutoResetEvent(false); AiFeiService.AiFeiTicketsHandler d1 = new AiFeiService.AiFeiTicketsHandler(aifeiService.AiFeiTickets); AiFeiService.AiFeiTicketsHandler d2 = new AiFeiService.AiFeiTicketsHandler(aifeiService.AiFeiTickets); IAsyncResult iar1 = null, iar2 = null; ArrayList aifeiTickets2 = null; AsyncCallback back1 = delegate(IAsyncResult iar) { aifeiTickets = d1.EndInvoke(ref allAirlines, iar1); if (iar2 != null && iar2.IsCompleted) { resetEvent.Set(); } }; AsyncCallback back2 = delegate(IAsyncResult iar) { aifeiTickets2 = d2.EndInvoke(ref allAirlines, iar2); if (iar1 != null && iar1.IsCompleted) { resetEvent.Set(); } }; iar1 = d1.BeginInvoke(dpt, arr, ajaxToTime, ajaxFromTime, "SF", airlineId, ref allAirlines, back1, null); iar2 = d2.BeginInvoke(dpt, arr, ajaxToTime, ajaxFromTime, "DC", airlineId, ref allAirlines, back2, null); if (resetEvent.WaitOne(2000, true)) { resetEvent.Close(); } if (aifeiTickets2 != null) { for (int i = 0; i < aifeiTickets2.Count; i++) { aifeiTickets.Add(aifeiTickets2[i]); } } } //获得爱飞机票列表 ArrayList tickets = new ArrayList(); ArrayList feiYingTickets = new ArrayList(); int aifeinum = Convert.ToInt32(this.hidd_aifeinum.Value); ds = SqlHelper.ExecuteDataset(SqlHelper.ConnString_select, CommandType.Text, str); //没数据 显示提示 if ((ds.Tables[0] == null || ds.Tables[0].Rows.Count == 0) && aifeiTickets.Count == 0) { this.panHaveValue2.Visible = false; this.panNoValue.Visible = true; return; } else { this.panHaveValue2.Visible = true; this.panNoValue.Visible = false; DataTable dt = ds.Tables[0]; //遍历行 foreach (DataRow dr in dt.Rows) { //遍历列 AiFeiTicket aifeiTicket = new AiFeiTicket(); aifeiTicket.ticketId = dr["tid"].ToString().Trim(); aifeiTicket.price = Convert.ToInt32(dr["untaxPrice"].ToString()); aifeiTicket.fromCity = dr["fromCityName"].ToString(); aifeiTicket.fromCityCode = dr["fromCityCode"].ToString(); aifeiTicket.fromCityId = dr["fId"].ToString(); aifeiTicket.toCity = dr["toCityName"].ToString(); aifeiTicket.toCityCode = dr["toCityCode"].ToString(); aifeiTicket.toCityId = dr["toId"].ToString(); aifeiTicket.airlineCode = dr["airlineCode"].ToString(); aifeiTicket.airline = dr["airname"].ToString(); aifeiTicket.airlineId = dr["aId"].ToString(); aifeiTicket.airlineSmallPic = dr["smallPic"].ToString(); aifeiTicket.relayPort = dr["relayPort"].ToString(); aifeiTicket.sourceType = "feiying"; aifeiTicket.tripType = dr["tripType"].ToString();//单程or往返 //查询税费信息 //aifeiTicket.tax = getTaxMessage(aifeiTicket.fromCityId, aifeiTicket.toCityId, aifeiTicket.airlineId, Convert.ToInt32(aifeiTicket.tripType)); feiYingTickets.Add(aifeiTicket); } } if (getorderStr.Equals("")) { //排序飞瀛机票 foreach (AiFeiTicket orderTicket in feiYingTickets) { if (tickets.Count == 0) { tickets.Add(orderTicket); } else { bool isEnd = false; for (int i = 0; i < tickets.Count && !isEnd; i++) { AiFeiTicket aft = (AiFeiTicket)tickets[i]; if ((i + 1) == tickets.Count && orderTicket.price > aft.price) { tickets.Add(orderTicket); isEnd = true; break; } else if (orderTicket.price <= aft.price) { tickets.Insert(i, orderTicket); isEnd = true; break; } } } } //排序爱飞机票 foreach (AiFeiTicket orderTicket in aifeiTickets) { if (tickets.Count == 0) { tickets.Add(orderTicket); } else { bool isEnd = false; for (int i = 0; i < tickets.Count && !isEnd; i++) { AiFeiTicket aft = (AiFeiTicket)tickets[i]; if ((i + 1) == tickets.Count && orderTicket.price > aft.price) { tickets.Add(orderTicket); isEnd = true; break; } else if (orderTicket.price < aft.price) { tickets.Insert(i, orderTicket); isEnd = true; break; } else if (orderTicket.price == aft.price && orderTicket.airlineCode.Equals(aft.airlineCode)) { isEnd = true; break; } } } } } else if (getorderStr.Equals("airLine")) { //航空公司排序 tickets = feiYingTickets; //排序爱飞机票 foreach (AiFeiTicket orderTicket in aifeiTickets) { if (tickets.Count == 0) { tickets.Add(orderTicket); } else { bool isEnd = false; for (int i = 0; i < tickets.Count && !isEnd; i++) { AiFeiTicket aft = (AiFeiTicket)tickets[i]; if ((i + 1) == tickets.Count && orderTicket.price > aft.price && orderTicket.airlineCode.Equals(aft.airlineCode)) { tickets.Add(orderTicket); isEnd = true; break; } else if (orderTicket.price < aft.price && orderTicket.airlineCode.Equals(aft.airlineCode)) { tickets.Insert(i, orderTicket); isEnd = true; break; } else if (orderTicket.price == aft.price && orderTicket.airlineCode.Equals(aft.airlineCode)) { isEnd = true; break; } } } } } //绑定航空公司 Session["TicketsSessionKey_Airlines"] = allAirlines; //写入Session 分页使用 Session["TicketsSessionKey_" + tripTypeInt + "_" + fromCityId + "_" + Server.HtmlEncode(toCityNameStr) + "_" + ajaxToTime + "_" + ajaxFromTime] = tickets; this.BindData(tickets); }
protected void Page_Load(object sender, EventArgs e) { if (Request.QueryString["tId"] != null) { string tId = Request.QueryString["tId"]; if (tId.IndexOf("kabe") == -1) { id = Convert.ToInt32(Request.QueryString["tId"].ToString()); ticketOne = GetTicketDetail(id); } else { string[] array = tId.Split('_'); ArrayList tickets = (ArrayList)Session[string.Format("TicketsSessionKey_{0}_{1}_{2}_{3}_{4}", array[1], array[2], array[3], array[4], array[5])]; if (tickets == null || tickets.Count == 0) { //scripthelp.AlertAndRedirect("记录超时,请重新查询票价信息!", "/index.aspx", this); Response.Redirect("/index.aspx"); return; } foreach (kabe_flight f in tickets) { if (f.ticketId == array[6]) { flight = f; } } if (flight == null) { //scripthelp.AlertAndRedirect("获取票价信息时报,请重新查询票价信息!", "/index.aspx", this); Response.Redirect("/index.aspx"); return; } //出发 到达 航司 查询转机信息 DataTable dt = new DataTable(); dt.Columns.Add("fromCity"); dt.Columns.Add("toCity"); dt.Columns.Add("fromCityname"); dt.Columns.Add("fromCityCode"); dt.Columns.Add("toCityname"); dt.Columns.Add("toCityCode"); dt.Columns.Add("addtime"); dt.Columns.Add("untaxPrice"); dt.Columns.Add("tripType"); dt.Columns.Add("tId"); dt.Columns.Add("fAirportCode"); dt.Columns.Add("fromPort"); dt.Columns.Add("tAirportName"); dt.Columns.Add("logoPic"); dt.Columns.Add("airname"); dt.Columns.Add("planNum"); dt.Columns.Add("age"); dt.Columns.Add("smallPic"); dt.Columns.Add("bagPrice"); dt.Columns.Add("engerTicket"); dt.Columns.Add("seatShip"); dt.Columns.Add("shortstayDate"); dt.Columns.Add("attPrice"); dt.Columns.Add("longstayDate"); dt.Columns.Add("childPrice"); dt.Columns.Add("fromsaleDate"); dt.Columns.Add("tosaleDate"); dt.Columns.Add("fromtripDate"); dt.Columns.Add("totripDate"); dt.Columns.Add("returnMoney"); dt.Columns.Add("updateProvision"); dt.Columns.Add("limitProvision"); dt.Columns.Add("fAirportName"); dt.Columns.Add("tAirportCode"); dt.Columns.Add("toPort"); dt.Columns.Add("airId"); dt.Columns.Add("score"); dt.Columns.Add("zongping"); dt.Columns.Add("xiai"); dt.Columns.Add("xiaofei"); dt.Columns.Add("manyi"); dt.Columns.Add("fuwu"); dt.Columns.Add("relayPort"); dt.Columns.Add("returnTip"); dt.Columns.Add("tairportdescription"); dt.Columns.Add("startTime"); dt.Columns.Add("arriveTime"); this.pan_aifeitime.Visible = true; //查询机场信息 string logopic = string.Empty; string airchName = string.Empty; string planNum = string.Empty; string age = string.Empty; string smallPic = string.Empty; string logoPic = string.Empty; string airId = string.Empty; string tairportdescription = string.Empty; string airlineSql = "select chName,planNum,age,aid,airlineCode,description,smallPic,logoPic from FY_Airline where airlineCode='" + flight.airline + "'"; DataSet airlineDS = SqlHelper.ExecuteDataset(SqlHelper.ConnString_select, CommandType.Text, airlineSql); if (airlineDS != null && airlineDS.Tables.Count > 0 && airlineDS.Tables[0].Rows.Count > 0) { airchName = airlineDS.Tables[0].Rows[0]["chName"].ToString(); airId = airlineDS.Tables[0].Rows[0]["aid"].ToString(); smallPic = airlineDS.Tables[0].Rows[0]["smallPic"].ToString(); logoPic = airlineDS.Tables[0].Rows[0]["logoPic"].ToString(); tairportdescription = airlineDS.Tables[0].Rows[0]["description"].ToString(); planNum = airlineDS.Tables[0].Rows[0]["planNum"].ToString(); age = airlineDS.Tables[0].Rows[0]["age"].ToString(); } int days = new Random().Next(-60, -5); this.flight_fplan = this.display_plan(flight.segment, flight.deproute.route); if (flight.ft == "2") { this.flight_tplan = this.display_plan(flight.segment, flight.arrroute.route); } dt.Rows.Add(getFromCityIdByCode(array[2]), getToCityIdByCode(array[3]), this.fromCityName, array[2], this.toCityName, array[3], "2013-06-08", flight.adultprice, Convert.ToInt32(flight.ft) - 1, tId, flight.depport, ReadXmlHelper.GetAirPortIDByCode(flight.depport), ReadXmlHelper.GetAirPortNameByCode(flight.arrport), logoPic, airchName, planNum, age, smallPic, string.Empty, //bagPrice "电子客票", //engerTicket this.display_seat(flight.deproute.seat), "30", //shortstayDate string.Empty, //attPrice "180", //afti.longstayDate, flight.childprice, Convert.ToDateTime(flight.deproute.depdate).AddDays(days).ToString("yyyy-MM-dd"), //convertDate(afti.fromsaleDate.Trim()), flight.deproute.depdate, //convertDate(afti.tosaleDate.Trim()), flight.deproute.depdate, //convertDate(afti.fromtripDate.Trim()), flight.deproute.arrdate, //convertDate(afti.totripDate.Trim()), string.Empty, //afti.returnMoney, string.Empty, //afti.updateProvision, "<p>1.此票价为净价,不含任何费用<br /> 2.票价如有更改,恕不另行通知<br /> 3.不可签转,不可更改行程<br /> 4.所有航段必须有确认的订座,不可开OPEN票. <br /> 5.退票手续 :可退票,需缴纳手续费<br /> 6.误机(NOSHOW) :需收取误机费<br /> 7.更改订座 : 允许更改。乘客必须于出发日之前取消原订的航班,否则按照 '误机' 处理<br /> 8.儿童票价 :成人票价的75% <br /> 9.婴儿票价 :使用 IATA 公布成人票价的10%<br /> </p>", //afti.limitProvision, ReadXmlHelper.GetAirPortNameByCode(flight.depport), // afti.fromAirportName, flight.arrport, //afti.toAirportCode, ReadXmlHelper.GetAirPortIDByCode(flight.arrport), airId, "100", //afti.score, "3", //afti.zongping, "2", //afti.xiai, "4", //afti.xiaofei, "4", //afti.manyi, "4", //afti.fuwu, flight.deproute.route, "returnTip", tairportdescription, flight.deproute.depdate + " " + flight.deproute.deptime.Insert(2, ":"), flight.deproute.arrdate + " " + flight.deproute.arrtime.Insert(2, ":")); //fromCityname,toCityname,toCityCode,toCityname,addtime, //untaxPrice,tripType,tId,fAirportCode,fromCityCode,fromPort, //tAirportName,logoPic,airname,planNum,age //smallPic,bagPrice,engerTicket,seatShip,shortstayDate,attPrice //longstayDate,childPrice,fromsaleDate,tosaleDate, //fromtripDate,totripDate,returnMoney,updateProvision ticketOne = dt.Rows[0]; } int fCityId = Convert.ToInt32(ticketOne["fromCity"].ToString()); int tCityId = Convert.ToInt32(ticketOne["toCity"].ToString()); ticket_7 = GetTicketDetailBydelay(7, fCityId, tCityId, 6); ticket_14 = GetTicketDetailBydelay(14, fCityId, tCityId, 6); ticket_30 = GetTicketDetailBydelay(30, fCityId, tCityId, 6); ticket_60 = GetTicketDetailBydelay(60, fCityId, tCityId, 6); ticket_90 = GetTicketDetailBydelay(90, fCityId, tCityId, 6); ticket_120 = GetTicketDetailBydelay(120, fCityId, tCityId, 6); ticket_180 = GetTicketDetailBydelay(180, fCityId, tCityId, 6); ticket_365 = GetTicketDetailBydelay(365, fCityId, tCityId, 6); ticket_all = GetTicketDetailBydelay(0, fCityId, tCityId, 5); tmax = tmax > ticket_7.Count ? tmax : ticket_7.Count; tmax = tmax > ticket_14.Count ? tmax : ticket_14.Count; tmax = tmax > ticket_30.Count ? tmax : ticket_30.Count; tmax = tmax > ticket_60.Count ? tmax : ticket_60.Count; tmax = tmax > ticket_90.Count ? tmax : ticket_90.Count; tmax = tmax > ticket_120.Count ? tmax : ticket_120.Count; tmax = tmax > ticket_180.Count ? tmax : ticket_180.Count; tmax = tmax > ticket_365.Count ? tmax : ticket_365.Count; hotNews = getNewsRandom(id); randowTicketF = GetRandowTicketF(14, fCityId, tCityId, 10); randowTicketT = GetRandowTicketT(14, fCityId, tCityId, 10); randowNews = getQuanByType(ticketOne["toCityname"].ToString()); } else { Response.Redirect("international.aspx"); } }
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); }
/// <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); }