中国航信IBE机票代理人Shoppping查询指令

机票代理人Shoppping指令区别AV,AV指令只能查询4折以上的机票,而Shoppping可以查询所有折扣机票,所以现在把c#编写的Shoppping共享!


以post请求参数

String org;//出发地

String dst;目的地

String orgdate;出发日期

Strin DirectFlightOnly;//是否直达,传true时只能查直达的航班,传false时查询中转航班

using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Com.Travelsky.Ibe.Client;
using Com.Travelsky.Util;
using Com.Travelsky.Ibe.Exceptions;
using System.Web.Script.Serialization;
using System.Diagnostics;
using Com.Travelsky.Ibe.Client.Pnr;
using Com.Travelsky.Ebuild.Clientapi.FlightShoppping;
using System.Collections;
using System.Text;
using System.Globalization;
using Newtonsoft.Json;

public partial class AV1 : System.Web.UI.Page
{

    public string FFDprice = "";//所有定义价格返回字符串
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
                FlightShoppping fltshopping = new FlightShoppping();

                FareInterface service = new FareInterface();
                Input input = new Input();
                input.SetHeaderInType(getHeaderInType());


                Request request = new Request();
                FlightShopRequestType flightShopRequestType = new FlightShopRequestType();
                //设置OD

                ArrayList originDestinationInfo = new ArrayList();
                originDestinationInfo.Add(getOriginDestinationInfoType());
                flightShopRequestType.SetOriginDestinationInfo(originDestinationInfo);
                //设置AVJourney
                //ArrayList AVJ = new ArrayList();
                //AVJ.Add(getAvJourneys(input));
                //flightShopRequestType.SetAvJourneys(AVJ);
                //设置TravelPreferences
                flightShopRequestType.SetTravelPreferencesType(getTravelPreferencesType());
                //设置Option
                flightShopRequestType.SetOption(getOption());
                /*//设置AdditionalShopRQData
                flightShopRequestType.setAdditionalShopRQData(getAdditionalShopRQData());*/


                request.SetFlightShopRequestType(flightShopRequestType);
                input.SetRequest(request);
                service.SetInput(input);

                //long begin = System.currentTimeMillis();
                //Stopwatch stopwatch = new System.Diagnostics.Stopwatch();
                //stopwatch.Start(); //  开始监视代码

                Output outT = new Output();
                outT = fltshopping.DoFlightShopping(service);//查询国内Shopping
                //System.out.println(out);
                FFDprice = StringBuildera(outT);//给所有航空公司返回价格附值
                //CwJgInfo(FFDprice);
                //Response.Write(FFDprice);
                PrintResult(outT);

                //Response.Write(StringBuildera(outT));


                //stopwatch.Stop(); //  停止监视
                //long Milliseconds = stopwatch.ElapsedMilliseconds; //  获取总时间
                //Response.Write(Milliseconds.ToString());
        }
        catch (IBEException ex)
        {
            Response.Write("callbackfun({ result:\"" + ex.Message.ToString() + "\"})");
        }
    }
    public static HeaderInType getHeaderInType()
    {
        HeaderInType hi = new HeaderInType();
        hi.SetSysCode("CRS");//ICS或者CRS
        //hi.SetSysType("IBE");//接入系统类型。如BLUESKY/IBE/TRAVELWEB。
        hi.SetChannelID("1E");//CAET或者1E
        //hi.SetChannelType("B2C");//B2B或者B2C,渠道设置为 1E 下不能设置,非 1E 时根据具体情况设置
        Agency agency = new Agency();
        agency.SetOfficeId("<span style="font-family: Arial, Helvetica, sans-serif;">BJS999</span><span style="font-family: Arial, Helvetica, sans-serif;">");//如:代理人office号,BJS999 BJS472</span>
        agency.SetPid("11066");//如:20200
        agency.SetCity("PEK");//代理人所在地区
        //agency.setIataNum("");
        //agency.setCountry("");
        hi.SetAgency(agency);
        hi.SetLanguage("CN");//EN或者CN
        hi.SetCommandType("FS");//
        return hi;
    }
    public static OriginDestinationInfoType getOriginDestinationInfoType()//去程类
    {
        string ori = HttpContext.Current.Request["org"];//起始地
        string des = HttpContext.Current.Request["dst"];//目的地
        string SetDepartureDate = HttpContext.Current.Request["orgdate"];//去程日期
        DateBinding db = new DateBinding();
        OriginDestinationInfoType od = new OriginDestinationInfoType();
        od.SetOri(ori.Trim());//起始地
        od.SetDes(des.Trim());//目的地
        od.SetDepartureDate(SetDepartureDate.Trim());//起始出发日期,格式为DDMMMYY
        return od;
    }
    public static Option getOption()
    {
        Option op = new Option();
        //op.SetFcFeature("0");//组合限制取值为0/1,默认值为0
        op.SetIsAvNeeded("Y");//结果中是否需要AV信息。Y/N,缺省为Y
        op.SetIsPSnNeeded("Y");//结果中是否需要PS信息。Y/N,缺省为Y
        //op.SetIsPsAvBindsNeeded("Y");//结果中是否需要PsAvBinding信息。Y/N,缺省为Y
        //op.SetIsFaresNeeded("Y");//结果中是否需要fare信息。Y/N,缺省为Y
        //op.SetIsRefundReissueRuleNeeded("Y");
        //op.SetIsRefundReissueTextRuleNeeded("Y");//需要文本退改签信息
        op.SetFormat("NOR");//SIM:简化格式;NOR:正常格式,缺省为NOR
        //op.SetIsCompressedResultNeeded("Y");//需要压缩结果;N 不需要不压缩
        string DirectFlightOnly = HttpContext.Current.Request["DirectFlightOnly"];//是否直达
        if (DirectFlightOnly.Trim() == "true")
        {
            op.SetLowestOrAll("A");//L:每个航班返回最低价; A:返回所有可用舱位价格。缺省为L
        }
        else
        {
            op.SetLowestOrAll("L");//L:每个航班返回最低价; A:返回所有可用舱位价格。缺省为L
        }
        //op.SetLowestOrAll("A");//L:每个航班返回最低价; A:返回所有可用舱位价格。缺省为L
        //op.SetRuleTypeNeeded("ALL");//ALL:需要所有文本规则;NON:不需要文本规则;SIM:只需要文本规则前两项缺省为ALL
        op.SetFareSource("ALL");//PUB-查公布价, YPUB-只查Y舱公布价, ALL-包括公布价和净价。缺省为ALL
  • 3
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 3
    评论
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值