Exemple #1
0
        public void SetProfilePropertyValue(ProfileInfoWrapper info, ProfilePropertyDefinition property, string propertyValue)
        {
            if (info == null)
            {
                return;
            }
            var    profile = ProfileProvider.GetProfile(info.GetProfileInfo());
            object value   = null;

            if (property.TypeDefinition != null)
            {
                if (property.TypeDefinition == typeof(string))
                {
                    value = propertyValue;
                }
                else
                {
                    var typeConverter = System.ComponentModel.TypeDescriptor.GetConverter(property.TypeDefinition);
                    if (typeConverter != null)
                    {
                        value = typeConverter.ConvertFromString(propertyValue);
                    }
                    else
                    {
                        value = propertyValue;
                    }
                }
            }
            else
            {
                value = propertyValue;
            }
            profile.SetPropertyValue(property.Name, value);
            ProfileProvider.SaveProfileProperties(profile);
        }
Exemple #2
0
        public Profile GetProfile(ProfileInfoWrapper info)
        {
            if (info == null)
            {
                return(null);
            }
            var profile = ProfileProvider.GetProfile(info.GetProfileInfo());

            return(profile == null ? null : new Profile(profile));
        }