private void sbtnFill_Click(object sender, System.EventArgs e) { Ping ping = new Ping(); PingReply pr = ping.Send("10.10.10.203"); if (pr.Status != IPStatus.Success) { MessageBox.Show("童鞋,充值失败!vpn掉线了或者网速太慢!,请检查vpn连接!"); this.ClearText(); txtCardID.ReadOnly = true; this.txtFillFee.ReadOnly = true; this.sbtnFill.Enabled = false; this.sbtnRead.Enabled = true; this.chkIsBank.Checked = false; return; } string strCardID = txtCardID.Text.Trim(); if (strCardID == "") { MessageBox.Show("会员卡号不可为空且小于10位,请重新填写会员卡号!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error); txtCardID.Focus(); return; } if (txtFillFee.Text.Trim() == "") { MessageBox.Show("充值金额不可为空,请重新输入!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error); return; } double dFee = Double.Parse(txtFillFee.Text.Trim()); if (dFee <= 0) { MessageBox.Show("充值金额应大于0,请重新输入!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error); return; } else { System.Windows.Forms.DialogResult diaRes = MessageBox.Show("是否确定充值" + dFee.ToString() + "元?", "请确认", System.Windows.Forms.MessageBoxButtons.YesNo, System.Windows.Forms.MessageBoxIcon.Question); if (diaRes.Equals(System.Windows.Forms.DialogResult.Yes)) { err = null; double dFeeLast = double.Parse(txtCharge.Text.Trim()); int iIgLast = int.Parse(this.txtIg.Text.Trim()); CMSMStruct.FillFeeStruct ffs = new CMSMData.CMSMStruct.FillFeeStruct(); ffs.strAssID = txtAssID.Text.Trim(); ffs.strCardID = strCardID; ffs.dFillFee = dFee; string strAssType = this.txtAssType.Text.Trim(); string promrate = "0"; promrate = this.GetPromrate(ffs.dFillFee).ToString(); int cc = (int)decimal.Parse(txtFillFee.Text.Trim()); int dd = ((int)decimal.Parse(txtFillFee.Text.Trim()) * (int.Parse(promrate)) / 100); ffs.dFillProm = ((int)decimal.Parse(txtFillFee.Text.Trim()) * (int.Parse(promrate)) / 100); ffs.dFeeLast = dFeeLast; ffs.dFeeCur = System.Math.Round((dFee + dFeeLast), 2) + System.Math.Round((ffs.dFillProm), 0); double bb = System.Math.Round((ffs.dFillProm), 0); double aa = ffs.dFeeCur; ffs.strDeptID = SysInitial.CurOps.strDeptID; DateTime dtNow = DateTime.Now; ffs.strFillDate = dtNow.ToShortDateString() + " " + dtNow.ToLongTimeString(); ffs.iSerial = Int64.Parse(dtNow.ToString("yyyyMMddHHmmss")); //ffs.iSerial = Int64.Parse(ffs.strFillDate.Substring(0, 4) + ffs.strFillDate.Substring(5, 2) + ffs.strFillDate.Substring(8, 2) + ffs.strFillDate.Substring(11, 2) + ffs.strFillDate.Substring(14, 2) + ffs.strFillDate.Substring(17, 2)); if (chkIsBank.Checked) { ffs.strComments = "银行卡"; } else { ffs.strComments = ""; } double dChargeBak = System.Math.Round((Double.Parse(txtCharge.Text.Trim()) + Double.Parse(txtFillFee.Text.Trim()) + Double.Parse(txtPromFee.Text.Trim())), 2); if (ffs.dFeeCur != dChargeBak) { MessageBox.Show("充值失败,请重试!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error); clog.WriteLine("充值备份值与计算值不等:备份值-" + dChargeBak.ToString() + " 计算值" + ffs.dFeeCur.ToString()); return; } string strresult = cs.FillFee(ffs, int.Parse(this.txtIg.Text.Trim()), dChargeBak, this.txtZeroFlag.Text.Trim(), out err); if (strresult.Equals(CardCommon.CardDef.ConstMsg.RFOK) || strresult.Substring(0, 3) == "CMT") { System.Windows.Forms.DialogResult diaRes1 = MessageBox.Show("充值成功!是否打印?", "请确认", System.Windows.Forms.MessageBoxButtons.YesNo, System.Windows.Forms.MessageBoxIcon.Question); if (diaRes1.Equals(System.Windows.Forms.DialogResult.Yes)) { this.FillFeePrint(ffs, cs, this.txtAssName.Text); this.OpenDrawer(); } //zhh 20100311 clog.WriteLine(strresult); } else { MessageBox.Show("充值失败,请重试!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error); lblerr.Text = "充值失败,本次充值无效,请检查余额是否正确!"; lblerr.Visible = true; clog.WriteLine(err); clog.WriteLine(strresult); } this.ClearText(); txtCardID.ReadOnly = true; this.txtFillFee.ReadOnly = true; this.sbtnFill.Enabled = false; this.sbtnRead.Enabled = true; this.chkIsBank.Checked = false; } } }