public HttpResponseMessage UserAlternatePhone([FromBody] AccountRequest accountRequest) { HttpResponseMessage hrm = Request.CreateErrorResponse( HttpStatusCode.NoContent, "Unexpected Error changing the Alternate Phone Number"); using (GetEmployerConnString gecs = new GetEmployerConnString(Request.EmployerID())) { using (UpdateUserPhone uup = new UpdateUserPhone()) { uup.CCHID = Request.CCHID(); uup.Phone = accountRequest.NewAlternatePhone; uup.PostData(gecs.ConnString); hrm = Request.CreateResponse(HttpStatusCode.OK); } } return(hrm); }
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); }