/// <summary> /// CardXID TextBox Key Down Event. /// </summary> private void CardXIDTB_KeyDown(object sender, KeyEventArgs e) { try { if (e.KeyCode == Keys.Enter && ReadBtn.Tag.Equals("1") && !String.IsNullOrWhiteSpace(CardIDTB.Text)) { ReadCard(); CardXIDTB.Clear(); CardXIDTB.Focus(); } } catch (Exception err) { Common.WriteLog(DateTime.Now, EnmMsgType.Error, "System", "Delta.MPS.AccessSystem.BatchOrgCardsForm.CardXIDTB.KeyDown", err.Message, err.StackTrace); MessageBox.Show(err.Message, "系统错误", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
/// <summary> /// Read Card Button Click Event. /// </summary> private void ReadBtn_Click(object sender, EventArgs e) { try { if (ReadBtn.Tag.Equals("0") && EmpGridView.Rows.Count == 0) { MessageBox.Show("请选择需要发卡的员工", "系统警告", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } SetEmpBtn.Enabled = EmpGridView.Enabled = CardTypeCB.Enabled = BeginTimeDTP.Enabled = BeginReasonCB.Enabled = EnabledXIDCB.Enabled = OKBtn.Enabled = CardUIDTB.Enabled = CardPwdTB.Enabled = !ReadBtn.Tag.Equals("0"); BeginReasonTB.Enabled = !ReadBtn.Tag.Equals("0") && Convert.ToInt32(BeginReasonCB.SelectedValue) == 0; if (ReadBtn.Tag.Equals("0")) { ExistCards.Clear(); if (EnabledXIDCB.Checked) { CardXIDTB.Focus(); } else { CardIDTB.Focus(); } ReadBtn.Tag = "1"; ReadBtn.Text = "停止读卡(&P)"; } else { ReadBtn.Tag = "0"; ReadBtn.Text = "开始读卡(&R)"; } } catch (Exception err) { Common.WriteLog(DateTime.Now, EnmMsgType.Error, "System", "Delta.MPS.AccessSystem.BatchOrgCardsForm.ReadBtn.Click", err.Message, err.StackTrace); MessageBox.Show(err.Message, "系统错误", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
/// <summary> /// CardID TextBox Text Changed Event. /// </summary> private void CardIDTB_TextChanged(object sender, EventArgs e) { try { CardXIDTB.TextChanged -= CardXIDTB_TextChanged; if (String.IsNullOrWhiteSpace(CardIDTB.Text)) { CardXIDTB.Clear(); } else { CardXIDTB.Text = Common.GetCardSn10to16(CardIDTB.Text); } } catch (Exception err) { Common.WriteLog(DateTime.Now, EnmMsgType.Error, "System", "Delta.MPS.AccessSystem.BatchOrgCardsForm.CardIDTB.TextChanged", err.Message, err.StackTrace); MessageBox.Show(err.Message, "系统错误", MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { CardXIDTB.TextChanged += CardXIDTB_TextChanged; } }