public SiteMember CreateMember(MemberAuthInfo authInfo, MemberProfileData profile, out MemberCreationStatus status, IList <IContextActionValidationRequest <IContextActionValidator> > validationRequests = null) { const string logMethodName = ".CreateMember(MemberAuthInfo, MemberProfileData, out MemberCreationStatus, IList<IContextActionValidationRequest<IContextActionValidator>>)"; const string logEndMessage = logMethodName + " - End Method"; _log.Info(logMethodName + " - Creating new SiteMember"); _log.Debug(logMethodName + " - Begin Method"); SiteMember newMember = null; status = MemberCreationStatus.Error; IMemberAccountData accountData = null; int timesToTry = 2; //SWD-7461 - adding retry logic. for (int i = 0; i < timesToTry; i++) { try { _log.Debug(logMethodName + " - Calling ISecurityAdapter.CreateMember(MemberAuthInfo authInfo, MemberProfileData data, out MemberCreationStatus status)"); status = MemberCreationStatus.Error; accountData = _adapter.CreateMember(authInfo, profile, out status); break; } catch (Exception ex) { _log.Error(logMethodName + " - Error Creating new member account using the ISecurityAdapter.CreateMember will retry again", ex); System.Threading.Thread.Sleep(1000); accountData = null; } } if (status == MemberCreationStatus.Success) { _log.Info(logMethodName + " - MemberAccount created successfully by ISecurityAdapter.CreateMember - Creating MemberProfile"); var memberProfile = new MemberProfileData(profile) { MemberId = accountData.MemberId, LastModified = DateTime.Now, LastModifiedBy = accountData.MemberId }; if (memberProfile.ProviderKeys == null) { memberProfile.ProviderKeys = new Dictionary <string, object>(); } memberProfile.ProviderKeys.Add("ActiveDirectoryKey", accountData.MemberId); // We prob dont need this, code using the ADKey lower in the framework will be ignored try { IMemberProfileData data; _log.Debug(logMethodName + " - Calling IContextDataProvider.CreateMemberProfile(MemberProfileData data, ProviderKeys keys)"); //TODO verify and remove provider key integration at this layer. - May need pin based lookup for pre-registered accounts to call update. data = _provider.CreateMemberProfile(memberProfile, memberProfile.ProviderKeys); memberProfile = new MemberProfileData(data); } catch (Exception ex) { _log.Error(logMethodName + " - Error Creating new member profile using the IContextDataProvider - Rolling back new account", ex); _log.Info(logMethodName + " - Rolling back - STEP 1. DELETE MEMBER ACCOUNT"); _log.Debug(logMethodName + " - Calling ISecurityAdapter.DeleteMember(Object memberId)"); _adapter.DeleteMember(accountData.Username); status = MemberCreationStatus.AdapterError; _log.Debug(logEndMessage); accountData = null; } try { newMember = new SiteMember(accountData, memberProfile); } catch (Exception ex) { _log.Error(logMethodName + " - Error Creating new sitemember instance", ex); _log.Debug(logEndMessage); newMember = null; } } else { // SWD-5616 _log.Warn(logMethodName + " - Member Creation Unsuccessful. Status: " + status); } _log.Debug(logEndMessage); return(newMember); }
public SiteMember CreateMember(MemberAuthInfo authInfo, MemberProfileData profile, out MemberCreationStatus status, System.Collections.Generic.IList <IContextActionValidationRequest <IContextActionValidator> > validationRequests = null) { status = MemberCreationStatusResponse; return(CreateMemberResponse); }