Exemple #1
0
        /// <summary>
        /// 取票价组,注意可能有2行。FN/A/FCNY160.00/SCNY160.00/C3.00/XCNY130.00/TCNY50.00CN/TCNY80.00YQ/        -
        ///        ACNY290.00
        /// </summary>
        /// <param name="line"></param>
        private void farefromlines(string[] line)
        {
            List <string> ls = getsomeline(line, "FN/");

            if (ls.Count == 0)
            {
                return;
            }
            try
            {
                int fare  = (int)Convert.ToDouble(egString.Between2String(ls[0], "FCNY", "/"));
                int build = 0;
                try
                {
                    build = (int)Convert.ToDouble(egString.Between2String(ls[0], "TCNY", "CN"));
                }
                catch
                {
                }
                int fuel = 0;
                try
                {
                    fuel = (int)Convert.ToDouble(egString.Between2StringReverse(ls[0], "YQ", "TCNY"));
                }
                catch
                {
                }
                m_price = new PRICE_CALCULATE(fare, build, fuel);
            }
            catch (Exception ex)
            {
                EagleFileIO.LogWrite("FN项可能被隐藏:" + ex.Message);
            }
        }
Exemple #2
0
        /// <summary>
        /// 从 SSR 组取票号
        ///  如:SSR TKNE MU HK1 KMGLNJ 5963 Y08DEC 7813853644500/1/P1
        ///      SSR TKNE 航空公司代码 行动代码 城市对 航班号 舱位日期 票号/航段序号/旅客序号
        /// </summary>
        /// <param name="line"></param>
        public void SSR_TKNE_fromlines(string[] line)
        {
            try
            {
                List <string> ls = getsomeline(line, "SSR TKNE");
                if (m_names.Length > ls.Count)
                {
                    throw new Exception("乘客数量和 SSR TKNE 行数不匹配,取票号失败");
                }
                m_tktnos = new string[m_names.Length];
                for (int i = 0; i < ls.Count; ++i)
                {
                    string l   = ls[i];
                    int    pos = l.LastIndexOf("/P");                              // /P的位置

                    int index = Convert.ToInt32(l.Substring(pos + 2)) - 1;         //由旅客序号来确定数组的索引序号
                    m_tktnos[index] = egString.Between2StringReverse(l, "/", " "); //在最后一个空格和斜杠之间
                }
            }
            catch (Exception ex)
            {
                //throw new Exception("RtResult.SSR_TKNE_fromlines:" + ex.Message);
                EagleFileIO.LogWrite("RtResult.SSR_TKNE_fromlines : " + ex.Message);
            }
        }
Exemple #3
0
 public void ToTextBoxArrayLikeReceipt(TextBox[] tb)
 {
     try
     {
         if (tb.Length != 14)
         {
             return;
         }
         tb[0].Text  = EagleFileIO.CityCnName(Citypair.Substring(0, 3));
         tb[1].Text  = Citypair.Substring(0, 3);
         tb[2].Text  = Flight.Substring(0, 2);
         tb[3].Text  = Flight.Substring(2);
         tb[4].Text  = Bunk.ToString();
         tb[5].Text  = Date.ToString("ddMMMyy", egString.dtFormat).ToUpper();
         tb[6].Text  = Time.ToString("d4");
         tb[7].Text  = Actioncode;
         tb[8].Text  = "Y" + EagleFileIO.RebateOf(Bunk, Flight).ToString();
         tb[9].Text  = ""; // DATE_YES.ToString("ddMMMyy", egString.dtFormat).ToUpper();
         tb[10].Text = ""; // DATE_NO.ToString("ddMMMyy", egString.dtFormat).ToUpper();
         tb[11].Text = WeightByBunk(Bunk).ToString() + "K";
         tb[12].Text = EagleFileIO.CityCnName(Citypair.Substring(3));
         tb[13].Text = Citypair.Substring(3);
     }
     catch
     {
         throw new Exception("将变量赋给控件时发生错误:FLIGHT_SEGMENT.ToTextBoxArrayLikeReceipt");
     }
 }
