Ejemplo n.º 1
0
        public RtResult(string rtstring, string pnr)
        {
            rtstring = egString.trim(rtstring);
            rtstring = egString.trim(rtstring, '>');
            pnr      = pnr.ToUpper();
            if (rtstring.IndexOf(xestring) >= 0)
            {
                return;
            }

            m_rtstring = egString.trim(rtstring);
            m_succeed  = (m_rtstring.IndexOf(pnr) >= 0);
            m_succeed  = (BaseFunc.PnrValidate(pnr) && m_succeed);
            if (!m_succeed)
            {
                return;
            }
            m_pnr = pnr;



            string[] line = m_rtstring.Split(Structs.SP_R_N, StringSplitOptions.RemoveEmptyEntries);
            m_et_flag = (egString.trim(line[0]) == etstring);

            string sname = m_rtstring.Replace(etstring, "");//sname为 etstring或起始位置到pnr之间有串,替换掉回车,换行,加号,减号

            sname = sname.Replace(marriedstring, "");
            string sflight = sname;//保存替换后的值

            sname = egString.trim(sname.Substring(0, sname.IndexOf(m_pnr)));
            sname = sname.Replace("\r", " ").Replace("\n", " "); //maybe there are char of newline
            sname = sname.Replace("+", " ").Replace("-", " ");   //there are +/- if multi pages

            namesfrom(sname);

            //string temp = Convert.ToString(m_psg_count + 1) + ".";
            //string sflight = m_rtstring.Replace(etstring,"");//egString.trim(m_rtstring.Substring(m_rtstring.IndexOf(temp) + temp.Length));


            string[] sp = Structs.SP_NUMBER((uint)(m_psg_count + 999), true, true);

            line = sflight.Split(sp, StringSplitOptions.RemoveEmptyEntries);

            segfromlines(line);

            ssrfoidfromlines(line);
            SSR_TKNE_fromlines(line);//added by king 2009.12.8
            ssradtkfromlines(line);

            tktstatusfromlines(line);

            pnrbigfromlines(line);

            m_auto_fare_flat = (m_rtstring.IndexOf("RMK AUTOMATIC FARE QUOTE") > 0);

            farefromlines(line);

            //tkt no
            if (m_tktnos == null || string.IsNullOrEmpty(m_tktnos[0]))//若ssr组没有取到电子客票号
            {
                tktnofromlines(line);
            }
            //fp
            fpfromlines(line);
            //ei
            eifromlines(line);
            m_office = m_rtstring.Substring(m_rtstring.Length - 6);
            //if (!BaseFunc.OfficeValidate(m_office)) m_office = "";//commentted by king
        }
