private void btGetPNR_Click(object sender, EventArgs e) { airCode = ""; textBox4.Text = "请稍等……"; tbAirCode.Text = tbAirCode.Text.Trim().ToUpper(); tbFlightNumber.Text = tbFlightNumber.Text.Trim().ToUpper(); tbDate.Text = tbDate.Text.Trim().ToUpper(); if (!EagleAPI.IsRtCode(tbAirCode.Text)) { MessageBox.Show("大编码错误"); return; } ; if (tbFlightNumber.Text == "") { MessageBox.Show("请输入航班号"); return; } ; if (tbDate.Text.Length != 5) { MessageBox.Show("请输入正确日期"); return; } ; EagleAPI.CLEARCMDLIST(3); string cmd = "RRT:V/" + tbAirCode.Text + "/" + tbFlightNumber.Text + "/" + tbDate.Text; EagleAPI.EagleSendCmd(cmd + "~rrt ok~" + cmd, 3); }
/// <summary> /// 在姓名和航段之前少个换行符的情况:自动添加一个换行 /// </summary> /// <param name="rtResult"></param> /// <returns></returns> static public string NewLineBetweenNameAndFlight(string rtResult) { string ret = rtResult; string pnr = EagleAPI.etstatic.Pnr; if (!EagleAPI.IsRtCode(pnr)) { return(ret); } if (GlobalVar.b_rtCommand) { string limitStr = "15.SSR FOID +"; int limitInt = limitStr.Length + 1;//可能要多个"\r" try { string[] lines = rtResult.Split('\r'); for (int i = 0; i < lines.Length; i++) { string lineString = lines[i]; int bytelenth = System.Text.Encoding.Default.GetBytes(lineString).Length; if (bytelenth > limitInt) { int posLine = lineString.IndexOf(pnr.ToUpper()); if (posLine > -1) { posLine += 5; int pos = 0; for (int j = 0; j < i; j++) { pos += lines[j].Length + 1; } pos += posLine; while (ret[pos + 1] == ' ') { pos += 1; } bool addSpace = false; if (ret.IndexOf('.', pos) - pos == 1) { addSpace = true; } ; int posr = ret.IndexOf('\r', pos); int posn = ret.IndexOf('\n', pos); //if ((posr >= 0 && posr - pos <= 5) || (posn >= 0 && posn - pos <= 5)) break; ret = ret.Insert(pos, addSpace?" \r":"\r"); break; } } } } catch { } } return(ret); }
/// <summary> /// 带一个参数的构造函数 /// </summary> /// <param name="etcommand"></param> public NewDecFee2(string strcom) { foOriginallyBalance = float.Parse(GlobalVar.f_CurMoney); strETCommand = strcom; intAdultNum = intChildNum = intBabynNum = intPasNum = 0; foAdultFee = foBabyFee = foChildFee = 0; isChild = false; bContainChild = false; bContainBaby = false; GlobalVar.b_NotDoDec = false; nGetFcFlag = 1; try { if (!GlobalVar.bUsingConfigLonely) { int iRt = strETCommand.IndexOf("~rt"); if (iRt > -1) { try { iRt += 3; strPnr = strETCommand.Substring(iRt); strPnr = strPnr.Substring(0, strPnr.IndexOf("~")).Trim(); if (strPnr == "" || strPnr == null || !EagleAPI.IsRtCode(strPnr)) { throw new Exception("\r\n没有正确PNR\r\n>"); } } catch { throw new Exception("\r\n没有PNR\r\n>"); } } else { throw new Exception("\r\n出票指令有误\r\n>"); } } else { strPnr = EagleAPI.etstatic.Pnr; if (strPnr == "" || strPnr == null) { throw new Exception("\r\n独占配置出票出错!\r\n>"); } } } catch { DoEtdz(); } SendRT(); }
/// <summary> /// 带一个参数的构造函数 /// </summary> /// <param name="etcommand"></param> public NewDecFee(string strcom) { strOriginallyBalance = GlobalVar.f_CurMoney; strETCommand = strcom; strPasNum = string.Empty; strMuPaFee = string.Empty; isChild = false; nGetFcFlag = 1; if (!GlobalVar.bUsingConfigLonely) { int iRt = strETCommand.IndexOf("~rt"); if (iRt > -1) { try { iRt += 3; strPnr = strETCommand.Substring(iRt); strPnr = strPnr.Substring(0, strPnr.IndexOf("~")).Trim(); if (strPnr == "" || strPnr == null || !EagleAPI.IsRtCode(strPnr)) { throw new Exception("\r\n没有正确PNR\r\n>"); } } catch { throw new Exception("\r\n没有PNR\r\n>"); } } else { throw new Exception("\r\n出票指令有误\r\n>"); } } else { strPnr = EagleAPI.etstatic.Pnr; if (strPnr == "" || strPnr == null) { throw new Exception("\r\n独占配置出票出错!\r\n>"); } } SendRT(); }
private void button2_Click(object sender, EventArgs e) { if (textBox1.Text.Trim().Length != 5 || !EagleAPI.IsRtCode(textBox1.Text.Trim())) { //this.textBox1.Text += "错误PNR!"; MessageBox.Show (textBox1.Text + ":错误PNR!PNR只能为五个字节,PNR中不可能有字母0,I,U", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } //EagleAPI.EagleSendOneCmd("i~rt:n/" + this.textBox1.Text); try { Options.ibe.ibeInterface ib = new Options.ibe.ibeInterface(); MessageBox.Show(ib.rt(textBox1.Text.Trim(), GlobalVar.serverAddr == GlobalVar.ServerAddr.HangYiWang)); } catch { EagleAPI.EagleSendOneCmd("i~rt:n/" + this.textBox1.Text); } }
private void button3_Click(object sender, EventArgs e) { if (MessageBox.Show("请在无法正常提交情况下使用紧急提交!是否继续?", "警告", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.No) { return; } if (!EagleAPI.IsRtCode(textBox1.Text.Trim())) { MessageBox.Show("PNR有错误!请仔细核对"); return; } try { EasySubmitPnr sp = new EasySubmitPnr(); if (sp.submit_easy_pnr(textBox1.Text, "紧急提交!", "紧急提交备注" + "(系统增加:有航线未取到票价信息)", "紧急提交姓名", "", "0", new string[] { "EG66", "Y" }, new string[] { DateTime.Now.ToShortDateString() + " " + DateTime.Now.Hour.ToString("D2") + DateTime.Now.Minute.ToString("D2") , "AAAZZZ" }, new string[] { "EG66", "Y" }, new string[] { DateTime.Now.ToShortDateString() + " " + DateTime.Now.Hour.ToString("D2") + DateTime.Now.Minute.ToString("D2") , "AAAZZZ" }, "0", "0", "0", "0", "0", "0", "0") ) { bSubmitSuccess = true; MessageBox.Show("恭喜,紧急提交成功", "CONGRATUATIONS", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("抱歉,紧急提交失败,请检查提交项是否完整", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error); } } catch { this.Text = "已处理完毕,若未提示成功,请再次提交"; } }
public void step9(string[] inarray, string telephone) { this.Text = "正在向服务器传送数据……"; Application.DoEvents(); if (txtName.Text.Trim() == "" || textBox3.Text.Trim() == "") { MessageBox.Show("请先提取PNR或者正确输入姓名身份证及所订航班信息", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (textBox1.Text.Trim().Length != 5 || !EagleAPI.IsRtCode(textBox1.Text.Trim())) { //if (EagleAPI.IsRtCode(textBox1.Text.Trim())) { MessageBox.Show("错误PNR!PNR只能为五个字节,PNR中不可能有字母0,I,U", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } if (GlobalVar2.gbUserModel == 0)//b2c用户无视余额限制 added by chenqj { GetRemainMoney rm = new GetRemainMoney(); rm.getcurmoney(); string cmoney = rm.getcurmoney(); if (cmoney != "A") { GlobalVar.f_CurMoney = cmoney; //GlobalVar.f_CurMoney = EagleAPI.substring(GlobalVar.f_CurMoney, 0, GlobalVar.f_CurMoney.Length - 2) + "00"; if (float.Parse(GlobalVar.f_CurMoney) <= -500F) { //MessageBox.Show("对不起,您的余额不足!"); MessageBox.Show("抱歉,您的余额不足!请及时冲款", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } float yujiYe = float.Parse(GlobalVar.f_CurMoney) - float.Parse(inarray[6]); if (yujiYe < 0) { MessageBox.Show("严重警告,本笔金额预计将超支,请及时冲款", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error); } else if (yujiYe < 500) { MessageBox.Show("警告:本笔金额扣款后预计余额将少于500,请及时冲款", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error); } else if (yujiYe < 1000) { MessageBox.Show("提示:本笔金额扣款后预计余额将少于1000,请及时冲款", "WARNING", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } else { //MessageBox.Show("获取余额失败!"); MessageBox.Show("抱歉,获取余额失败!请尝试重新提交", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } if (textBox9.Text.Trim() == "") { textBox9.Text = textBox5.Text; } EasySubmitPnr sp = new EasySubmitPnr(); //if (sp.submit_easy_pnr(this.textBox1.Text, "黑屏提交!", null,this.textBox2.Text)) try { if (sp.submit_easy_pnr(textBox1.Text, strTktl, textBox2.Text + (ChildCount > 0 ? "有" + ChildCount.ToString() + "名儿童旅客" : ""), txtName.Text, telephone, txtName.Text.Split(';').Length.ToString(), new string[] { textBox3.Text, textBox7.Text }, new string[] { textBox4.Text, textBox8.Text }, new string[] { textBox5.Text, textBox9.Text }, new string[] { textBox6.Text, textBox10.Text }, inarray[0], inarray[1], inarray[2], inarray[3], inarray[4], inarray[5], inarray[6]) ) { //this.textBox2.Text += "恭喜,提交成功!"; bSubmitSuccess = true; MessageBox.Show("恭喜,提交成功", "CONGRATUATIONS", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1, MessageBoxOptions.ServiceNotification); } else //this.textBox1.Text += "提交失败!"; { if (sp.submit_easy_pnr(textBox1.Text, strTktl, textBox2.Text + "(系统增加:有航线未取到票价信息)", txtName.Text, "", txtName.Text.Split(';').Length.ToString(), new string[] { textBox3.Text, textBox7.Text }, new string[] { textBox4.Text, textBox8.Text }, new string[] { textBox5.Text, textBox9.Text }, new string[] { textBox6.Text, textBox10.Text }, "0", "0", "0", "0", "0", "0", "0") ) { MessageBox.Show("恭喜,提交成功", "CONGRATUATIONS", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("抱歉,提交失败,请检查提交项是否完整", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } catch (Exception ex) { if (ex.Message == "BTOC") { this.Close(); } } this.Text = "提交PNR"; }