Exemple #4
0
        static public string EIstring(string al, char bunk, bool b2009420)
        {
            string air    = egString.left(egString.trim(al, "* "), 2);
            int    rebate = EagleFileIO.RebateOf(bunk, air);
            string EI     = "";

            int[] sp = new int[] { 100, 85, 40 };
            if (b2009420)//420修改
            {
                sp     = new int[] { 100, 88, 52 };
                rebate = EagleFileIO.RebateOfNew(bunk, air);
            }
            if (rebate >= sp[0])
            {
                EI = "";
            }
            else if (rebate >= sp[1])
            {
                EI = "不得签转";
            }
            else if (rebate >= sp[2])
            {
                EI = "不得签转更改";
            }
            else
            {
                EI = "不得签转更改退票";
            }
            return(EI);
        }
Exemple #5
0
        /// <summary>
        /// 用记事本打开文件
        /// </summary>
        /// <param name="filename">文件名</param>
        static public void LogRead(string filename)
        {
            string prog = Environment.SystemDirectory + "\\notepad.exe";

            if (!System.IO.File.Exists(prog))
            {
                throw new Exception("未找到记事本程序!");
            }
            EagleFileIO.RunProgram(prog, filename);
        }
Exemple #6
0
 /// <summary>
 /// 取FP项 :(FP/CASH,CNY)
 /// </summary>
 /// <param name="line"></param>
 private void fpfromlines(string[] line)
 {
     try
     {
         List <string> ls = getsomeline(line, "FP/");
         m_fp = egString.AfterString(ls[0], "FP/");
     }
     catch (Exception ex)
     {
         EagleFileIO.LogWrite("RtResult.fpfromlines : " + ex.Message);
     }
 }
Exemple #7
0
 private void babycountfromlines(string[] line)
 {
     try
     {
         List <string> ls = getsomeline(line, "XN/IN/");
         m_baby_count = ls.Count;
     }
     catch (Exception ex)
     {
         EagleFileIO.LogWrite("RtResult.babycountfromlines : " + ex.Message);
     }
 }
Exemple #8
0
 /// <summary>
 /// 搜索指定Name的控件,无则返回NULL,忽略大小写
 /// </summary>
 public static Control SearchSubCtrl(Control.ControlCollection parent, string name)
 {
     Control[] ctrl = parent.Find(name, true);
     if (ctrl.Length > 0)
     {
         return(ctrl[0]);
     }
     else
     {
         EagleFileIO.LogWrite("BaseFunc.SearchSubCtrl : 未找到控件" + name);
         return(null);
     }
 }
Exemple #9
0
 /// <summary>
 /// 重命名文件(移动文件,目标文件已存在,将被删除)
 /// </summary>
 /// <param name="pathFrom">源文件</param>
 /// <param name="pathTo">目标文件</param>
 public static void Rename(string pathFrom, string pathTo)
 {
     try
     {
         if (File.Exists(pathTo))
         {
             File.Delete(pathTo);
         }
         File.Move(pathFrom, pathTo);
     }
     catch (Exception ex)
     {
         EagleFileIO.LogWrite("EagleFileIO.Rename : " + ex.Message);
     }
 }
Exemple #10
0
        public string ToChineseString()
        {
            string ret = "";
            string n   = "\r\n";

            ret += "  航班号:" + Flight + n;
            ret += "    舱位:" + Bunk.ToString() + n;
            ret += "  乘机日:" + Date.ToShortDateString() + n;
            ret += "起飞城市:" + EagleFileIO.CityCnName(Citypair.Substring(0, 3)) + n;
            ret += "到达城市:" + EagleFileIO.CityCnName(Citypair.Substring(3)) + n;
            ret += "    人数:" + Number.ToString() + n;
            ret += "起飞时间:" + Time.ToString("d4") + n;
            ret += "到达时间:" + Time2.ToString("d4") + n;

            return(ret);
        }
