public override System.Web.Security.MembershipUser CreateUser(string username,
                                                                      string password,
                                                                      string email,
                                                                      string passwordQuestion,
                                                                      string passwordAnswer,
                                                                      bool isApproved,
                                                                      object providerUserKey,
                                                                      out MembershipCreateStatus status)
        {
            var membershipUser = PrimaryMembershipProvider.CreateUser(username,
                                                                      password,
                                                                      email,
                                                                      passwordQuestion,
                                                                      passwordAnswer,
                                                                      isApproved,
                                                                      providerUserKey,
                                                                      out status);

            if (membershipUser == null)
            {
                return(null);
            }
            if (status.Equals(MembershipCreateStatus.Success))
            {
                string userId;
                var    providerId = membershipUser.ProviderUserKey ?? membershipUser.UserName;
                try {
                    var guid = new Guid(providerId.ToString());
                    userId = guid.ToString("N");
                } catch (FormatException) {
                    userId = HashToString(providerId.ToString());
                }
                base.CreateUser(username, password, email, passwordQuestion, passwordAnswer, isApproved, userId, out status);
                if (!status.Equals(MembershipCreateStatus.Success))
                {
                    PrimaryMembershipProvider.DeleteUser(username, true);
                }
            }
            return(GetHybridMembershipUser(membershipUser));
        }
        private bool CreateNewMemberAccount(string email,
                                            string firstName, string lastName, string phone, string mobilePhone,
                                            int secretQuestionId, string secretAnswer, string password,
                                            int cchid, int employerId, string cnxString, out MembershipCreateStatus status)
        {
            bool   isSuccessful     = false;
            string securityQuestion = GetPasswordQuestions()
                                      .Where(q => q.Key == secretQuestionId.ToString())
                                      .Select(q => q.Value.ToString())
                                      .First();

            MembershipUser newUser = Membership.CreateUser(
                email, password, email, securityQuestion, secretAnswer, true, out status);

            if (newUser != null && status.Equals(MembershipCreateStatus.Success))
            {
                Roles.AddUserToRole(email, "Customer");

                using (InsertUserProfile iup = new InsertUserProfile()) {
                    var providerUserKey = newUser.ProviderUserKey;
                    if (providerUserKey != null)
                    {
                        iup.UserID      = (Guid)providerUserKey;
                        iup.EmployerID  = employerId;
                        iup.FirstName   = firstName;
                        iup.LastName    = lastName;
                        iup.Email       = email;
                        iup.MessageCode = "RegConfirmationMsg";
                        iup.PostFrontEndData();

                        if (!iup.HasThrownError)
                        {
                            using (UpdateUserEmail uue = new UpdateUserEmail()) {
                                uue.UpdateClientSide(email, cchid, cnxString);
                                if (!uue.HasThrownError)
                                {
                                    using (UpdateUserPhone uup = new UpdateUserPhone()) {
                                        uup.Phone = phone;
                                        uup.CCHID = cchid;
                                        uup.PostData(cnxString);
                                        if (!uup.HasThrownError)
                                        {
                                            using (UpdateUserMobilePhone uump = new UpdateUserMobilePhone()) {
                                                uump.MobilePhone = mobilePhone;
                                                uump.CCHID       = cchid;
                                                uump.PostData(cnxString);
                                                if (!uump.HasThrownError)
                                                {
                                                    isSuccessful = true;
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            return(isSuccessful);
        }
		public override System.Web.Security.MembershipUser CreateUser(string username,
		                                                              string password,
		                                                              string email,
		                                                              string passwordQuestion,
		                                                              string passwordAnswer,
		                                                              bool isApproved,
		                                                              object providerUserKey,
		                                                              out MembershipCreateStatus status) {
			var membershipUser = PrimaryMembershipProvider.CreateUser(username,
			                                                          password,
			                                                          email,
			                                                          passwordQuestion,
			                                                          passwordAnswer,
			                                                          isApproved,
			                                                          providerUserKey,
			                                                          out status);
			if(membershipUser == null) {
				return null;
			}
			if(status.Equals(MembershipCreateStatus.Success)) {
				string userId;
				var providerId = membershipUser.ProviderUserKey ?? membershipUser.UserName;
				try {
					var guid = new Guid(providerId.ToString());
					userId = guid.ToString("N");
				} catch(FormatException) {
					userId = HashToString(providerId.ToString());
				}
				base.CreateUser(username, password, email, passwordQuestion, passwordAnswer, isApproved, userId, out status);
				if(!status.Equals(MembershipCreateStatus.Success)) {
					PrimaryMembershipProvider.DeleteUser(username, true);
				}
			}
			return GetHybridMembershipUser(membershipUser);
		}