Ejemplo n.º 1
0
        /// <summary>
        /// 客户端提交.
        /// </summary>
        /// <returns></returns>
        public ASyncResult Commit(string PnrCode)
        {
            ASyncResult result = null;

            base.Connect();
            SendStream(string.Format(@"RT:{0}", PnrCode));
            string Result = ConvertResult(GetStream());

            ThreadSleep();
            SendStream("PAT:A");
            IOrderedEnumerable <PATResult> r1 = ParseSFC(ConvertResult(GetStream()));

            ThreadSleep();
            IEnumerator <PATResult> Enumerator = r1.GetEnumerator();

            while (Enumerator.MoveNext())
            {
                SendStream(string.Format(@"SFC:{0}", Enumerator.Current.Sequence));
                ThreadSleep();
                SendStream(@"@KI");
                result = ResultAdapter(ConvertResult(GetStream()));
                Dispose();
                return(Enumerator.Current);
            }
            Dispose();
            return(result);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 提交短信请求.
        /// </summary>
        /// <param name="PnrCode">PNR编号.</param>
        /// <param name="isCn">是否中文短信内容.</param>
        /// <returns></returns>
        public ASyncResult Commit(string PnrCode, bool isCn)
        {
            base.Connect();
            ASyncResult result = GetSyncResult(string.Format(@"SMS:I/{0}{1}", PnrCode, isCn ? "" : "/I"));

            return(result);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 客户端提交.
        /// </summary>
        /// <returns></returns>
        public override ASyncResult Commit()
        {
            ASyncResult Result = null;

            base.Connect();
            string PnrCode = string.Empty;

            SendStream(CreateSynCmd());
            byte[] Buffer = GetStream();
            if (Regex.IsMatch(ConvertResult(Buffer), @"封口", RegexOptions.IgnoreCase | RegexOptions.Multiline))
            {
                ThreadSleep();
                addAdult("胡李俊");
                addSSR_FOID(base.airSegList[0].getairNo.Substring(0, 2), "93747237293729462", "胡李俊");
                this.setTimelimit = airSegList[0].departureTime.AddSeconds(30 * 60 * -1);        //30分钟
                addContact(new BookContact("SHA", "12345678", "HULIJUN"));
                SendStream(createSynCmd());
                Buffer  = GetStream();
                PnrCode = (base.ResultAdapter(ConvertResult(Buffer)) as SSResult).getPnr;
                if (!string.IsNullOrEmpty(PnrCode))
                {
                    SendStream(string.Format(@"RT:{0}", PnrCode));
                    GetStream();
                }
                IsOneOff = true;
            }
            ThreadSleep();
            SendStream(@"PAT:A");
            IEnumerator <PATResult> PAT = new PATCommand().ParseSFC(ConvertResult(GetStream())).GetEnumerator();

            while (PAT.MoveNext())
            {
                //Dispose();
                Result = PAT.Current;
                break;
            }
            Dispose();
            if (IsOneOff && !string.IsNullOrEmpty(PnrCode))
            {
                new CPnrCommand().Commit(PnrCode);
            }
            return(Result);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 客户端提交.
        /// </summary>
        /// <returns></returns>
        public virtual ASyncResult Commit()
        {
            if (this.setTimelimit == null)
            {
                throw new SSTicketMissingException();
            }
            if (this.__bookContactList.Count <= 0)
            {
                throw new SSContactMissingException();
            }
            if (this.__adultList.Count <= 0 && this.__childList.Count <= 0 && this.__infantList.Count <= 0)
            {
                throw new SSNameMissingException();
            }
            if (this.setTimelimit >= this.__airSegList[0].departureTime)
            {
                throw new SSTktDateException();
            }
            ASyncResult result = GetSyncResult(createSynCmd());

            //if (this.IsSpecial)
            //    result = GetSyncResult((string.IsNullOrEmpty(this.setEnvelopType) ? "@" : this.setEnvelopType));
            return(result);
        }