Exemple #11
0
        public FlightInformation(string str, int id, int price, bool avh)
        {
            try
            {
                str           = egString.trim(str, " +-");
                m_shareflight = (str[0] == '*');
                str           = egString.trim(str, " *");
                //0         1         2         3         4
                //01234567890123456789012345678901234567890123456789
                //CZ3631  WUHTAO 0800   0920   738 0^C  E   DS# F3 A3 P2 YA TA KA HA MA GA SQ*
                string[] a = str.Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries);
                m_airline     = a[0].Substring(0, 2);
                m_int_flighno = int.Parse(a[0].Substring(2));
                m_citypair    = a[1];
                m_time_begin  = a[2];
                m_time_end    = a[3].Trim();
                if (m_time_end.IndexOf("+") > 0)
                {
                    try
                    {
                        int tempi = int.Parse(m_time_end.Substring(0, 4)) + int.Parse(m_time_end.Split('+')[1]) * 2400;
                        m_time_end = tempi.ToString("d4");
                    }
                    catch
                    {
                    }
                }
                m_plane_type = a[3];
                int.TryParse(egString.substring(str, 33, 1), out m_transits);
                m_eticket = (egString.substring(str, 38, 1) == "E");
                string[] bk = str.Substring(46).Split(new string[1] {
                    " "
                }, StringSplitOptions.RemoveEmptyEntries);
                for (int i = 0; i < bk.Length; ++i)
                {
                    m_bunk.Add(bk[i]);
                }
                m_bunkseq = EagleFileIO.ReadBunkSeq(m_airline).ToUpper();

                m_bunk_lowest = get_lowest_bunk_has_seat();
                SortByRebate(m_bunkseq.ToCharArray());
            }
            catch
            {
                throw new Exception("AV FlightInfomation构造失败!请联系易格!");
            }
        }
Exemple #12
0
 public AvResult(string avres, int price, int distance)
 {
     avres = egString.trim(avres);
     avres = egString.trim(avres, '>');
     if (avres.IndexOf("*\n") > 0)
     {
         AvResult2(avres, price, distance, false);
     }
     else
     {
         AvResult1(avres, price, distance);
     }
     //if (!SUCCEED) AvResult2(avres, price, distance, false);
     if (m_price == 0)
     {
         m_price    = EagleFileIO.PriceOf(m_fromto);
         m_distance = EagleFileIO.DistanceOf(m_fromto);
     }
 }
Exemple #13
0
        /// <summary>
        /// 取得对应ipid所在的服务器
        /// </summary>
        public void IpidServerPort(string ipid, ref string serverip, ref int port)
        {
            List <string> ls = new List <string>();

            for (int i = 0; i < m_ls_office.Count; i++)
            {
                ls.Add(m_ls_office[i].IP_ID.ToString() + "  " + m_ls_office[i].SERVER_IP + ":" + m_ls_office[i].SERVER_PORT.ToString());
            }
            EagleFileIO.LogWrite(string.Join("\r\n", ls.ToArray()));
            int index = indexof(ipid);

            if (index < 0)
            {
                return;
            }
            serverip = m_ls_office[index].SERVER_IP;
            port     = m_ls_office[index].SERVER_PORT;
            return;
        }
Exemple #14
0
 public void ToTextBoxArrayLikeReceipt(System.Windows.Forms.TextBox[] tb)
 {
     try
     {
         if (tb.Length != 14)
         {
             return;
         }
         tb[0].Text = EagleFileIO.CityCnName(FROM);
         tb[1].Text = FROM;
         tb[2].Text = AIRLINE;
         tb[3].Text = NUMBER;
         tb[4].Text = BUNK.ToString();
         tb[5].Text = DATE.ToString("ddMMMyy", egString.dtFormat).ToUpper();
         tb[6].Text = TIME.ToString("d4");
         tb[7].Text = ACTIONCODE;
         tb[8].Text = TKTCLASS;
         if (DATE_YES < new DateTime(2009, 1, 1))
         {
             tb[9].Text = "";
         }
         else
         {
             tb[9].Text = DATE_YES.ToString("ddMMMyy", egString.dtFormat).ToUpper();
         }
         if (DATE_NO < new DateTime(2009, 1, 1))
         {
             tb[10].Text = "";
         }
         else
         {
             tb[10].Text = DATE_NO.ToString("ddMMMyy", egString.dtFormat).ToUpper();
         }
         tb[11].Text = WEIGHT;
         tb[12].Text = EagleFileIO.CityCnName(TO);
         tb[13].Text = TO;
     }
     catch
     {
         throw new Exception("将变量赋给控件时发生错误:ToTextBoxArrayLikeReceipt");
     }
 }
