Ejemplo n.º 1
0
 /// <summary>
 /// CardID TextBox Leave Event.
 /// </summary>
 private void CardIDTB_Leave(object sender, EventArgs e)
 {
     if (!String.IsNullOrWhiteSpace(CardIDTB.Text) && !Regex.IsMatch(CardIDTB.Text.Trim(), @"^(^\d{15}$|^\d{18}$|^\d{17}(\d|X|x))$", RegexOptions.IgnoreCase))
     {
         CardIDTB.BackColor = Color.MistyRose;
         CardIDTB.Focus();
         MessageBox.Show("请输入正确的身份证号码", "系统警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
     else
     {
         CardIDTB.BackColor = SystemColors.Window;
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// CardID TextBox KeyDown Event.
 /// </summary>
 private void CardIDTB_KeyDown(object sender, KeyEventArgs e)
 {
     try {
         if (e.KeyCode == Keys.Enter && ReadBtn.Tag.Equals("1") && !String.IsNullOrWhiteSpace(CardIDTB.Text))
         {
             ReadCard();
             CardIDTB.Clear();
             CardIDTB.Focus();
         }
     } catch (Exception err) {
         Common.WriteLog(DateTime.Now, EnmMsgType.Error, "System", "Delta.MPS.AccessSystem.BatchOrgCardsForm.CardIDTB.KeyDown", err.Message, err.StackTrace);
         MessageBox.Show(err.Message, "系统错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Ejemplo n.º 3
0
        /// <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);
            }
        }
Ejemplo n.º 4
0
 /// <summary>
 /// CardXID TextBox Text Changed Event.
 /// </summary>
 private void CardXIDTB_TextChanged(object sender, EventArgs e)
 {
     try {
         CardIDTB.TextChanged -= CardIDTB_TextChanged;
         if (String.IsNullOrWhiteSpace(CardXIDTB.Text))
         {
             CardIDTB.Clear();
         }
         else
         {
             CardIDTB.Text = Common.GetCardSn16to10(CardXIDTB.Text);
         }
     } catch (Exception err) {
         Common.WriteLog(DateTime.Now, EnmMsgType.Error, "System", "Delta.MPS.AccessSystem.BatchCardsForm", err.Message, err.StackTrace);
         MessageBox.Show(err.Message, "系统错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
     } finally {
         CardIDTB.TextChanged += CardIDTB_TextChanged;
     }
 }