Ejemplo n.º 2
0
        public EtdzResult(string resText)
        {
            resText = egString.trim(resText.Trim(), '>').Trim();
            m_txt   = resText;

            if (m_txt.IndexOf("CNY") == 0 ||
                m_txt.IndexOf("ELECTRONIC TICKET ISSUED") >= 0 ||
                m_txt.IndexOf("ET PROCESSING...  PLEASE WAIT!") >= 0)
            {
                m_succ = true;
            }
            if (m_succ)
            {
                if (m_txt.IndexOf("CNY") == 0)
                {
                    total = Convert.ToInt32(egString.Between2String(m_txt, "CNY", "."));
                    string   temp  = m_txt.Replace("\r", " ").Replace("\n", " ");
                    string[] a     = temp.Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries);
                    int      index = 1;
                    if (BaseFunc.PnrValidate(a[1]))
                    {
                        m_pnr = a[1];
                    }
                    else if (BaseFunc.PnrValidate(a[2]))
                    {
                        m_pnr = a[2];
                        index = 2;
                    }
                    try
                    {
                        for (int i = index + 1; i < a.Length; i++)
                        {
                            string t = "";
                            if (BaseFunc.TicketNumberValidate(a[i], ref t))
                            {
                                tktnos.Add(a[i]);
                            }
                        }
                    }
                    catch
                    {
                    }
                }
                else
                {
                    total = 0;
                }
            }
            else
            {
                total = -1;
                switch (m_txt)
                {
                case "STOCK":
                    throw new Exception("STOCK : 票池为空,请上票号");

                case "DEVICE":
                    throw new Exception("DEVICE : 打票机号错误");

                case "NO PNR":
                    throw new Exception("NO PNR : 未知错误,请重试");

                case "FORMAT":
                    throw new Exception("FORMAT : 格式错误");

                case "FUNCTION":
                    throw new Exception("FUNCTION : 未知指令");

                case "INCOMPLETE PNR/FN":
                    throw new Exception("INCOMPLETE PNR/FN : 请先输入票价组");

                case "MANUAL":
                    throw new Exception("MANUAL : 可能EI项或其它项过长");
                }
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// av H型
        /// </summary>
        public void AvResult1(string avres, int price, int distance)
        {
            try
            {
                m_price    = price;
                m_distance = distance;

                IsAvReturnString = true;
                string[] sp = new string[16];//分割符为"\ni"
                for (int i = 0; i < 8; ++i)
                {
                    int itemp = i + 1;
                    sp[i]     = "\n" + itemp.ToString();
                    sp[i + 8] = "\r\n" + itemp.ToString();
                }

                //Modify by wangfb 20060630
                //CZ  FARE    HGHPEK/PEKHGH   YI:CZ/TZ304
                //AIRPORT CHARGE FOR LATERAL FLIGHT
                string[] lastlines = avres.Split("\r\n".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
                if (lastlines[lastlines.Length - 1].IndexOf("FARE") >= 0 ||
                    lastlines[lastlines.Length - 1].IndexOf("AIRPORT") >= 0)
                {
                    avres = avres.Replace(lastlines[lastlines.Length - 1], "");
                }



                string[] avSeg = avres.Split(sp, StringSplitOptions.RemoveEmptyEntries);

                nSegs = avSeg.Length - 1;
                //"27JUL(THU) WUHHKG\n"
                string str_date = avSeg[0].Trim().Split(' ')[0];
                int    lPos     = str_date.IndexOf('(');
                if (lPos >= 0)
                {
                    str_date = str_date.Substring(0, lPos);           //27JUL or 27JUL08
                }
                m_date   = BaseFunc.str2datetime(str_date, true);
                m_fromto = avSeg[0].Trim().Split(' ')[1];                                                                      //------2

                si = new SegmentInfomation[nSegs];


                for (int i = 0; i < nSegs; ++i)
                {
                    si[i]         = new SegmentInfomation();
                    si[i].context = avSeg[i + 1];
                    string[] siSplit = si[i].context.Split(new string[1] {
                        "\n "
                    }, StringSplitOptions.RemoveEmptyEntries);
                    si[i].b_directly = (siSplit.Length == 1);
                    si[i].fi         = new FlightInformation[siSplit.Length];
                    for (int j = 0; j < siSplit.Length; j++)
                    {
                        int id = i + 1;
                        si[i].fi[j]           = new FlightInformation(siSplit[j], id, m_price);
                        si[i].fi[j].a_rebates = (EagleString.egString.LargeThan420(m_date) ? EagleFileIO.arrayOfRebate2 : EagleFileIO.arrayOfRebate);
                        if (si[i].b_directly)
                        {
                            m_flights.Add(si[i].fi[j].info_Flight);
                            m_bunks_lowest.Add(si[i].fi[j].info_Bunk_Lowest);
                        }
                        else
                        {
                            string citypair = si[i].fi[j].info_CityPair.Trim();
                            if (citypair.Length == 3)
                            {
                                si[i].fi[j].info_CityPair = si[i].fi[j - 1].info_CityPair.Substring(3) + citypair;
                            }
                        }
                    }
                }

                avstring = EagleString.egString.trim(avres);
            }
            catch (Exception ex)
            {
                IsAvReturnString = false;
                //MessageBox.Show("AvResult Constructor:" + ex.Message);
                //EagleFileIO.LogWrite("AvResult 构造:" + ex.Message);
            }
        }
Ejemplo n.º 4
0
            /// <summary>
            /// 1TAO CZ    OPEN  X OPEN          Y40        19DEC8/19DEC9 20K REFUNDED
            ///           RL:
            ///  WUH

            ///
            ///
            /// 1YIH HU    7110  Y 25DEC 1700 OK Y                        20K USED/FLOWN

            /// 1WUH 8L    9936  N 24DEC 1330 OK Y30                      20K OPEN FOR USE
            ///           RL:BHP2C   /P04EZ 1E
            /// O  KMG
            ///
            ///
            /// 1ZUH CZ    6438  L 22DEC 1340 OK Y60        22DEC8/22DEC9 20K STATUS = B
            ///           RL:V88KC   /BRMR3 CA
            ///  WUH
            /// </summary>
            /// <param name="m"></param>
            public void FromString(string m)
            {
                FROM    = m.Substring(1, 3);
                AIRLINE = m.Substring(5, 2);
                NUMBER  = m.Substring(11, 4).Trim();
                BUNK    = m.Substring(17)[0];
                try
                {
                    string dtstring = m.Substring(19, 5).Trim();
                    if (dtstring != "OPEN")
                    {
                        DATE = BaseFunc.str2datetime(m.Substring(19, 5), true);
                    }
                }
                catch
                {
                }
                try
                {
                    TIME = Convert.ToInt32(m.Substring(25, 4));
                }
                catch
                {
                }
                ACTIONCODE = m.Substring(30, 2);
                TKTCLASS   = m.Substring(33, 3).Trim();
                string t = m.Substring(37, 21).Trim();//string t = m.Substring(36, 21).Trim();//2009.12.08发现bug:m值变成“5       30JAN0/30JAN0”,前面多截取了一个数字 by king

                string[] a = t.Split('/');
                if (a.Length == 2)
                {
                    //发现一个票号提取后得字符串:1TNA SC    1187  E 19NOV 1110 OK E/TNA11N94 19NOV1/19NOV1 20K OPEN FOR USE
                    //导致上面的变量 t 取值不正确
                    //考虑到以下仅为行程单的【EagleString\DetrResult.cs/SetControlsByDetrResult/ToTextBoxArrayLikeReceipt】方法服务,故注释掉以防出错 by king
                    //DATE_YES = BaseFunc.str2datetime(a[0], false);
                    //DATE_NO = BaseFunc.str2datetime(a[1], true);
                }
                WEIGHT = m.Substring(58, 3);
                a      = m.Split(Structs.SP_R_N, StringSplitOptions.RemoveEmptyEntries);
                STATE  = a[0].Substring(62);
                try
                {
                    string   codes = egString.Between2String(m, "RL:", "\n");
                    string[] b     = codes.Split('/');

                    string code1 = b[0].Trim();
                    string code2 = b[1].Trim();

                    string CA = "";
                    if (code2.Length > 5)
                    {
                        CA = egString.substring(b[1], b[1].Length - 2, 2);
                    }
                    if (CA == "CA")
                    {
                        PNR    = code1;
                        PNRBIG = code2;
                    }
                    else if (CA == "1E")
                    {
                        PNR    = code2;
                        PNRBIG = code1;
                    }
                    else
                    {
                        PNR = PNRBIG = code1;
                    }
                }
                catch
                {
                    PNR = PNRBIG = "";
                }
                if (PNR.Length > 5)
                {
                    PNR = PNR.Substring(0, 5);
                }
                if (PNRBIG.Length > 5)
                {
                    PNRBIG = PNRBIG.Substring(0, 5);
                }
                TO = a[a.Length - 1].Substring(1).Trim();
            }
Ejemplo n.º 5
0
        /// <summary>
        /// av 型
        /// </summary>
        public void AvResult2(string avres, int price, int distance, bool avh)
        {
            try
            {
                m_price    = price;
                m_distance = distance;

                IsAvReturnString = true;
                string[] sp = new string[16];//分割符为"\ni"
                for (int i = 0; i < 8; ++i)
                {
                    int itemp = i + 1;
                    sp[i]     = "\n" + itemp.ToString();
                    sp[i + 8] = "\r\n" + itemp.ToString();
                }
                string[] avSeg = avres.Split(sp, StringSplitOptions.RemoveEmptyEntries);
                nSegs = avSeg.Length - 1;
                //"27JUL(THU) WUHHKG\n"
                string str_date = avSeg[0].Trim().Split(' ')[0];
                int    lPos     = str_date.IndexOf('(');
                if (lPos >= 0)
                {
                    str_date = str_date.Substring(0, lPos);           //27JUL or 27JUL08
                }
                m_date   = BaseFunc.str2datetime(str_date, true);
                m_fromto = avSeg[0].Trim().Split(' ')[1];                                                                      //------2

                si = new SegmentInfomation[nSegs];


                for (int i = 0; i < nSegs; ++i)
                {
                    si[i]         = new SegmentInfomation();
                    si[i].context = avSeg[i + 1];
                    string[] siSplit;
                    if (avh)
                    {
                        siSplit = si[i].context.Split(new string[] { "\n " }, StringSplitOptions.RemoveEmptyEntries);
                    }
                    else
                    {
                        siSplit = si[i].context.Split(new string[] { "\n" }, StringSplitOptions.RemoveEmptyEntries);
                    }
                    si[i].b_directly = (siSplit.Length == 1);
                    si[i].fi         = new FlightInformation[siSplit.Length];
                    for (int j = 0; j < siSplit.Length; j++)
                    {
                        int id = i + 1;
                        if (avh)
                        {
                            si[i].fi[j] = new FlightInformation(siSplit[j], id, m_price);//这里av与avh不一样
                        }
                        else
                        {
                            si[i].fi[j] = new FlightInformation(siSplit[j], id, m_price, false);//这里av与avh不一样
                        }
                        si[i].fi[j].a_rebates = (EagleString.egString.LargeThan420(m_date) ? EagleFileIO.arrayOfRebate2 : EagleFileIO.arrayOfRebate);
                        if (si[i].b_directly)
                        {
                            m_flights.Add(si[i].fi[j].info_Flight);
                            m_bunks_lowest.Add(si[i].fi[j].info_Bunk_Lowest);
                        }
                    }
                }

                avstring = EagleString.egString.trim(avres);
            }
            catch
            {
                IsAvReturnString = false;
            }
        }