private void btPrintLianXu_Click(object sender, EventArgs e) { if (tbFlightNo.Text.Trim() == "" || tbDate.Text.Trim() == "") { MessageBox.Show("请先输入航班及日期"); return; } bLianxu = true; string[] names = new string[cbName.Items.Count]; string[] cardids = new string[cbName.Items.Count]; string[] policynos = new string[cbName.Items.Count]; Options.PrintBaoXianLianXu pb = null; if (cbName.Items.Count < 1) { pb = new Options.PrintBaoXianLianXu(); } else { for (int i = 0; i < names.Length; i++) { names[i] = cbName.Items[i].ToString(); cardids[i] = EagleAPI.GetIDCardNo(retstring)[i]; long no = (long.Parse(tbNo.Text.Trim()) + (long)i); policynos[i] = no.ToString("D7"); } pb = new Options.PrintBaoXianLianXu(names, cardids, policynos); } if (pb.ShowDialog() != DialogResult.OK) { return; } if (pb.ls == null || pb.ls.Count < 1) { return; } ls = new List <string>(pb.ls); pb.Dispose(); PrintDialog pd = new PrintDialog(); EagleAPI.PrinterSetupCostom(ptDoc, 951, 399); pd.Document = ptDoc; //DialogResult dr = pd.ShowDialog(); //if (dr == DialogResult.OK) { ptDoc.Print(); } }
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 btPrintLianXu_Click(object sender, EventArgs e) { if (tb航班号.Text.Trim() == "" || tb乘机日.Text.Trim() == "") { MessageBox.Show("请先输入航班及日期"); return; } bLianxu = true; string[] names = new string[cb被保险人姓名.Items.Count]; string[] cardids = new string[cb被保险人姓名.Items.Count]; string[] policynos = new string[cb被保险人姓名.Items.Count]; Options.PrintBaoXianLianXu pb = null; if (cb被保险人姓名.Items.Count < 1) { pb = new Options.PrintBaoXianLianXu(); } else { for (int i = 0; i < names.Length; i++) { try { names[i] = cb被保险人姓名.Items[i].ToString(); cardids[i] = EagleAPI.GetIDCardNo(retstring)[i]; long no = (long.Parse(tb保单序号.Text.Trim()) + (long)i); policynos[i] = no.ToString("D" + insuranceNumberLength.ToString()); } catch (Exception ex) { MessageBox.Show(ex.Message + "\r\n\r\n提示:只有在能自动提取出身份证的情况下可正常连续打印"); return; } } pb = new Options.PrintBaoXianLianXu(names, cardids, policynos); } pb.insLength = insuranceNumberLength; if (pb.insLength == 0) { MessageBox.Show("未设置保单长度insuranceNumberLength"); return; } if (pb.ShowDialog() != DialogResult.OK) { return; } if (pb.ls == null || pb.ls.Count < 1) { return; } ls = new List <string>(pb.ls); pb.Dispose(); PrintDialog pd = new PrintDialog(); EagleAPI.PrinterSetupCostom(ptDoc, paperWidth, paperHeight); pd.Document = ptDoc; //DialogResult dr = pd.ShowDialog(); //if (dr == DialogResult.OK) { ptDoc.Print(); } }
private void bt_Print_Click(object sender, EventArgs e) { bLianxu = false; save_phone(); if (tbNo.Text.Trim().Length != 7) { MessageBox.Show("保单号长度错误,7位"); return; } try { long.Parse(tbNo.Text.Trim()); } catch { MessageBox.Show("保单号只能为数字"); return; } if (cbName.Text.Trim() == "") { MessageBox.Show("姓名不能为空"); return; } if (tbCardID.Text.Trim() == "") { MessageBox.Show("证件号码不能为空"); return; } try { DateTime.Parse(tbDate.Text.Trim()); } catch { MessageBox.Show("乘机日期格式错误,如2007-4-2"); return; } this.tbPolicyNo.Text = System.DateTime.Now.Year.ToString().Remove(1, 1) + EagleAPI.GetRandom62(); if (!GlobalVar.b_OffLine) { if (cbName.Text.Trim() != GlobalVar.HYXTESTPRINT) { HyxStructs hs = new HyxStructs(); hs.UserID = GlobalVar.loginName; hs.eNumber = tbPolicyNo.Text; hs.IssueNumber = tbNo.Text; hs.NameIssued = cbName.Text; hs.CardType = "航班号" + tbFlightNo.Text + "乘机日" + tbDate.Text;; hs.CardNumber = tbCardID.Text; hs.Remark = "B06"; //9"平安-周游列国"B06 hs.IssuePeriod = ""; hs.IssueBegin = tbDate.Text; // dtp_Start.Value.ToShortDateString() + " 00:00:00"; hs.IssueEnd = tbDate.Text; // dtp_End.Value.ToShortDateString() + " 00:00:00"; hs.SolutionDisputed = ""; hs.NameBeneficiary = tbBenefit.Text; hs.Signature = this.tbSignatureDate.Text; // this.tbSignatureDate.Text; hs.SignDate = this.dateTimePicker1.Value.ToShortDateString(); //dtp_Date.Value.ToShortDateString(); hs.InssuerName = ""; hs.Pnr = this.tbPnr.Text; if (!hs.SubmitInfo()) { //MessageBox.Show("数据提交失败!请检查保单号是否已被使用,或网络是否正常!"); return; } } } PrintDialog pd = new PrintDialog(); EagleAPI.PrinterSetupCostom(ptDoc, 951, 399); 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; }