ActivEarth.Account.Register.CreateUser C# (CSharp) Method

CreateUser() protected method

Create a new weather.
protected CreateUser ( object sender, EventArgs e ) : void
sender object Object that requested the page load
e EventArgs The event arguments.
return void
        protected void CreateUser(object sender, EventArgs e)
        {
            if (UserDAO.GetUserFromUserName(txbUserName.Text) == null)
            {
                var user = new User { UserName = txbUserName.Text, FirstName = txbFirstName.Text, LastName = txbLastName.Text, Email = txbEmail.Text, Gender = (ddlGender.SelectedValue) };
                user.UserID = UserDAO.CreateNewUser(user, txbPassword.Text);

                string[] dateTime = DateTime.Now.ToString("MM/dd/yyyy h:mmtt").Split(' ');
                user.Post(new Message("Welcome to ActivEarth!", "See the tabs to the right to start you on your way to a more active lifestyle!",
                    user, dateTime[0], dateTime[1]));
                UserDAO.UpdateUserProfile(user);

                if (user.UserID == 0) {
                    ErrorMessage.Text = "A Database error occurred creating the User.";
                }
                else{
                    Session["userDetails"] = user;
                    Response.Redirect("~/Groups/Groups.aspx");
                }
            }
            else
            {
                ErrorMessage.Text = "A User with the given User Name already exists.  Please choose a different User Name.";
            }

            //UserDAO.CreateNewUser()
        }