예제 #1
0
        protected void btnRegister_Click(object sender, EventArgs e)
        {
            user.username  = txtUserName.Text;
            user.useremail = txtemail.Text;
            user.userpass  = txtpassword.Text;
            if (fpUpload.HasFile)
            {
                user.userphoto = "~/UserPhotos/" + fpUpload.PostedFile.FileName;
                fpUpload.SaveAs(Server.MapPath(user.userphoto));
            }
            else
            {
                user.userphoto = "no image";
            }
            int data = new MyUserObject().AddUserInfo(user);

            if (data > 0)
            {
                Response.Write("user registration succesfully done");
            }
            else
            {
                Response.Write("user registration failed");
            }
        }
예제 #2
0
        private void regBtn_Click(object sender, EventArgs e)
        {
            //注册用户
            MyUserObject user = new MyUserObject();

            user.username = username.Text;
            user.password = password.Text;
            user.sex      = new BmobBoolean(false);
            user.age      = 50;
            var future = Bmob.CreateTaskAsync <MyUserObject>(user);

            try
            {
                FinishedCallback(future.Result, result);
            }
            catch
            {
                MessageBox.Show("注册失败,原因:" + future.Exception.InnerException.ToString());
            }
        }