Exemplo n.º 1
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            //获取用户输入的信息
            string name  = UserName.Text;
            string pwd   = PassWord.Password;
            string Dname = DisplayName.Text;
            string OKpwd = OKPassWord.Password;

            //调用代码
            if (name == "" || pwd == "" || Dname == "" || OKpwd == "")
            {
                MessageBox.Show("各项不可为空!");
            }
            else
            {
                if (pwd != OKpwd)
                {
                    MessageBox.Show("密码不一致!");
                }
                else
                {
                    UsersBll   usersBll = new UsersBll();
                    UsersModel user     = usersBll.CheckByName(name, Dname, Md5Helper.EncryptString(pwd));
                    if (user != null)
                    {
                        MessageBox.Show("该用户已存在!");
                    }
                    else
                    {
                        MessageBox.Show("注册成功!");
                    }
                }
            }
        }