/// <summary> /// Recupera os dados do perfil. /// </summary> /// <param name="info">Informações usadas para recuperar o perfil.</param> /// <returns></returns> public IProfile GetProfile(ProfileInfo info) { if (info == null) { return(null); } ProfileProviderServiceReference.Profile result = null; try { result = ProfileProviderClient.GetProfile(Convert(info)); } catch (System.ServiceModel.EndpointNotFoundException ex) { throw new ProfileProviderException( ResourceMessageFormatter.Create(() => Properties.Resources.RemoteProfileProvider_GetProfileCommunicationError).Format(), ex); } catch (System.ServiceModel.FaultException <System.ServiceModel.ExceptionDetail> ex) { throw new ProfileProviderException( ResourceMessageFormatter.Create(() => Properties.Resources.RemoteProfileProvider_GetProfileFaultException, ex.Message).Format(), ex); } return(result == null ? null : new Wrappers.ProfileWrapper(result, this)); }
/// <summary> /// Define o valor da propriedade do perfil. /// </summary> /// <param name="profile"></param> /// <param name="property"></param> /// <param name="propertyValue"></param> public void SetProfilePropertyValue(IProfile profile, ProfilePropertyDefinition property, string propertyValue) { profile.Require("profile").NotNull(); property.Require("property").NotNull(); var info = profile.GetInfo(); ProfileProviderClient.SetProfilePropertyValue(Convert(info), property, propertyValue); }
/// <summary> /// Apaga os perfis informados. /// </summary> /// <param name="profiles">Informações dos perfis que serão apagados.</param> /// <returns></returns> public int DeleteProfiles(ProfileInfo[] profiles) { if (profiles == null || profiles.Length == 0) { return(0); } return(ProfileProviderClient.DeleteProfilesByProfileInfo(profiles.Select(f => Convert(f)).ToArray())); }
/// <summary> /// Recupera a origem do perfil. /// </summary> /// <param name="sourceId"></param> /// <returns></returns> public IAuthenticationSource GetSource(int sourceId) { var source = ProfileProviderClient.GetSource(sourceId); if (source == null) { return(null); } return(new Wrappers.AuthenticationSourceWrapper(source)); }
/// <summary> /// Recupera os perfis associados com o usuário informado. /// </summary> /// <param name="userName"></param> /// <returns></returns> public IList <ProfileInfo> GetUserProfiles(string userName) { try { return(ProfileProviderClient.GetUserProfiles(userName) .Select(f => Convert(f)).ToList()); } catch (System.ServiceModel.EndpointNotFoundException ex) { throw new ProfileProviderException( ResourceMessageFormatter.Create( () => Properties.Resources.RemoteProfileProvider_GetUserProfilesCommunicationError, ProfileProviderClient.Endpoint.Address.Uri).Format(), ex); } catch (System.ServiceModel.FaultException <System.ServiceModel.ExceptionDetail> ex) { throw new ProfileProviderException( ResourceMessageFormatter.Create(() => Properties.Resources.RemoteProfileProvider_GetUserProfilesFaultException, ex.Message).Format(), ex); } catch (System.ServiceModel.FaultException ex) { throw new ProfileProviderException( ResourceMessageFormatter.Create(() => Properties.Resources.RemoteProfileProvider_GetUserProfilesFaultException, ex.Message).Format(), ex); } }
/// <summary> /// Pesquisa os perfis associados com o nome do usuário informado. /// </summary> /// <param name="usernameToMatch"></param> /// <returns></returns> public IList <ProfileInfo> FindProfilesByUserName(string usernameToMatch) { return(ProfileProviderClient.FindProfilesByUserName(usernameToMatch) .Select(f => Convert(f)).ToList()); }
/// <summary> /// Apaga os perfis dos usuários informados. /// </summary> /// <param name="usernames">Nomes dos usuários que terão seus perfis apagados.</param> /// <returns></returns> public int DeleteProfiles(string[] usernames) { return(ProfileProviderClient.DeleteProfiles(usernames)); }