Exemple #15
0
 /// <summary>
 /// 取身份证组到m_cards  (SSR FOID MU HK1 NI422202197307010111/P6)
 /// </summary>
 /// <param name="line"></param>
 private void ssrfoidfromlines(string[] line)
 {
     try
     {
         List <string> ls = getsomeline(line, "SSR FOID");
         if (m_names.Length > ls.Count)
         {
             throw new Exception("乘客数量和 SSR FOID 行数不匹配,取身份证号失败");
         }
         m_cards = new string[m_names.Length];
         for (int i = 0; i < ls.Count; ++i)
         {
             string l     = ls[i];
             int    pos   = l.LastIndexOf("/P"); // /P的位置
             int    index = 0;
             if (pos < 0)                        //没有/P的情况,只有一个乘客
             {
                 pos = l.LastIndexOf("NI");      //NI的位置
                 if (pos > 0)
                 {
                     m_cards[0] = l.Substring(pos + 2);
                 }
                 else//没有找到NI,可能证件号被隐藏
                 {
                     //m_cards = null;
                     return;
                 }
                 break;
             }
             else
             {
                 index          = Convert.ToInt32(l.Substring(pos + 2)) - 1;
                 m_cards[index] = egString.Between2StringReverse(l, "/P", "NI");
             }
         }
     }
     catch (Exception ex)
     {
         //throw new Exception("在RT结果中取证件号码组出错:" + ex.Message);
         EagleFileIO.LogWrite("RtResult.ssrfoidfromlines : " + ex.Message);
     }
 }
Exemple #16
0
        /// <summary>
        /// 校验OFFICE的正确性
        /// </summary>
        static public bool OfficeValidate(string office)
        {
            if (office.Length != 6)
            {
                return(false);
            }
            string s = office.ToUpper();
            string c = s.Substring(0, 3); //城市代码
            string d = s.Substring(3);    //数字

            if (EagleFileIO.CityCnName(c) == "")
            {
                return(false);
            }
            int i = 0;

            if (!int.TryParse(d, out i))
            {
                return(false);
            }
            return(true);
        }
Exemple #17
0
 /// <summary>
 /// 结束进程(根据进程启动时间,及pName开头的进程名,判断要杀死的唯一进程
 /// </summary>
 /// <param name="pName">进程名,如eagle</param>
 /// <param name="start">进程启动时间</param>
 static public void KillProcess(string pName, DateTime start)
 {
     foreach (System.Diagnostics.Process thisproc in System.Diagnostics.Process.GetProcesses())
     {
         if (thisproc.ProcessName.ToLower() == pName.ToLower())
         {
             try
             {
                 DateTime d  = thisproc.StartTime;
                 TimeSpan ts = start - d;
                 if (ts.TotalSeconds < 60)
                 {
                     thisproc.Kill();
                 }
             }
             catch (Exception ex)
             {
                 EagleFileIO.LogWrite("BaseFunc.KillProcess:" + ex.Message);
             }
         }
     }
 }
Exemple #18
0
 /// <summary>
 /// 取对应运营商的Web服务地址与后台管理地址
 /// </summary>
 /// <param name="sa">运营商</param>
 /// <param name="lp">线路(电信或网通)</param>
 /// <param name="pos">当运营商有多个地址指向同一台服务器时,取pos对应的地址</param>
 /// <param name="urlWebServer">返回的Web服务地址</param>
 /// <param name="urlWebSite">返回的后台地址</param>
 public void ServerAddressB2B(ServerAddr sa, LineProvider lp, int pos, ref string urlWebService, ref string urlWebSite)
 {
     try
     {
         urlWebService = "";
         urlWebSite    = "";
         //该运营商有多少个地址?
         int count = 0;
         for (int i = 0; i < m_ls.Count; ++i)
         {
             if (m_ls[i].SA == sa && m_ls[i].LP == lp)
             {
                 count++;
             }
         }
         //计算pos对应的index
         if (count == 0)
         {
             return;
         }
         int index = pos % count;
         //再按sa,lp,index找对应的地址
         for (int i = 0; i < m_ls.Count; ++i)
         {
             if (m_ls[i].SA == sa && m_ls[i].LP == lp && index == m_ls[i].INDEX)
             {
                 urlWebService = m_ls[i].WEBSERVICE;
                 urlWebSite    = m_ls[i].WEBSITE;
                 return;
             }
         }
     }
     catch (Exception ex)
     {
         EagleFileIO.LogWrite("ServerCenterB2B.ServerAddressB2B : " + ex.Message);
     }
 }
