コード例 #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void textBox_UserAccount_Leave(object sender, EventArgs e)
        {
            err_UserAccount.Text = "";

            string userAccount = textBox_UserAccount.Text;

            if (string.IsNullOrEmpty(userAccount))
            {
                err_UserAccount.Text      = "请输入账号";
                err_UserAccount.ForeColor = Color.Red;
                return;
            }

            if (_usersBll.ExsitModel(userAccount))
            {
                //存在
                err_UserAccount.Text      = "该用户名已存在";
                err_UserAccount.ForeColor = Color.Red;
            }
            else
            {
                //不存在
                err_UserAccount.Text      = "该用户名可使用";
                err_UserAccount.ForeColor = Color.Green;
            }
        }