Esempio n. 1
0
        private void InputRealName()
        {
            tb_AccountNo.Enabled = false;
            var accountNo = tb_AccountNo.Text.Trim();

            if (!accountNo.IsNumericString())
            {
                tb_AccountNo.Enabled = true;
                MessageBox.Show(@"输入工号不对!");
                tb_AccountNo.Focus();
                tb_AccountNo.SelectAll();
                tb_ProcessNo.Enabled = false;
            }
            else
            {
                var realName = PersonnelManager.GetRealNameByAccountNo(accountNo, out _personnelId);
                if (realName == string.Empty)
                {
                    tb_AccountNo.Enabled = true;
                    MessageBox.Show(@"未找到此工号的员工!");
                    tb_AccountNo.Focus();
                    tb_AccountNo.SelectAll();
                    lb_RealName.Text     = string.Empty;
                    tb_ProcessNo.Enabled = false;
                }
                else
                {
                    lb_RealName.Text     = realName;
                    tb_AccountNo.Enabled = true;
                    tb_ProcessNo.Enabled = true;
                    tb_ProcessNo.Focus();
                }
            }
        }