private void sbtnLose_Click(object sender, System.EventArgs e) { string strCardID = txtCardID.Text.Trim(); if (strCardID == "" || strCardID.Length != 5) { MessageBox.Show("会员卡号不可为空且为5位,请重新填写会员卡号!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error); txtCardID.Focus(); return; } System.Windows.Forms.DialogResult diaRes = MessageBox.Show("是否确定挂失该会员卡?", "请确认", System.Windows.Forms.MessageBoxButtons.YesNo, System.Windows.Forms.MessageBoxIcon.Question); if (diaRes.Equals(System.Windows.Forms.DialogResult.Yes)) { err = null; cs.CardLose(strCardID, out err); if (err != null) { MessageBox.Show("挂失失败,请重试!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error); clog.WriteLine(err); } else { MessageBox.Show("挂失成功!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information); this.ClearText(); txtCardID.ReadOnly = false; sbtnLose.Enabled = false; } } }
private void sbtnLose_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 = false; sbtnLose.Enabled = false; return; } string strCardID = txtCardID.Text.Trim(); if (txtCardID.Text.Trim() == "") { MessageBox.Show("会员卡号异常,请重新填写会员卡号!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error); txtCardID.Focus(); return; } System.Windows.Forms.DialogResult diaRes = MessageBox.Show("是否确定挂失该会员卡?", "请确认", System.Windows.Forms.MessageBoxButtons.YesNo, System.Windows.Forms.MessageBoxIcon.Question); if (diaRes.Equals(System.Windows.Forms.DialogResult.Yes)) { err = null; cs.CardLose(txtAssID.Text.Trim(), strCardID, out err); if (err != null) { MessageBox.Show("挂失失败,请重试!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error); clog.WriteLine(err); } else { MessageBox.Show("挂失成功!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information); this.ClearText(); txtCardID.ReadOnly = false; sbtnLose.Enabled = false; } } }