コード例 #1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            //todo:判断字段不能为空
            string username = txtUserName.Text;
            string password = txtPwd.Text;
            string phoneNum = txtPhoneNum.Text;
            int    age      = Convert.ToInt32(txtAge.Text);
            bool   exists;

            userBll.Add2(username, password, phoneNum, age, out exists);
            if (exists)
            {
                MessageBox.Show("用户名已经存在");
            }
            else
            {
                this.Close();//窗口关闭
            }
            //userBll.Add(username, password, phoneNum, age);
        }