protected void btnTestAddUser_Click(object sender, EventArgs e)
        {
            UserServiceRef.User user = new UserServiceRef.User();
            UserServiceRef.UserService pxy = new UserServiceRef.UserService();

            user.firstName = "Cool";
            user.lastName = "Guy";
            user.email = "*****@*****.**";
            string password = "******";
            user.password = password.GetHashCode().ToString();
            lblReserveResult.Text = "TestValidate method executed successfully: "
                + pxy.AddUser(user);
        }
Esempio n. 2
0
        protected void btnTestAddUser_Click(object sender, EventArgs e)
        {
            UserServiceRef.User        user = new UserServiceRef.User();
            UserServiceRef.UserService pxy  = new UserServiceRef.UserService();

            user.firstName = "Cool";
            user.lastName  = "Guy";
            user.email     = "*****@*****.**";
            string password = "******";

            user.password         = password.GetHashCode().ToString();
            lblReserveResult.Text = "TestValidate method executed successfully: "
                                    + pxy.AddUser(user);
        }
        protected void btnRegister_Click(object sender, EventArgs e)
        {
            UserServiceRef.User newUser = new UserServiceRef.User();
            newUser.firstName = txtFirstName.Text;
            newUser.lastName  = txtLastName.Text;
            newUser.email     = txtEmail.Text;
            newUser.password  = txtPassword1.Text;

            if (String.IsNullOrEmpty(newUser.firstName))
            {
                Page.ClientScript.RegisterClientScriptBlock(GetType(), "ValidationAlertScript", "alert('First name must be at least 2 characters long.')", true);
                return;
            }

            if (String.IsNullOrEmpty(newUser.lastName))
            {
                Page.ClientScript.RegisterClientScriptBlock(GetType(), "ValidationAlertScript", "alert('Last name must be at least 2 characters long.')", true);
                return;
            }

            if (String.IsNullOrEmpty(newUser.email))
            {
                Page.ClientScript.RegisterClientScriptBlock(GetType(), "ValidationAlertScript", "alert('Please enter a valid email.')", true);
                return;
            }

            if (String.IsNullOrEmpty(newUser.password))
            {
                Page.ClientScript.RegisterClientScriptBlock(GetType(), "ValidationAlertScript", "alert('Please enter a valid password.')", true);
                return;
            }

            UserServiceRef.UserService pxy = new UserServiceRef.UserService();
            bool emailUsed = pxy.CheckForEmail(newUser.email);

            if (emailUsed)
            {
                pxy.AddUser(newUser);
                Response.Redirect("Login.aspx");
            }
            else
            {
                Page.ClientScript.RegisterClientScriptBlock(GetType(), "ValidationAlertScript", "alert('The chosen email is already used, please login if you already have an account, or use another email id.')", true);
            }
        }
        protected void btnRegister_Click(object sender, EventArgs e)
        {
            UserServiceRef.User newUser = new UserServiceRef.User();
            newUser.firstName = txtFirstName.Text;
            newUser.lastName = txtLastName.Text;
            newUser.email = txtEmail.Text;
            newUser.password = txtPassword1.Text;

            if (String.IsNullOrEmpty(newUser.firstName))
            {
                Page.ClientScript.RegisterClientScriptBlock(GetType(), "ValidationAlertScript", "alert('First name must be at least 2 characters long.')", true);
                return;
            }

            if (String.IsNullOrEmpty(newUser.lastName))
            {
                Page.ClientScript.RegisterClientScriptBlock(GetType(), "ValidationAlertScript", "alert('Last name must be at least 2 characters long.')", true);
                return;
            }

            if (String.IsNullOrEmpty(newUser.email))
            {
                Page.ClientScript.RegisterClientScriptBlock(GetType(), "ValidationAlertScript", "alert('Please enter a valid email.')", true);
                return;
            }

            if (String.IsNullOrEmpty(newUser.password))
            {
                Page.ClientScript.RegisterClientScriptBlock(GetType(), "ValidationAlertScript", "alert('Please enter a valid password.')", true);
                return;
            }

            UserServiceRef.UserService pxy = new UserServiceRef.UserService();
            bool emailUsed = pxy.CheckForEmail(newUser.email);

            if (emailUsed)
            {
                pxy.AddUser(newUser);
                Response.Redirect("Login.aspx");
            }
            else
            {
                Page.ClientScript.RegisterClientScriptBlock(GetType(), "ValidationAlertScript", "alert('The chosen email is already used, please login if you already have an account, or use another email id.')", true);
            }
        }
 /// <remarks/>
 public void AddUserAsync(User newUser, object userState) {
     if ((this.AddUserOperationCompleted == null)) {
         this.AddUserOperationCompleted = new System.Threading.SendOrPostCallback(this.OnAddUserOperationCompleted);
     }
     this.InvokeAsync("AddUser", new object[] {
                 newUser}, this.AddUserOperationCompleted, userState);
 }
 /// <remarks/>
 public void AddUserAsync(User newUser) {
     this.AddUserAsync(newUser, null);
 }
 public bool AddUser(User newUser) {
     object[] results = this.Invoke("AddUser", new object[] {
                 newUser});
     return ((bool)(results[0]));
 }