Esempio n. 1
0
        public void Test_BusinessDispose()
        {
            JetermEntity.Request.TicketByBigPnr request = new JetermEntity.Request.TicketByBigPnr();

            // 解析第1种返回结果的请求参数:
            //// 例3:
            //request.BigPnr = "NK9Y8G";
            //request.FlightNo = "MU5633";
            //request.SCity = "URC";
            //request.ECity = "KHG";
            ////request.FlightNo = "CA1303";
            ////request.SCity = "PEK";
            ////request.ECity = "SZX";

            // 例4:
            //request.BigPnr = "PDNL7K";
            //request.FlightNo = "MF8108";
            //request.SCity = "PEK";
            //request.ECity = "FOC";

            // 例6:
            //PCZ0SX
            //request.BigPnr = "PCZ0SX";
            //request.FlightNo = "8L9801";
            //request.SCity = "KMG";
            ////request.SCity = "KMA";
            //request.ECity = "LJG";

            //// 解析第2种返回结果的请求参数:
            // 例1:
            //request.BigPnr = "PCZ0SX";
            //request.FlightNo = "HU7639";
            //request.SCity = "XIY";
            //request.ECity = "NKG";

            //request.BigPnr = "NK9Y8G";
            //request.FlightNo = "CA1254";
            //string flightCode = "URCPEK";
            //if (!string.IsNullOrEmpty(flightCode))
            //{
            //    if (flightCode.Length > 3)
            //    {
            //        request.SCity = flightCode.Substring(0, 3);
            //    }

            //    if (flightCode.Length > 5)
            //    {
            //        request.ECity = flightCode.Substring(3, 3);
            //    }
            //}

            // 测试是否能取到票号
            // 测试是否能成功换页
            // 返回结果:
            // {"PassengerList":[{"name":"许涛","idtype":0,"cardno":"330203197209250317","PassType":-1,"Ename":"","BabyBirthday":"\/Date(-62135596800000+0800)\/","ChildBirthday":"\/Date(-62135596800000+0800)\/","TicketNo":"9992363707999"},{"name":"朱汉民","idtype":0,"cardno":"330227196812169018","PassType":-1,"Ename":"","BabyBirthday":"\/Date(-62135596800000+0800)\/","ChildBirthday":"\/Date(-62135596800000+0800)\/","TicketNo":"9992363708000"},{"name":"吴开封","idtype":0,"cardno":"330222197312078235","PassType":-1,"Ename":"","BabyBirthday":"\/Date(-62135596800000+0800)\/","ChildBirthday":"\/Date(-62135596800000+0800)\/","TicketNo":"9992363707998"},{"name":"王勇","idtype":0,"cardno":"330203197201180318","PassType":-1,"Ename":"","BabyBirthday":"\/Date(-62135596800000+0800)\/","ChildBirthday":"\/Date(-62135596800000+0800)\/","TicketNo":"9992363707997"},{"name":"李军","idtype":0,"cardno":"330204197412261034","PassType":-1,"Ename":"","BabyBirthday":"\/Date(-62135596800000+0800)\/","ChildBirthday":"\/Date(-62135596800000+0800)\/","TicketNo":"9992363707996"},{"name":"曹敏君","idtype":0,"cardno":"330224197210074316","PassType":-1,"Ename":"","BabyBirthday":"\/Date(-62135596800000+0800)\/","ChildBirthday":"\/Date(-62135596800000+0800)\/","TicketNo":"9992363707995"}],"FlightList":[{"FlightNo":"CA1765","Airline":"CA","Cabin":"","SubCabin":"","SCity":"HGH","ECity":"LHW","DepTerminal":null,"ArrTerminal":null,"DepDate":"\/Date(1433433600000+0800)\/","ArrDate":"\/Date(-62135596800000+0800)\/","PNRState":null}],"Price":{"FacePrice":0.0,"Tax":0.0,"Fuel":0.0,"TotalPrice":0.0},"TicketStatus":1}
            //request.BigPnr = "NHG4VK";
            //request.FlightNo = "CA1765";
            //request.SCity = "HGH";
            //request.ECity = "LHW";

            // 测试第1种情况的返回结果为什么只解析到了只有1个人的信息

            /*
             * 黑屏返回结果:
             * ?DETR:CN/NTX3P7,C
             * ?DETR:TN/880-9289078641 ?             NAME: 刘建立
             * FOID:PF18810983674                      HU7225 /20JUN15/PEKWEF OPEN
             * ?DETR:TN/880-9289078642 ?             NAME: 刘文玲
             * FOID:PF18810983674                      HU7225 /20JUN15/PEKWEF OPEN
             */
            //  返回结果:
            // {"PassengerList":[{"name":"刘建立","idtype":-1,"cardno":"","PassType":-1,"Ename":"","BabyBirthday":"\/Date(-62135596800000+0800)\/","ChildBirthday":"\/Date(-62135596800000+0800)\/","TicketNo":"8809289078641"},{"name":"刘文玲","idtype":-1,"cardno":"","PassType":-1,"Ename":"","BabyBirthday":"\/Date(-62135596800000+0800)\/","ChildBirthday":"\/Date(-62135596800000+0800)\/","TicketNo":"8809289078642"}],"FlightList":[{"FlightNo":"HU7225","Airline":"HU","Cabin":"","SubCabin":"","SCity":"PEK","ECity":"WEF","DepTerminal":null,"ArrTerminal":null,"DepDate":"\/Date(1434729600000+0800)\/","ArrDate":"\/Date(-62135596800000+0800)\/","PNRState":null}],"Price":{"FacePrice":0.0,"Tax":0.0,"Fuel":0.0,"TotalPrice":0.0},"TicketStatus":1}
            //request.BigPnr = "NTX3P7";
            //request.FlightNo = "HU7225";
            //request.SCity = "PEK";
            //request.ECity = "WEF";

            /*
             * 黑屏返回结果:
             * ?DETR:CN/NDYJVW,C
             * ?DETR:TN/781-2191996969 ?             NAME: 肖苏城
             * FOID:NI450221197705161938               MU5757 /20MAY15/DLUKMG FLOW
             * FOID:NI450221197705161938               MU5767 /20MAY15/KMGNNG FLOW
             * ?DETR:TN/781-2191996968 ?             NAME: 肖苏城
             * FOID:NI450221197705161938               MU5768 /16MAY15/NNGKMG FLOW
             * FOID:NI450221197705161938                 VOID/VOID   /KMGDLU VOID
             * ?DETR:TN/781-2191996967 ?             NAME: 吴乐
             * FOID:NI452501197510263267               MU5757 /20MAY15/DLUKMG FLOW
             * FOID:NI452501197510263267               MU5767 /20MAY15/KMGNNG FLOW
             * ?DETR:TN/781-2191996966 ?             NAME: 吴乐
             * FOID:NI452501197510263267               MU5768 /16MAY15/NNGKMG FLOW        +
             *
             * FOID:NI452501197510263267                 VOID/VOID   /KMGDLU VOID        -
             */
            // 返回结果:
            // {"PassengerList":[{"name":"肖苏城","idtype":0,"cardno":"450221197705161938","PassType":-1,"Ename":"","BabyBirthday":"\/Date(-62135596800000+0800)\/","ChildBirthday":"\/Date(-62135596800000+0800)\/","TicketNo":"7812191996969"},{"name":"吴乐","idtype":0,"cardno":"452501197510263267","PassType":-1,"Ename":"","BabyBirthday":"\/Date(-62135596800000+0800)\/","ChildBirthday":"\/Date(-62135596800000+0800)\/","TicketNo":"7812191996967"}],"FlightList":[{"FlightNo":"MU5767","Airline":"MU","Cabin":"","SubCabin":"","SCity":"KMG","ECity":"NNG","DepTerminal":null,"ArrTerminal":null,"DepDate":"\/Date(1432051200000+0800)\/","ArrDate":"\/Date(-62135596800000+0800)\/","PNRState":null}],"Price":{"FacePrice":0.0,"Tax":0.0,"Fuel":0.0,"TotalPrice":0.0},"TicketStatus":5}
            request.BigPnr   = "NDYJVW";
            request.FlightNo = "MU5767";
            request.SCity    = "KMG";
            request.ECity    = "NNG";

            EtermProxy.BLL.TicketByBigPnr logic = new EtermProxy.BLL.TicketByBigPnr(IntPtr.Zero, IntPtr.Zero, "o72fe261", string.Empty);
            CommandResult <JetermEntity.Response.TicketByBigPnr> result = logic.BusinessDispose(request);

            if (result != null && result.state)
            {
                // 运行结果:
                // 第1种返回结果的解析结果:
                // 例3:
                // {"PassengerList":[{"name":"斯坎迪尔穆提拉","idtype":0,"cardno":"653121199401031919","PassType":-1,"Ename":"","BirthDayString":"","TicketNo":"7812180622791"}],"Price":{"FacePrice":0,"TotalPrice":0,"Tax":0,"Fuel":0}}
                // {"PassengerList":[{"name":"徐速","idtype":-1,"cardno":"","PassType":-1,"Ename":"","BirthDayString":"","TicketNo":"9991952037851"}],"Price":{"FacePrice":0,"TotalPrice":0,"Tax":0,"Fuel":0}}
                // 例4:
                // {"PassengerList":[{"name":"陈国辉","idtype":-1,"cardno":"","PassType":-1,"Ename":"","BirthDayString":"","TicketNo":"7312381150793"},{"name":"周井源","idtype":0,"cardno":"132622197911195210","PassType":-1,"Ename":"","BirthDayString":"","TicketNo":"7312381150794"}],"Price":{"FacePrice":0,"TotalPrice":0,"Tax":0,"Fuel":0}}
                // 第2种返回结果的解析结果:
                // 例1:
                // {"PassengerList":[{"name":"茅威涛","idtype":-1,"cardno":"","PassType":-1,"Ename":"","BirthDayString":"","TicketNo":"8802323065499"}],"Price":{"FacePrice":760.00,"TotalPrice":870.00,"Tax":50.00,"Fuel":60.00}}
                // {"PassengerList":[{"name":"茅威涛","idtype":-1,"cardno":"","PassType":-1,"Ename":"","BirthDayString":"","TicketNo":"8802323065499"}],"Price":{"FacePrice":0,"TotalPrice":0,"Tax":0,"Fuel":0}}
                string str = Newtonsoft.Json.JsonConvert.SerializeObject(result.result);
                Console.WriteLine("运行结果:" + Newtonsoft.Json.JsonConvert.SerializeObject(result.result));
                return;
            }
            if (result.error != null)
            {
                Console.WriteLine("运行错误,错误信息:" + result.error.ErrorMessage);
            }
        }
Esempio n. 2
0
        public override CommandResult <JetermEntity.Response.TicketByBigPnr> BusinessDispose(JetermEntity.Request.TicketByBigPnr request)
        {
            JetermEntity.Parser.TicketByBigPnr ticketByBigPnr = new JetermEntity.Parser.TicketByBigPnr(this.config, this.OfficeNo);

            this.Cmd = ticketByBigPnr.ParseCmd(request);
            if (string.IsNullOrEmpty(this.Cmd))
            {
                return(ticketByBigPnr.Response);
            }

            ExcuteCmd();

            return(ticketByBigPnr.ParseCmdResult(this.CmdResult));
        }