private int TicketNumbers() { int numbers = 0; string[] a = m_txt.Split('\n'); for (int i = 0; i < a.Length; ++i) { try { string tkt = ""; if (BaseFunc.TicketNumberValidate(a[i].Substring(0, 14), ref tkt)) { ++numbers; } } catch { } } return(numbers); }
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项或其它项过长"); } } }