Exemple #19
0
        /// <summary>
        /// 可选显示共享航班
        /// </summary>
        /// <param name="lv"></param>
        /// <param name="b_display_no_seat">否显示无座舱位</param>
        /// <param name="pWays">显示方式:最低价,全部</param>
        /// <param name="b_share">是否显示共享航班</param>
        /// <param name="b_spec">是否显示特殊舱位</param>
        public void ToListView(ListView lv, bool b_display_no_seat, TO_LIST_WAYS pWays, bool b_share)
        {
            if (lv.InvokeRequired)
            {
                if (mi == null)
                {
                    mi = new MyInvoke(ToListView);
                    lv.Invoke(mi, new object[] { lv, b_display_no_seat, pWays, b_share });
                    //ToListView(lv, b_display_no_seat, pWays);
                    return;
                }
            }
            else
            {
                try
                {
                    if (lv == null)
                    {
                        throw new Exception("未创建LV_LOWEST吗");
                    }

                    for (int i = 0; i < si.Length; ++i)
                    {
                        if (!si[i].b_directly && pWays == TO_LIST_WAYS.LOWEST)
                        {
                            continue;                                                   //filter the not direct arrive flight, 全部显示时,是否有直飞由AV指令控制,不需要在这里控制
                        }
                        for (int j = 0; j < si[i].fi.Length; ++j)
                        {
                            if (si[i].fi[j].SharedFlight && (!b_share))
                            {
                                continue;                                         //jump over shared flight
                            }
                            if (m_shield_airline.IndexOf(si[i].fi[j].info_AirLine) >= 0)
                            {
                                continue;                                                         //jump over shield airline
                            }
                            ListViewItem lvi = new ListViewItem();
                            si[i].fi[j].Price = m_price;
                            si[i].fi[j].ToListViewItem(lvi, b_display_no_seat, pWays, m_base_id, m_display_seat_amount);
                            lv.Items.Add(lvi);
                        }
                    }
                    //{ "序号","航空公司","航班","起飞城市","抵达城市","起飞时间","抵达时间","机型"}
                    //switch (pWays)
                    //{//这是增加的第一行的
                    //    case TO_LIST_WAYS.ALL:
                    //        if (!string.IsNullOrEmpty(lv.Items[0].Text))
                    //        {
                    //            ListViewItem lvi = new ListViewItem();
                    //            lvi.Text = "";
                    //            lvi.SubItems.Add("");// lvi.SubItems.Add(m_airline + m_int_flighno.ToString());
                    //            lvi.SubItems.Add("");//lvi.SubItems.Add(m_policy_string);
                    //            lvi.SubItems.Add("");//lvi.SubItems.Add(m_citypair);
                    //            lvi.SubItems.Add("");//lvi.SubItems.Add(m_time_begin);
                    //            lvi.SubItems.Add("");//lvi.SubItems.Add(m_time_end);
                    //            lvi.SubItems.Add("");//lvi.SubItems.Add(m_plane_type);
                    //            lvi.SubItems.Add("");
                    //            int[] a_rebates = new int[] { 150, 130, 100, 95, 90, 85, 80, 75, 70, 65, 60, 55, 50, 45, 40, 35, 30 };
                    //            for (int i = 0; i < a_rebates.Length; ++i)
                    //            {
                    //                lvi.SubItems.Add(egString.TicketPrice(m_price, a_rebates[i]).ToString()+"元");
                    //            }
                    //            lv.Items.Insert(0, lvi);
                    //        }
                    //        break;
                    //}
                    for (int i = 0; i < lv.Items.Count; ++i)
                    {
                        ListViewItem lvi = lv.Items[i];
                        if (i % 2 == 1)
                        {
                            lvi.BackColor = Color.LightGray;
                        }
                    }
                }
                catch (Exception ex)
                {
                    EagleFileIO.LogWrite("AvResult.ToListView:" + ex.Message);
                }
                mi = null;
            }
        }
