Esempio n. 1
0
 private void SetupUserProfile()
 {
     using (InsertUserProfile iup = new InsertUserProfile())
     {
         iup.UserID     = (Guid)Membership.GetUser(cuwReview.UserName).ProviderUserKey;
         iup.EmployerID = (ThisSession.EmployerID == String.Empty ? 0 : Convert.ToInt32(ThisSession.EmployerID));
         iup.FirstName  = ThisSession.FirstName;
         iup.LastName   = ThisSession.LastName;
         iup.Email      = cuwReview.Email;
         iup.PostFrontEndData();
     }
 }
Esempio n. 2
0
 private void SetupUserProfile()
 {
     using (InsertUserProfile iup = new InsertUserProfile())
     {
         iup.UserID = (Guid)Membership.GetUser(cuwReview.UserName).ProviderUserKey;
         iup.EmployerID = (ThisSession.EmployerID == String.Empty ? 0 : Convert.ToInt32(ThisSession.EmployerID));
         iup.FirstName = ThisSession.FirstName;
         iup.LastName = ThisSession.LastName;
         iup.Email = cuwReview.Email;
         iup.PostFrontEndData();
     }
 }
        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);
        }