private void sbtnExit_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.CardExit(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; sbtnExit.Enabled = false; } } }