Exemple #20
0
        public FlightInformation(string str, int id, int price)
        {
            try
            {
                m_id      = id;
                m_price_y = price;
                context   = str;
                string[] fiRow = context.Split(new string[] { "\n>" }, StringSplitOptions.RemoveEmptyEntries);

                string temp      = fiRow[0];
                string temp_bunk = "";
                string flight    = egString.substring(temp, 2, 8).Trim();
                try
                {
                    m_shareflightname = egString.substring(fiRow[1], 2, 8).Trim();
                }
                catch
                {
                }
                m_shareflight = false;
                if (flight[0] == '*')
                {
                    flight        = flight.Substring(1);
                    m_shareflight = true;
                }
                m_airline       = flight.Substring(0, 2);
                m_int_flighno   = int.Parse(flight.Substring(2));
                m_policy_string = egString.substring(temp, 11, 3).Trim();
                temp_bunk      += egString.substring(temp, 15, 44 - 15).Trim();
                m_citypair      = egString.substring(temp, 46, 6).Trim();
                m_time_begin    = egString.substring(temp, 53, 6);
                m_time_end      = egString.substring(temp, 60, 6);
                if (m_time_end.IndexOf("+") > 0)
                {
                    try
                    {
                        int tempi = int.Parse(m_time_end.Substring(0, 4)) + int.Parse(m_time_end.Split('+')[1]) * 2400;
                        m_time_end = tempi.ToString("d4");
                    }
                    catch
                    {
                    }
                }
                m_plane_type = egString.substring(temp, 67, 3);
                int.TryParse(egString.substring(temp, 71, 1), out m_transits);
                m_meal    = (egString.substring(temp, 73, 1) == "M");
                m_eticket = (egString.substring(temp, 76, 1) == "E");
                if (fiRow.Length > 1)
                {
                    temp       = fiRow[1].Split(new string[] { "--" }, StringSplitOptions.RemoveEmptyEntries)[0];
                    temp_bunk += (" " + egString.substring(temp, 15, temp.Length - 15).Trim());
                }
                temp_bunk = egString.trim(temp_bunk);

                string[] bk = temp_bunk.Split(new string[1] {
                    " "
                }, StringSplitOptions.RemoveEmptyEntries);
                for (int i = 0; i < bk.Length; ++i)
                {
                    if (bk[i].Length != 2)
                    {
                        continue;
                    }
                    m_bunk.Add(bk[i]);
                }
                m_bunkseq = EagleFileIO.ReadBunkSeq(m_airline).ToUpper();


                m_bunk_lowest = get_lowest_bunk_has_seat();
                SortByRebate(m_bunkseq.ToCharArray());
            }
            catch
            {
                throw new Exception("AVH FlightInfomation构造失败!转入AV构造!");
            }
        }
