コード例 #1
0
 public string getpnr()
 {
     try
     {
         EagleWebService.wsKernal ws = new EagleWebService.wsKernal(GlobalVar.WebServer);
         NewPara np = new NewPara();
         np.AddPara("cm", "GetUncheckedPNR");
         np.AddPara("UserID", GlobalVar.loginName);
         string strReq = np.GetXML();
         string strRet = ws.getEgSoap(strReq);
         if (strRet != "")
         {
             NewPara np1 = new NewPara(strRet);
             if (np1.FindTextByPath("//eg/cm") == "RetGetUncheckedPNR" && np1.FindTextByPath("//eg/Pnr") != "")
             {
                 return(np1.FindTextByPath("//eg/Pnr"));
             }
         }
         else
         {
             //System.Windows.Forms.MessageBox.Show("GetUncheckedPNR与服务器数据库连接失败!");
         }
     }
     catch
     {
     }
     return("");
 }
コード例 #2
0
 public bool submitinfo()
 {
     try
     {
         EagleWebService.wsKernal ws = new EagleWebService.wsKernal(GlobalVar.WebServer);
         NewPara np = new NewPara();
         np.AddPara("cm", "CheckReceiptNumber");
         np.AddPara("User", GlobalVar.loginName);
         np.AddPara("RecieptNumber", varreceiptnumber);
         string strReq = np.GetXML();
         string strRet = ws.getEgSoap(strReq);
         if (strRet != "")
         {
             NewPara np1 = new NewPara(strRet);
             if (np1.FindTextByPath("//eg/cm") == "RetCheckRecieptNumber" && np1.FindTextByPath("//eg/OperationFlag") == "TRUE")
             {
                 return(true);
             }
         }
         else
         {
             //System.Windows.Forms.MessageBox.Show("CheckReceiptNumber与服务器数据库连接失败!");
             MessageBox.Show("CheckReceiptNumber与服务器数据库连接失败!", "易格服务器错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
     catch
     {
     }
     return(false);
 }
コード例 #3
0
        public static void LogServerWrite(object args)
        {
            try
            {
                string[] obj = ((string)args).Split(new string[] { "<eg66>" }, StringSplitOptions.RemoveEmptyEntries);
                string   cmd = obj[0];
                string   rr  = obj[1];

                EagleWebService.wsKernal ws = new EagleWebService.wsKernal(GlobalVar.WebServer);
                NewPara np = new NewPara();
                np.AddPara("cm", "WriteLog");
                np.AddPara("User", GlobalVar.loginName);
                np.AddPara("Cmd", cmd);
                np.AddPara("ReturnResult", rr);
                string strReq = np.GetXML();
                while (true)
                {
                    string strRet = ws.getEgSoap(strReq);
                    if (strRet != "")
                    {
                        NewPara np1 = new NewPara(strRet);
                        if (np1.FindTextByPath("//eg/cm") == "RetWriteLog" && np1.FindTextByPath("//eg/OperationFlag") == "SaveSucc")
                        {
                            return;
                        }
                    }
                }
            }
            catch
            {
                //MessageBox.Show("FN项提交失败");
            }
        }
コード例 #4
0
        public string TerminalNumber = "0";//使用IP的ID

        public bool SubmitInfo()
        {
            try
            {
                EagleWebService.wsKernal ws = new EagleWebService.wsKernal(GlobalVar.WebServer);
                NewPara np = new NewPara();
                np.AddPara("cm", "SubmitETicket");
                //if (UserID != "") np.AddPara("UserID", GlobalVar.loginName);
                np.AddPara("etNumber", etNumber);
                np.AddPara("FlightNumber1", FlightNumber1);
                np.AddPara("Bunk1", Bunk1);
                np.AddPara("CityPair1", CityPair1);
                np.AddPara("Date1", Date1);

                np.AddPara("FlightNumber2", FlightNumber2);
                np.AddPara("Bunk2", Bunk2);
                np.AddPara("CityPair2", CityPair2);
                np.AddPara("Date2", Date2);

                np.AddPara("TotalFC", TotalFC);

                np.AddPara("State", State);
                np.AddPara("Pnr", Pnr);
                //np.AddPara("DecFeeState",  "2");//服务器应不予以处理,在客户端取消

                np.AddPara("Passenger", Passengers);

                np.AddPara("numBasePrc", TotalTaxBuild);
                np.AddPara("numFuel", TotalTaxFuel);
                //np.AddPara("IpId", TerminalNumber);
                np.AddPara("IpId", "");

                string strReq = np.GetXML();
                string strRet = ws.getEgSoap(strReq);
                if (strRet != "")
                {
                    NewPara np1 = new NewPara(strRet);
                    if (np1.FindTextByPath("//eg/cm") == "RetSubmitETicket" && np1.FindTextByPath("//eg/OperationFlag") == "SaveSucc")
                    {
                        return(true);
                    }
                }
                else
                {
                    //System.Windows.Forms.MessageBox.Show("SubmitETicket与服务器数据库连接失败!");
                    MessageBox.Show("SubmitETicket与服务器数据库连接失败!", "易格服务器错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            catch
            {
            }
            return(false);
        }
コード例 #5
0
        /// <summary>
        /// 调用扣款Web服务
        /// </summary>
        private string InvokeWS()
        {
            EagleWebService.wsKernal ws = new EagleWebService.wsKernal(GlobalVar.WebServer);
            NewPara np = new NewPara();

            np.AddPara("cm", "DecFee");
            np.AddPara("Pnr", strPnr);
            np.AddPara("TicketPrice", strMuPaFee);
            string strReq = np.GetXML();
            string strRet = ws.getEgSoap(strReq);

            return(strRet);
        }
コード例 #6
0
        /// <summary>
        /// 调用扣款Web服务
        /// </summary>
        private string InvokeWS()
        {
            EagleWebService.wsKernal ws = new EagleWebService.wsKernal(GlobalVar.WebServer);
            NewPara np = new NewPara();

            np.AddPara("cm", "DecFee");
            np.AddPara("Pnr", strPnr);
            np.AddPara("TicketPrice", foMuPaFee.ToString());
            string strReq = np.GetXML();
            string strRet = ws.getEgSoap(strReq);

            GlobalVar.f_Balance -= (decimal)(foMuPaFee);
            EagleAPI.LogWrite(strPnr + " DecFee 先扣款成功!\r\n");
            return(strRet);
        }
コード例 #7
0
        public static bool RefreshIbeUrl()
        {
            EagleWebService.wsKernal ws = new EagleWebService.wsKernal(Options.GlobalVar.B2bWebServiceURL);
            NewPara np = new NewPara();

            np.AddPara("cm", "GetIbeUrl");
            np.AddPara("UserName", Options.GlobalVar.B2bLoginName);
            np.AddPara("ibeID", Options.GlobalVar.IbeID.ToString());
            string strReq = np.GetXML();

            RemoteKernal.RemoteStatus statuTemp = RemoteKernal.status;//暂存
            RemoteKernal.status = RemoteKernal.RemoteStatus.DISCONNECT;
            string strRet;

            try
            {
                strRet = ws.getEgSoap(strReq);
            }
            catch (System.Exception ex)
            {
                System.Windows.Forms.MessageBox.Show("获取 IBE 地址发生错误!");
                EagleString.EagleFileIO.LogWrite("无法得到IBE地址,错误是:" + ex.Message);
                return(false);
            }

            RemoteKernal.status = statuTemp;//还原

            if (string.IsNullOrEmpty(strRet) || strRet.Contains("CmErr"))
            {
                //System.Windows.Forms.MessageBox.Show("未能从服务器获取到IBE地址!详细信息如下:\n\n" + strRet);
                EagleString.EagleFileIO.LogWrite("无法得到IBE地址,错误是:" + strRet);
                return(false);
            }
            else
            {
                np = new NewPara(strRet);

                //if (np.FindTextByPath("//eg/cm") == "RetGetIbeUrl")
                {
                    Options.GlobalVar.IbeUrl = np.FindTextByPath("//eg/ibeURL");
                    Options.GlobalVar.IbeID  = Int32.Parse(np.FindTextByPath("//eg/ibeID"));
                    EagleString.EagleFileIO.LogWrite("切换IBE地址至:" + Options.GlobalVar.IbeUrl);
                    return(true);
                }
            }
        }
コード例 #8
0
        public bool submitinfo()
        {
            try
            {
                if (float.Parse(TotalFC) < 10.0F)
                {
                    return(false);
                }
                EagleWebService.wsKernal ws = new EagleWebService.wsKernal(GlobalVar.WebServer);
                NewPara np = new NewPara();
                np.AddPara("cm", "DecFee");
                np.AddPara("Pnr", Pnr);
                np.AddPara("TicketPrice", TotalFC);
                string strReq = np.GetXML();
                string strRet = ws.getEgSoap(strReq);
                //DecFee_Class dc = new DecFee_Class(strRet);
                if (strRet == null || strRet == "")
                {
                    throw new Exception("调用 WebService 返回不正常!xml:" + strRet + Environment.NewLine);
                }

                NewPara np1     = new NewPara(strRet);
                string  cm      = np1.FindTextByPath("//eg/cm");
                string  decstat = np1.FindTextByPath("//eg/DecStat");
                string  money   = np1.FindTextByPath("//eg/NewUserYe");
                string  err     = np1.FindTextByPath("//eg/err");

                if (cm == "RetDecFee" && decstat == "DecSucc")
                {
                    GlobalVar.f_CurMoney = money;
                    string agrs = "调用扣款服务" + "<eg66>" + Pnr + TotalFC;
                    Thread th   = new Thread(new ParameterizedThreadStart(LogServerWrite));
                    th.Start(agrs);
                    return(true);
                }
                else
                {
                    throw new Exception("cm:" + cm + " err:" + err + Environment.NewLine);
                }
            }
            catch
            {
                throw;
            }
        }
コード例 #9
0
        static public List <string> lsValidate = new List <string>();//用于可能提取错误PNR而导致取消记录行,而重复扣款。
        public bool submitinfo()
        {
            try
            {
                lsValidate.Add(Pnr.ToUpper());
                int countGetThisPnr = 0;
                //for (int i = 0; i < lsValidate.Count; i++)
                //{
                //    if (lsValidate[i] == Pnr.ToUpper()) countGetThisPnr++;
                //}
                //if (countGetThisPnr < 5) return false;
                EagleWebService.wsKernal ws = new EagleWebService.wsKernal(GlobalVar.WebServer);
                NewPara np = new NewPara();
                np.AddPara("cm", "CancelPNR");
                np.AddPara("Pnr", Pnr);
                string strReq = np.GetXML();
                string strRet = ws.getEgSoap(strReq);
                if (strRet != "")
                {
                    NewPara np1 = new NewPara(strRet);
                    if (np1.FindTextByPath("//eg/cm") == "RetCancelPNR" && np1.FindTextByPath("//eg/OperationFlag") == "SaveSucc")
                    {
                        lsValidate.Clear();
                        string agrs = "调用取消记录服务" + "<eg66>" + Pnr;
                        Thread th   = new Thread(new ParameterizedThreadStart(etDecFee.LogServerWrite));
                        th.Start(agrs);
//                        Thread.Sleep(10000);
                        return(true);
                    }
                }
                else
                {
                    //System.Windows.Forms.MessageBox.Show("CancelPNR与服务器数据库连接失败!");
                    MessageBox.Show("CancelPNR与服务器数据库连接失败!", "易格服务器错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            catch (Exception ex)
            {
                string s = ex.Message;
            }
            return(false);
        }
コード例 #10
0
        /// <summary>
        /// 取eagle服務器上的對應票價"fareY~distance"
        /// </summary>
        /// <param name="fromto"></param>
        /// <returns></returns>
        static public string getFareServer(string fromto)
        {
            return(EagleString.EagleFileIO.PriceOf(fromto).ToString() + "~" + EagleString.EagleFileIO.DistanceOf(fromto));

            string ret = "";

            try
            {
                EagleWebService.wsKernal ws = new EagleWebService.wsKernal(GlobalVar.WebServer);
                NewPara np = new NewPara();
                np.AddPara("cm", "GetFC");
                np.AddPara("FROM", fromto.Substring(0, 3));
                np.AddPara("TO", fromto.Substring(3, 3));
                string strReq = np.GetXML();
                string strRet = ws.getEgSoap(strReq);
                if (strRet != "")
                {
                    NewPara np1 = new NewPara(strRet);
                    if (np1.FindTextByPath("//eg/cm") == "RetGetFC")
                    {
                        string tf = np1.FindTextByPath("//eg/BUNKF");
                        string tc = np1.FindTextByPath("//eg/BUNKC");
                        string ty = np1.FindTextByPath("//eg/BUNKY");
                        if (tf != "" && tc != "" && ty != "")
                        {
                            try
                            {
                                return(ty + "~" + tf);
                            }
                            catch
                            {
                            }
                        }
                    }
                }
            }
            catch
            {
            }
            return(ret);
        }
コード例 #11
0
        public bool submitinfo()
        {
            try
            {
                EagleWebService.wsKernal ws = new EagleWebService.wsKernal(GlobalVar.WebServer);
                NewPara np = new NewPara();
                np.AddPara("cm", "PreSubmitETicket");
                np.AddPara("UserID", GlobalVar.loginName);
                np.AddPara("Pnr", EagleAPI.etstatic.Pnr);
                np.AddPara("DecFeeState", "0");
                string ipid = mystring.substring(GlobalVar.officeNumberCurrent, 0, 6);


                if (ipid.Length != 6)
                {
                    if (!GlobalVar.loginLC.bSameAllConfig)
                    {
                        throw new Exception("—预提交—配置号错误?配置号为:" + ipid);
                    }
                    else
                    {
                        ipid = GlobalVar.loginLC.thesameipid;
                    }
                }
                np.AddPara("IpId", ipid);
                if (EagleAPI.etstatic.Pnr.Trim().Length != 5)
                {
                    throw new Exception("—预提交—PNR错误?PNR为:" + EagleAPI.etstatic.Pnr);
                }
                string strReq = np.GetXML();
                string strRet = ws.getEgSoap(strReq);


                if (strRet != "")
                {
                    NewPara np1 = new NewPara(strRet);
                    if (np1.FindTextByPath("//eg/cm") == "RetPreSubmitETicket" && np1.FindTextByPath("//eg/OperationFlag") == "SaveSucc")
                    {
                        EagleAPI.LogWrite(EagleAPI.etstatic.Pnr + " PreSubmitETicket 预提交成功!\r\n");
                        return(true);
                    }
                    else if (np1.FindTextByPath("//eg/cm") != "CmErr")
                    {
                        System.Windows.Forms.MessageBox.Show(strReq);
                    }
                    else
                    {
                        return(true);
                    }
                }
                else
                {
                    MessageBox.Show("PreSubmitETicket与服务器数据库连接失败!", "易格服务器错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            catch (Exception ex)
            {
                System.Windows.Forms.MessageBox.Show(ex.Source + ex.Message);
            }
            return(false);
        }
コード例 #12
0
        public static streamctrl_enum send(string content, int msgtype)
        {
            try
            {
                if (GlobalVar.loginName.ToLower() == "bb" && content.ToLower().Contains("etdz"))
                {
                    return(streamctrl_enum.TEST_ACCOUNT);
                }

                #region xepnr操作权限控制
                {
                    string t_xepnr = content.ToLower().Trim();
                    if (t_xepnr.IndexOf("xepnr") == 0 || t_xepnr.IndexOf("~xepnr") >= 0 || t_xepnr.IndexOf("xe") == 0 || t_xepnr.IndexOf("~xe") >= 0)
                    {//并且要在不为ETDZ的情况下,不然在ETDZ的时候,还没有判断就返回了XEPNR:即在ETDZ时不做以下判断
                        if (EagleAPI.substring(content, 0, 4).ToLower() == "etdz" || content.ToLower().IndexOf("~etdz") >= 0)
                        {
                            ;
                        }
                        else
                        {
                            string         t_pnr = EagleAPI.etstatic.Pnr;
                            pnr_statistics ps    = new pnr_statistics();
                            ps.pnr   = t_pnr;
                            ps.state = "2";
                            if (!Model.md.b_00C && t_xepnr.Contains("xepnr")) //不能取消他人PNR,则进行提交判断
                            {
                                if ((!ps.submit()))                           //取消失败,则返回失败
                                {
                                    if (t_xepnr.IndexOf("xepnr") == 0 || t_xepnr.IndexOf("~xepnr") >= 0)
                                    {
                                        return(streamctrl_enum.XEPNR_FAIL);
                                    }
                                    else
                                    {
                                        return(streamctrl_enum.XE_FAIL);
                                    }
                                }
                            }
                        }
                    }
                }
                #endregion
                if (EagleAPI.substring(content, 0, 4).ToLower() == "etdz" || content.ToLower().IndexOf("~etdz") >= 0)
                {
                    GlobalVar.b_etdz = true;
                }

                GlobalVar.b_pat = (EagleAPI.substring(content, 0, 4).ToLower() == "pat:");

                GlobalVar.b_cmd_trfd_AM = ((EagleAPI.substring(content, 0, 7).ToLower() == "trfd:am") || (EagleAPI.substring(content, 0, 7).ToLower() == "trfd am"));
                GlobalVar.b_cmd_trfd_M  = ((EagleAPI.substring(content, 0, 6).ToLower() == "trfd:m") || (EagleAPI.substring(content, 0, 6).ToLower() == "trfd m"));
                GlobalVar.b_cmd_trfd_L  = ((EagleAPI.substring(content, 0, 6).ToLower() == "trfd:l") || (EagleAPI.substring(content, 0, 6).ToLower() == "trfd l"));

                if (EagleAPI.substring(content, 0, 4).ToLower() == "trfx")
                {
                    content = content.Replace('*', (char)0x1A);
                    content = content.Replace("/", "");
                }

                if (content == "i" || content == "ig")
                {
                    GlobalVar.b_etdz        = false;
                    GlobalVar.b_enoughMoney = false;
                    GlobalVar.b_endbook     = false;
                }

                //if(EagleAPI.substring(content,0,1)=="@" || EagleAPI.substring(content,0,1)=="\\")//0926
                //bool bEnough = false;
                #region etdz金额不足控制
                if (GlobalVar.b_etdz)
                {
                    try
                    {
                        bool bIsDecFee = false;//是否扣过款了
                        if (GlobalVar.newEticket.peaplecount < 1)
                        {
                            GlobalVar.newEticket.peaplecount = 1;
                        }
                        string srvUrl = "";
                        if (GlobalVar.serverAddr == GlobalVar.ServerAddr.Eagle)
                        {
                            //if (GlobalVar2.gbConnectType == 1) srvUrl = "http://yinge.eg66.com/WS3/egws.asmx";
                            //if (GlobalVar2.gbConnectType == 2) srvUrl = "http://wangtong.eg66.com/WS3/egws.asmx";
                        }
                        //else
                        srvUrl = GlobalVar.WebServer;
                        EagleWebService.wsKernal ws = new EagleWebService.wsKernal(srvUrl);

                        NewPara np = new NewPara();
                        np.AddPara("cm", "IsDecFee");
                        np.AddPara("pnr", EagleAPI.etstatic.Pnr);
                        string strSent   = np.GetXML();
                        string strreturn = "";
                        if (GlobalVar.serverAddr == GlobalVar.ServerAddr.Eagle)
                        {
                            strreturn = ws.getEgSoap(strSent);
                        }
                        if (!string.IsNullOrEmpty(strreturn.Trim()))
                        {
                            np = new NewPara(strreturn);
                            string strCm       = np.FindTextByPath("//eg/cm");
                            string strIsDecFee = np.FindTextByPath("//eg/IsDecFee");
                            if (strCm == "ReIsDecFee" && strIsDecFee.Trim() == "1")
                            {
                                EagleAPI.LogWrite(EagleAPI.etstatic.Pnr + "已经扣过款,不再进行余额检查和扣款!\r\n");
                                bIsDecFee = true;
                            }
                        }

                        if (!bIsDecFee && (float.Parse(GlobalVar.f_CurMoney) < GlobalVar.f_limitMoneyPerTicket * GlobalVar.newEticket.peaplecount) && float.Parse(GlobalVar.f_CurMoney) < 0)//&& 1==0)float.Parse(GlobalVar.f_CurMoney) < GlobalVar.f_fc ||
                        {
                            //余额不足
                            EagleAPI.LogWrite("<计算是否够金额出票>当前余额为" + GlobalVar.f_CurMoney + ",预计扣款额为" + GlobalVar.f_limitMoneyPerTicket.ToString() + "*" + GlobalVar.newEticket.peaplecount.ToString());
                            GlobalVar.b_etdz        = false;
                            GlobalVar.b_enoughMoney = false;
                            GlobalVar.b_endbook     = false;
                            content = "i";
                            return(streamctrl_enum.NOT_ENOUGH_MONEY);
                        }
                        else
                        {
                            string[] cmdarray     = content.Split('~');
                            bool     bHasRtPnrCmd = false;
                            foreach (string c in cmdarray)
                            {
                                if (c.ToLower().Length >= 7 && c.ToLower().IndexOf("rt") == 0)
                                {
                                    bHasRtPnrCmd = true;
                                    break;
                                }
                            }
                            if ((!bHasRtPnrCmd) && (!GlobalVar.bUsingConfigLonely))
                            {
                                //return streamctrl_enum.HAS_NO_PNR;
                            }
                            GlobalVar.b_enoughMoney = true;
                            content = content + "";
                            //初步提交,状态0,预提交
                            ePlus.eTicket.etPreSubmit etmp = new ePlus.eTicket.etPreSubmit();
                            bool bsubed = false;
                            for (int iSubmit = 0; iSubmit < 3; iSubmit++)
                            {
                                if (etmp.submitinfo())
                                {
                                    if (GlobalVar.serverAddr == GlobalVar.ServerAddr.KunMing)
                                    {
                                        int price = EagleString.EagleFileIO.PriceOfPnrInFile(EagleAPI.etstatic.Pnr);
                                        GlobalVar.f_Balance -= price;
                                    }

                                    bsubed = true;
                                    break;
                                }
                            }

                            if (!bsubed)
                            {
                                GlobalVar.b_etdz = false;
                                return(streamctrl_enum.PRE_SUBMIT_FAIL);
                            }
                            //预提交成功,则同时提交PNR到PNR统计里
                            try
                            {
                                pnr_statistics ps = new pnr_statistics();
                                ps.pnr   = EagleAPI.etstatic.Pnr;
                                ps.state = "3";
                                Thread thSubmitPnr = new Thread(new ThreadStart(ps.submit1));
                                thSubmitPnr.Start();
                            }
                            catch { };
                        }
                    }
                    catch (Exception ex2)
                    {
                        throw new Exception("Ex2 :" + ex2.Message);
                    }
                }

                #endregion

                #region rtxxxxx取当前操作的PNR,注意msgtype=3
                {
                    if (msgtype == 3)
                    {
                        string[] arrayTemp = content.Split('~');
                        for (int i = 0; i < arrayTemp.Length; i++)
                        {
                            if (EagleAPI.substring(arrayTemp[i], 0, 2).ToLower() == "rt" && content.Length >= 7)
                            {
                                EagleAPI.CLEARCMDLIST(msgtype);
                                EagleAPI.etstatic.Pnr = mystring.right(arrayTemp[i].Trim(), 5);
                            }
                        }
                    }
                }
                #endregion


                content = content.Replace((char)0x0A, (char)0x0D);//发送中换行\r转换成\n



                log.strSend = content;//同Command.SendString
                connect_4_Command.SendString = content;
                GlobalVar.b_querryCommand    = false;
                GlobalVar.b_otherCommand     = false;


                return(streamctrl_enum.NONE);
            }
            catch (Exception ex)
            {
                throw new Exception("StreamControl : " + ex.Message);
            }
        }
コード例 #13
0
        private void bt_Print_Click(object sender, EventArgs e)
        {
            if (dtp保险起始时间.Value < DateTime.Today)
            {
                MessageBox.Show("保险起始日期不能早于今日!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            try
            {
                if (DateTime.Parse(tb乘机日.Text.Trim()) < DateTime.Today)
                {
                    MessageBox.Show("乘机日期不能早于当前日期!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }
            }
            catch
            {
                MessageBox.Show("乘机日期填写格式有误,请核对!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            if (bLastString == cb被保险人姓名.Text && cb被保险人姓名.Text != "")
            {
                if (MessageBox.Show(bLastString + "->已经打印,是否再打印一张?", "警告", MessageBoxButtons.YesNo) == DialogResult.No)
                {
                    return;
                }
            }
            //bt_Print.Enabled = false;
            Application.DoEvents();
            try
            {
                bLianxu = false;
                try
                {
                    save_cfg();
                }
                catch (Exception ee)
                {
                    MessageBox.Show(ee.Message + "save_cfg()");
                }
                if (insuranceNumberLength == 0)
                {
                    MessageBox.Show("未设置对应险种的保单序号长度insuranceNumberLength");
                    return;
                }
                if (tb保单序号.Text.Trim().Length != insuranceNumberLength)
                {
                    if (insuranceType == "B09" || insuranceType == "B0D")
                    {
                        ;
                    }
                    else
                    {
                        MessageBox.Show("保单序号长度错误," + insuranceNumberLength.ToString() + "位");
                        return;
                    }
                }
                try
                {
                    long.Parse(tb保单序号.Text.Trim());
                }
                catch
                {
                    if ((insuranceType == "B09") || (insuranceType == "B0D"))
                    {
                        ;
                    }
                    else
                    {
                        MessageBox.Show("保单序号只能为数字");

                        return;
                    }
                }
                if (cb被保险人姓名.Text.Trim() == "")
                {
                    MessageBox.Show("姓名不能为空");
                    return;
                }
                if (tb证件号.Text.Trim() == "")
                {
                    MessageBox.Show("证件号码不能为空");
                    return;
                }
                try
                {
                    DateTime dtTemp = DateTime.Parse(tb乘机日.Text.Trim());
                    if (dtTemp.Year != DateTime.Now.Year)
                    {
                        if (MessageBox.Show("乘机日期:" + tb乘机日.Text + "   请确认!", "注意", MessageBoxButtons.OKCancel) != DialogResult.OK)
                        {
                            return;
                        }
                    }
                }
                catch
                {
                    if (bhyx)
                    {
                        MessageBox.Show("乘机日期格式错误,如2007-4-2");
                        return;
                    }
                }
                tb保单号码.Text = eNumberHead + EagleAPI.GetRandom62();
                if (insuranceType == "B08")
                {
                    tb保单号码.Text = eNumberHead + DateTime.Now.Date.ToString("yyyyMMdd") + tb保单序号.Text;
                }
                if (paperHeight == 0 || paperWidth == 0)
                {
                    MessageBox.Show("未设置打印纸的宽与高paperHeight,paperWidth");
                    return;
                }
                if (!GlobalVar.b_OffLine)
                {
                    if (cb被保险人姓名.Text.Trim() != GlobalVar.HYXTESTPRINT)
                    {
                        HyxStructs hs = new HyxStructs();
                        hs.UserID           = GlobalVar.loginName;
                        hs.eNumber          = tb保单号码.Text;
                        hs.IssueNumber      = tb保单序号.Text;
                        hs.NameIssued       = cb被保险人姓名.Text;
                        hs.CardType         = "航班号" + tb航班号.Text + "乘机日" + tb乘机日.Text;;
                        hs.CardNumber       = tb证件号.Text;
                        hs.Remark           = insuranceType;                                    //保险种类别名代码B06
                        hs.IssuePeriod      = "";
                        hs.IssueBegin       = (bhyx ? tb乘机日.Text : dtp保险起始时间.Value.ToString()); //必须为时间串
                        hs.IssueEnd         = (bhyx ? tb乘机日.Text : dtp保险终止时间.Value.ToString()); //必须为时间串
                        hs.SolutionDisputed = "";
                        hs.NameBeneficiary  = tb受益人资料.Text + tb受益人关系.Text;
                        hs.Signature        = tb经办人.Text;  // tbSignatureDate.Text;
                        hs.SignDate         = tb填开日期.Text; //dtp_Date.Value.ToShortDateString();
                        hs.InssuerName      = "";
                        hs.Pnr = tbPnr.Text;

                        bSubmitting   = true;
                        bt_Print.Text = "提交中………………请稍等";
                        Application.DoEvents();
                        //while (this.insuranceType=="B07" && GlobalVar.serverAddr== GlobalVar.ServerAddr.HangYiWang)
                        //{
                        //    try
                        //    {
                        //        string ddd = "adksfj";
                        //        DateTime eee = DateTime.Parse(ddd);
                        //    }
                        //    catch (Exception ex)
                        //    {
                        //        MessageBox.Show(ex.Message);
                        //    }
                        //}
                        if (insuranceType == "B09" || insuranceType == "B0D")
                        {
                            EagleWebService.wsKernal ws = new EagleWebService.wsKernal(GlobalVar.WebServer);
                            NewPara np = new NewPara();
                            np.AddPara("cm", "SubmitEagleIns");
                            np.AddPara("UserAccount", "testaccount");
                            np.AddPara("UserPassword", "testpassword");
                            np.AddPara("CardIdNumber", "身份证号");
                            np.AddPara("FlightNumber", "航班号");
                            np.AddPara("FlightDate", "乘机日");
                            np.AddPara("BenefitRelation", "受益人关系");
                            np.AddPara("BenefitZiliao", "受益人资料");
                            np.AddPara("Telephone", "电话号码");
                            np.AddPara("Name", "被保险人名");
                            np.AddPara("PrintHead", "台头" + insuranceType);


                            string                    strReq = np.GetXML();
                            string                    strRet = ws.getEgSoap(strReq);
                            EP.WebService             epws   = new EP.WebService();
                            EP.WebServiceReturnEntity epret  = new EP.WebServiceReturnEntity();
                            if (insuranceType == "B09")
                            {
                                epret = epws.Purchase(GlobalVar2.bxUserAccount, GlobalVar2.bxPassWord,
                                                      lb公司名称.Text,
                                                      DateTime.Parse(tb乘机日.Text), tb航班号.Text, tb证件号.Text, cb被保险人姓名.Text, GlobalVar2.bxTelephone,
                                                      tb受益人关系.Text, tb受益人资料.Text);
                            }
                            else
                            {
                                epret = epws.PurchasePICC(GlobalVar2.bxUserAccount, GlobalVar2.bxPassWord,
                                                          lb公司名称.Text,
                                                          DateTime.Parse(tb乘机日.Text), tb航班号.Text, tb证件号.Text, cb被保险人姓名.Text, GlobalVar2.bxTelephone,
                                                          tb受益人关系.Text, tb受益人资料.Text);
                            }
                            bt_Print.Text = "打印(&P)";
                            if (!epret.Enabled)
                            {
                                MessageBox.Show(epret.ErrorMsg);
                                return;
                            }
                            else
                            {                                  //打印
                                tb保单号码.Text = epret.SerialNo;  //微机码
                                tb保单序号.Text = epret.CaseNo;    //单证号码
                                tb经办人.Text  = epret.AgentName; //加盟商明称
                            }
                        }
                        else
                        {
                            if (!hs.SubmitInfo())
                            {
                                bSubmitting   = false;
                                bt_Print.Text = "打印(&P)";
                                //MessageBox.Show("数据提交失败!请检查保单号是否已被使用,或网络是否正常!");
                                return;
                            }
                        }
                        bt_Print.Text = "打印(&P)";
                        bSubmitting   = false;
                    }
                }
                PrintDialog pd = new PrintDialog();
                EagleAPI.PrinterSetupCostom(ptDoc, paperWidth, paperHeight);
                pd.Document = ptDoc;
                //DialogResult dr = pd.ShowDialog();

                //if (dr == DialogResult.OK)
                {
                    ptDoc.Print();
                }
            }
            catch (Exception ee)
            {
                MessageBox.Show(ee.Message);
            }
            bLastString      = cb被保险人姓名.Text;
            bt_Print.Enabled = true;
        }