private void txtCardID_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e) { if (e.KeyChar != 13) { if (e.KeyChar == 8 || e.KeyChar == 42) { return; } if (e.KeyChar < 48 || e.KeyChar > 57) { e.Handled = true; return; } } else { err = null; 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; } CMSMData.CMSMStruct.MemberStruct mebres = new CMSMData.CMSMStruct.MemberStruct(); string strDeptNameTmp = CMSMData.CMSMDataAccess.SysInitial.LocalDeptNameTmp; mebres = cs.GetMemberDetail(strCardID, strDeptNameTmp, out err); if (mebres != null) { string strMebState = mebres.strState; if (strMebState != "0") { MessageBox.Show("该会员已经失效,请核查!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error); this.ClearText(); return; } txtCompName.Text = mebres.strCompanyName; txtLicenseTag.Text = mebres.strLicenseTag; txtCardID.ReadOnly = true; sbtnLose.Enabled = true; } else { MessageBox.Show("你输入的会员卡有误或者不是正常在用会员!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error); if (err != null) { clog.WriteLine(err); } return; } } }
private void sbtnAgain_Click(object sender, System.EventArgs e) { if (dataGrid1.CurrentRowIndex < 0) { MessageBox.Show("没有选中已挂失的会员!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information); return; } err = null; string strCardID = dataGrid1[dataGrid1.CurrentRowIndex, 0].ToString(); CMSMData.CMSMStruct.MemberStruct mebres = new CMSMData.CMSMStruct.MemberStruct(); mebres = cs.GetMemberLoseDetail(strCardID, out err); if (mebres == null || err != null) { MessageBox.Show("获取会员资料错误,请重试!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error); if (err != null) { clog.WriteLine(err); } return; } frmInputBox frmInput = new frmInputBox(); frmInput.Text = "补卡输入新卡号"; frmInput.label1.Text = "请输入新会员卡的卡号:"; frmInput.label2.Text = "Again"; frmInput.ShowDialog(); if (SysInitial.strTmp == "CanCel") { return; } while (SysInitial.strTmp == "") { MessageBox.Show("输入的会员卡号不正确,请重新输入!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error); frmInput = new frmInputBox(); frmInput.ShowDialog(); if (SysInitial.strTmp == "CanCel") { return; } } string strNewCardID = SysInitial.strTmp; SysInitial.strTmp = ""; err = null; string strresult = cs.CardAgain(strNewCardID, mebres, out err); if (err != null || (!strresult.Equals(CardCommon.CardDef.ConstMsg.RFOK))) { if (strresult == "") { strresult = this.GetColCh(strresult, "ERR"); } MessageBox.Show("补发卡失败,请重试!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error); if (err != null && strresult != "") { clog.WriteLine(err.Message + "\n" + strresult); } else if (err != null) { clog.WriteLine(err); } else { clog.WriteLine(strresult); } this.DgBind(); } else { MessageBox.Show("补发卡成功!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information); this.DgBind(); } }