private string GetCount(int index, string catchDefault) { string result = "有"; try { string seatCode = DatasList.SeatType[DatasList.SeatTypeNames[index]].ToString(); if (index == 9) { for (int i = 0; i < tmpSeat.Length; i++) { if (tmpSeat[i].Substring(6, 1) == "3") { result = tmpSeat[i]; break; } } } else { //if (Convert.ToInt16(tmpSeat[i].Substring(6, 1)) > 3) //{ // tmpSeat[i] = String.Format("{0}3{1}{2}", tmpSeat[i].Substring(0, 6), (Convert.ToInt16(tmpSeat[i].Substring(6, 1)) - 3), tmpSeat[i].Substring(7)); //} for (int i = 0; i < tmpSeat.Length; i++) { if (seatCode.IndexOf(tmpSeat[i].Substring(0, 1)) > -1 && tmpSeat[i].Substring(6, 1) != "3") { result = tmpSeat[i]; break; } else if (index == 2 && tmpSeat[i].Substring(0, 1) == "7") { SpecialSeatType.Add("一等软座", "7"); result = tmpSeat[i]; break; } else if (index == 3 && tmpSeat[i].Substring(0, 1) == "8") { SpecialSeatType.Add("二等软座", "8"); result = tmpSeat[i]; break; } } } } catch (Exception ee) { new LogInfo().WriteLine(String.Format("Entry:QueryLeftNewDTO_GetCount()\r\nException Catch:{0}\r\nSource:{1}\r\nException:{2}", ee.Message, ee.Source, ee.InnerException)); } try { //if (result.Substring(6, 1) != "0" && result.Substring(6, 1) != "3") // return result.Substring(6); //else return(result.Substring(7)); } catch { return(catchDefault); } }
//余票信息处理,显示具体余票 private string GetCount(string str) { string seatCode = DatasList.SeatType[str].ToString(); string result = "有"; if (str == "无座") { for (int i = 0; i < tmpSeat.Length; i++) { if (Convert.ToInt16(tmpSeat[i].Substring(6, 1)) > 3) { tmpSeat[i] = tmpSeat[i].Substring(0, 6) + "3" + (Convert.ToInt16(tmpSeat[i].Substring(6, 1)) - 3).ToString() + tmpSeat[i].Substring(7); } if (tmpSeat[i].Substring(6, 1) == "3") { result = tmpSeat[i]; break; } } } else { for (int i = 0; i < tmpSeat.Length; i++) { if (seatCode.IndexOf(tmpSeat[i].Substring(0, 1)) > -1 && tmpSeat[i].Substring(6, 1) != "3") { result = tmpSeat[i]; break; } else if (str == "一等座" && tmpSeat[i].Substring(0, 1) == "7") { SpecialSeatType.Add("一等软座", "7"); result = tmpSeat[i]; break; } else if (str == "二等座" && tmpSeat[i].Substring(0, 1) == "8") { SpecialSeatType.Add("二等软座", "8"); result = tmpSeat[i]; break; } } } try { if (result.Substring(6, 1) != "0" && result.Substring(6, 1) != "3") { return(result.Substring(6)); } else { return(result.Substring(7)); } } catch { return(str); } }