Exemple #21
0
        /// <summary>
        /// 取票号组
        /// </summary>
        /// <param name="line"></param>
        private void tktnofromlines(string[] line)
        {
            try
            {
                List <string> ls = getsomeline(line, "TN/");

                if (m_et_flag || ls.Count > 0)//在TN/项中取
                {
                    m_tktnos = new string[m_names.Length];

                    if (egString.AfterString(ls[0], "/P") == "" && m_names.Length == 1)
                    {
                        m_tktnos[0] = egString.AfterString(ls[0], "TN/");
                        return;
                    }
                    for (int i = 0; i < ls.Count; ++i)
                    {
                        ls[i] = ls[i].Replace("+", "").Replace("-", "").Replace(">", "");
                        int    index = Convert.ToInt32(egString.AfterString(ls[i], "/P")) - 1;
                        string tktno = egString.Between2String(ls[i], "TN/", "/P");
                        m_tktnos[index] = tktno;
                    }
                }
                else//在OSI项中取
                {
                    ls = getsomeline(line, "OSI 1E");
                    if (ls.Count == 0)
                    {
                        return;
                    }
                    m_tktnos = new string[m_names.Length];

                    for (int i = 0; i < ls.Count; ++i)
                    {
                        string py = egString.AfterString(ls[i], m_seg.Length.ToString());

                        string ph = egString.Between2String(ls[i], "TN/", " ");
                        if (ph == "")
                        {
                            ph = egString.Between2String(ls[i], "TKNO/", " ");
                        }
                        ;                                                                 //added by king
                        if (ph == "" || py == "")
                        {
                            continue;                      //不是所找的OSI项
                        }
                        int j = 0;
                        for (j = 0; j < m_names.Length; ++j)
                        {
                            if (egString.GetSpell(m_names[j]).ToUpper() == py)
                            {
                                //if (m_tktnos[j] != "") continue;
                                if (!string.IsNullOrEmpty(m_tktnos[j]))
                                {
                                    continue;                                    //modified by king
                                }
                                else
                                {
                                    m_tktnos[j] = ph;
                                    break;
                                }
                            }
                        }
                        if (j == m_names.Length)
                        {
                            throw new Exception("有中文字不能被识别成拼音!");
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                EagleFileIO.LogWrite("RtResult.tktnofromlines : " + ex.Message);
            }
        }
Exemple #22
0
            /// <summary>
            /// 利用rtResult和patResult自动生成etdz串.注意:有多项sfc时,弹出选择框
            /// </summary>
            public string CreateEtdzString()
            {
                try
                {
                    List <string> ls = new List <string>();
                    ls.Add("i");
                    ls.Add("rt" + pnr);


                    if (!string.IsNullOrEmpty(pat))//先加入票价组
                    {
                        if (patres.PATTYPE == PatResult.PAT_TYPE.PAT_A || patres.PATTYPE == PatResult.PAT_TYPE.PAT_IN)
                        {
                            if (patres.HAS_PAT_A)
                            {
                                string sfc = "";
                                if (patres.LS_SFC.Count > 1)//弹出选择框(多个SFC)
                                {
                                    SfcForm dlg = new SfcForm(patres.STRING, patres.LS_SFC);
                                    if (dlg.ShowDialog() == DialogResult.OK)
                                    {
                                        sfc = dlg.SFCITEM;
                                    }
                                    else
                                    {
                                        throw new Exception("未选择SFC项");
                                    }
                                }
                                else
                                {
                                    sfc = "sfc:01";
                                }
                                ls.Add(pat);
                                ls.Add(sfc);
                            }
                            else
                            {
                                throw new Exception("PAT:A没有符合条件的运价");
                            }
                        }
                        else
                        {
                            if (!string.IsNullOrEmpty(patres.PAT_M))
                            {
                                ls.Add(pat);
                                ls.Add(patres.PAT_M.Replace("\r\n", "\n").Replace("\r", "\n"));
                            }
                            else
                            {
                                throw new Exception("PAT时发生了未知错误");
                            }
                        }
                    }
                    for (int i = 0; i < rtres.SEGMENG.Length; ++i)
                    {
                        ls.Add(Convert.ToString(i + 1 + rtres.PSGCOUNT) + "RR");                //航段项
                    }
                    ls.Add("XE" + Convert.ToString(rtres.PSGCOUNT + rtres.SEGMENG.Length + 3)); //时限项
                    string EI = "";
                    if (rtres.SEGMENG.Length == 0)
                    {
                        throw new Exception("缺失有效航段组");
                    }
                    int rebate = EagleFileIO.RebateOf(rtres.SEGMENG[0].Bunk, rtres.SEGMENG[0].Flight);
                    if (rebate >= 100)
                    {
                        EI = "";
                    }
                    else if (rebate >= 85)
                    {
                        EI = "EI:不得签转";
                    }
                    else if (rebate >= 40)
                    {
                        EI = "EI:不得签转更改";
                    }
                    else
                    {
                        EI = "EI:不得签转更改退票";
                    }
                    ls.Add(EI);

                    int printerno = EagleFileIO.EtdzPrinterNumber(li.b2b.lr.IpidUsingIsSameOffice());
                    if (printerno == 0)
                    {
                        throw new Exception("您可能使用多种不同配置,或系统未录入当前配置的打票机号!不能出票!");
                    }
                    else
                    {
                        ls.Add("etdz:" + printerno.ToString());
                    }
                    return(string.Join("~", ls.ToArray()));
                }
                catch (Exception ex)
                {
                    throw new Exception("Structs.ETDZONEKEY.CreateEtdzString : " + ex.Message);
                }
            }
Exemple #23
0
        public PatResult(string m)
        {
            m = egString.trim(m.Trim(), '>');
            try
            {
                m_succeed = true;
                m_string  = m;
                string[] line = m_string.Split(Structs.SP_R_N, StringSplitOptions.RemoveEmptyEntries);
                string   t    = egString.trim(line[0]);

                if (t == "PAT:A")
                {
                    m_pat       = PAT_TYPE.PAT_A;
                    m_pat_a_has = (m_string.IndexOf("没有符合条件的运价") < 0);
                    if (!m_pat_a_has)
                    {
                        return;
                    }

                    string s  = "FARE:";
                    string s2 = "TAX:";
                    m_fare = (int)Convert.ToDouble(egString.Between2String(m_string, s, s2).Replace("CNY", "").Trim());

                    s          = s2;
                    s2         = "YQ:";
                    m_taxbuild = (int)Convert.ToDouble(egString.Between2String(m_string, s, s2).Replace("CNY", "").Trim());

                    s  = s2;
                    s2 = "TOTAL:";
                    try
                    {
                        m_taxfuel = (int)Convert.ToDouble(egString.Between2String(m_string, s, s2).Replace("CNY", "").Trim());
                    }
                    catch
                    {
                        m_taxfuel = 0;
                    }
                    set_sfc(m);
                }
                else if (t == "PAT:A*IN")
                {
                    m_pat       = PAT_TYPE.PAT_IN;
                    m_pat_a_has = (m_string.IndexOf("没有符合条件的运价") < 0);
                    if (!m_pat_a_has)
                    {
                        return;
                    }
                    string s  = "FARE:";
                    string s2 = "TAX:";
                    m_fare     = (int)Convert.ToDouble(egString.Between2String(m_string, s, s2).Replace("CNY", "").Trim());
                    m_taxbuild = 0;
                    m_taxfuel  = 0;

                    set_sfc(m);
                }
                else if (t == "PAT:M")
                {
                    m_pat = PAT_TYPE.PAT;
                    string s  = "FCNY";
                    string s2 = "/";
                    m_fare = (int)Convert.ToDouble(egString.Between2String(m_string, s, s2).Replace("CNY", "").Trim());

                    s          = "TCNY";
                    s2         = "CN";
                    m_taxbuild = (int)Convert.ToDouble(egString.Between2String(m_string, s, s2).Replace("CNY", "").Trim());

                    s  = "YQ";
                    s2 = "TCNY";
                    try
                    {
                        m_taxfuel = (int)Convert.ToDouble(egString.Between2StringReverse(m_string, s, s2).Replace("CNY", "").Trim());
                    }
                    catch
                    {
                        m_taxfuel = 0;
                    }
                    set_pat_m(m);
                }
                else if (t == "PAT:M*CH")
                {
                    m_pat = PAT_TYPE.PAT_CH;
                    string s  = "FCNY";
                    string s2 = "/";
                    m_fare = (int)Convert.ToDouble(egString.Between2String(m_string, s, s2).Replace("CNY", "").Trim());

                    m_taxbuild = 0;

                    s  = "YQ";
                    s2 = "TCNY";
                    try
                    {
                        m_taxfuel = (int)Convert.ToDouble(egString.Between2StringReverse(m_string, s, s2).Replace("CNY", "").Trim());
                    }
                    catch
                    {
                        m_taxfuel = 0;
                    }
                    set_pat_m(m);
                }

                else
                {
                    m_succeed = false;
                }
            }
            catch (Exception ex)
            {
                EagleFileIO.LogWrite("PatResult Constructor Failed:" + ex.Message);
                m_succeed = false;
            }
        }