public void CancelInsurance(string insType)//即保险指令,如B04 { //保单作废服务,userid,保单号,insType if (MessageBox.Show("确定作废保单" + tb保单序号.Text.Trim() + "吗?", "注意", MessageBoxButtons.OKCancel) != DialogResult.OK) { return; } if (insuranceType == "B09" || insuranceType == "B0D") { string caseno = tb保单序号.Text.Trim(); EP.WebService epws = new EP.WebService(); EP.WebServiceReturnEntity epret = new EP.WebServiceReturnEntity(); epret = epws.DiscardIt(GlobalVar2.bxUserAccount, GlobalVar2.bxPassWord, caseno); if (epret.Enabled) { MessageBox.Show(caseno + " 作废成功"); } else { MessageBox.Show(caseno + " 作废失败:" + epret.ErrorMsg); } } else { if (WebService.CancelInsurance(GlobalVar.loginName, insType, tb保单序号.Text)) { MessageBox.Show("作废成功"); } else { MessageBox.Show("作废失败"); } } }
private void bt_Print_Click(object sender, EventArgs e) { save_phone(); if (tbNo.Text.Trim().Length != 16) { MessageBox.Show("保单号长度错误"); return; } try { long.Parse(tbNo.Text.Trim()); int.Parse(tbTerm.Text.Trim()); if (int.Parse(tbTimeBeg.Text.Trim()) >= 24 || int.Parse(tbTimeBeg.Text.Trim()) < 0 || int.Parse(tbTimeEnd.Text.Trim()) >= 24 || int.Parse(tbTimeEnd.Text.Trim()) < 0) { MessageBox.Show("时间不正确"); return; } } catch { MessageBox.Show("保单号或保险期限或时间只能为数字"); return; } if (cbName.Text.Trim() == "") { MessageBox.Show("姓名不能为空"); return; } if (tbCardID.Text.Trim() == "") { MessageBox.Show("证件号码不能为空"); return; } this.tbPolicyNo.Text = this.eNumberHead + "0" + tbNo.Text.Trim().Substring(8, 8); if (!(bEagleDubang && b_dubang03)) { if (!GlobalVar.b_OffLine) { //if (!b_dubang03) { if (cbName.Text != GlobalVar.HYXTESTPRINT) { HyxStructs hs = new HyxStructs(); hs.UserID = GlobalVar.loginName; hs.eNumber = tbPolicyNo.Text; hs.IssueNumber = tbNo.Text; hs.NameIssued = cbName.Text; hs.CardType = ""; hs.CardNumber = tbCardID.Text; if (b_dubang03) { hs.Remark = "B05"; //出行乐 } else { hs.Remark = "B04"; //8"都帮出行无忧";B04 } hs.IssuePeriod = tbTerm.Text.Trim() + "天"; hs.IssueBegin = dtpBeg.Value.ToShortDateString() + " " + tbTimeBeg.Text.Trim() + ":00:00"; hs.IssueEnd = dtpEnd.Value.ToShortDateString() + " " + tbTimeEnd.Text.Trim() + ":00:00"; hs.SolutionDisputed = ""; hs.NameBeneficiary = this.tbBeneficiary.Text; hs.Signature = this.tbSignature.Text; hs.SignDate = dtpPrintTime.Value.ToShortDateString(); hs.Pnr = this.tbPnr.Text; if (!hs.SubmitInfo()) { MessageBox.Show("数据提交失败!请检查保单号是否已被使用,或网络是否正常!"); return; } } } } } else { string btText = bt_Print.Text; bt_Print.Text = "验证……"; Application.DoEvents(); { EP.WebService epws = new EP.WebService(); EP.WebServiceReturnEntity epret = new EP.WebServiceReturnEntity(); epret = epws.PurchaseDubang(GlobalVar2.bxUserAccount, GlobalVar2.bxPassWord, "都邦出行无忧(易格网)", //lb公司名称.Text, DateTime.Parse(dtpBeg.Value.ToShortDateString() + " " + tbTimeBeg.Text.Trim() + ":00:00"), //DateTime.Parse(tb乘机日.Text)//七天为起保日期 "7天", //tb航班号.Text, //七天没有航班号 tbCardID.Text, //tb证件号.Text, cbName.Text, //cb被保险人姓名.Text, "02785777575", //GlobalVar2.bxTelephone,//保单上无电话 this.tbBeneficiary.Text, //tb受益人关系.Text, "", //tb受益人资料.Text//保单上 tbNo.Text ); if (!epret.Enabled) { MessageBox.Show(epret.ErrorMsg); bt_Print.Text = btText; return; } else { //打印 tbPolicyNo.Text = "微机码: " + epret.SerialNo; //微机码 //tb保单序号.Text = epret.CaseNo;//单证号码 this.tbSignature.Text = epret.AgentName; //加盟商明称 } } bt_Print.Text = btText; } PrintDialog pd = new PrintDialog(); EagleAPI.PrinterSetupCostom(ptDoc, 951, 404); pd.Document = ptDoc; //DialogResult dr = pd.ShowDialog(); //if (dr == DialogResult.OK) { ptDoc.Print(); } }
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; }