/// <summary> /// Handles the Click event of the _btnCreateAccount control. /// </summary> /// <param name = "sender">The source of the event.</param> /// <param name = "e">The <see cref = "System.EventArgs" /> instance containing the event data.</param> protected void _btnCreateAccount_Click(object sender, EventArgs e) { if (IsInputValid() == false) { return; } var db = new UrbanDataContext(); var user = db.Manager.User.GetUserByEmail(_txtEmail.Text.Trim()); if (user != null) { WriteFeedBackMaster(FeedbackType.Warning, "Email address already in use."); return; } //Create new user var u = new User { ActivationGuid = Guid.NewGuid(), DateCreated = DateTime.Now, FirstName = _txtFirstName.Text.Trim(), LastName = _txtLastName.Text.Trim(), Email = _txtEmail.Text.Trim() }; //Email new user and verify success if (UserUtilities.CreateUser(u, _txtPassword.Text.Trim())) { UserEmailUtilities.NewUserAccount(u); WriteFeedBackMaster(FeedbackType.Success, "Account Created Succesfully"); var ajaxManager = RadAjaxManager.GetCurrent(Page); ajaxManager.ResponseScripts.Add("Close();"); } else { WriteFeedBackMaster(FeedbackType.Error, "Account Creation Error"); } }