Example #1
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);
            }
        }
Example #2
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;
            }
        }