Ejemplo n.º 1
0
        internal static UserProfileField Factory(Guid contactId, Guid profileId, ProfileField profileField)
        {
            UserProfileField f = new UserProfileField();

            f.Id        = Guid.Empty;
            f.ProfileId = profileId;
            f.FieldId   = profileField.Id;
            f.ContactId = contactId;
            f.Name      = profileField.Name;
            return(f);
        }
Ejemplo n.º 2
0
 public void Update(NameValueCollection collection)
 {
     foreach (string key in collection.AllKeys)
     {
         UserProfileField field = Fields.FirstOrDefault(x => GetPropName(x.Name).Equals(key, StringComparison.OrdinalIgnoreCase));
         if (field != null)
         {
             field.Value = collection[key];
         }
     }
 }
Ejemplo n.º 3
0
        internal static UserProfile Factory(Profile ProfileDefinition)
        {
            UserProfile profile = new UserProfile()
            {
                Id = Guid.Empty, ProfileDefinition = ProfileDefinition
            };

            foreach (ProfileField field in ProfileDefinition.Fields)
            {
                profile.Fields.Add(UserProfileField.Factory(Guid.Empty, ProfileDefinition.Id, field));
            }

            return(profile);
        }
Ejemplo n.º 4
0
        internal static UserProfileField Factory(Entity e)
        {
            UserProfileField f = new UserProfileField();

            f.Id        = e.GetAttributeValue <Guid>("appl_membershipprofileid");
            f.ProfileId = e.GetAttributeValue <EntityReference>("appl_profiledefinitionid").Id;
            f.FieldId   = e.GetAttributeValue <EntityReference>("appl_profilefieldid").Id;
            f.ContactId = e.GetAttributeValue <EntityReference>("appl_contactid").Id;
            f.Value     = e.GetAttributeValue <string>("appl_value");
            f.Name      = e.GetAttributeValue <string>("appl_name");

            // TODO: Fill out the rest of the fields
            if (e.Contains("appl_datetime"))
            {
                f.Date = e.GetAttributeValue <DateTime>("appl_datetime");
            }
            if (e.Contains("appl_boolean"))
            {
                OptionSetValue v = e.GetAttributeValue <OptionSetValue>("appl_boolean");
                switch (v.Value)
                {
                case (int)ProfileFieldBooleanValues.False:
                    f.Boolean = false;
                    break;

                case (int)ProfileFieldBooleanValues.True:
                    f.Boolean = true;
                    break;

                default:
                    break;
                }
            }
            if (e.Contains("appl_decimalnumber"))
            {
                f.Decimal = e.GetAttributeValue <decimal>("appl_decimalnumber");
            }
            if (e.Contains("appl_wholenumber"))
            {
                f.Number = e.GetAttributeValue <int>("appl_wholenumber");
            }
            return(f);
        }
Ejemplo n.º 5
0
        internal static UserProfile Factory(Guid ContactId, EntityCollection Profiles, Profile ProfileDefinition)
        {
            UserProfile profile = new UserProfile()
            {
                Id = ContactId, ProfileDefinition = ProfileDefinition
            };

            foreach (Entity e in Profiles.Entities)
            {
                profile.Fields.Add(UserProfileField.Factory(e));
            }

            foreach (ProfileField field in ProfileDefinition.Fields.Except(ProfileDefinition.Fields.Where(x => Profiles.Entities.Any(y => y.GetAttributeValue <EntityReference>("appl_profilefieldid").Id.Equals(x.Id)))))
            {
                profile.Fields.Add(UserProfileField.Factory(ContactId, ProfileDefinition.Id, field));
            }

            return(profile);
        }