Exemple #1
0
        public void SetPropertyValues(System.Configuration.SettingsContext sc, SettingsPropertyValueCollection properties)
        {
            string loginUserID         = (string)sc["UserName"];
            bool   userIsAuthenticated = (bool)sc["IsAuthenticated"];

            if (((loginUserID != null) && (loginUserID.Length >= 1)) && (properties.Count >= 1))
            {
                string allNames  = string.Empty;
                string allValues = string.Empty;
                byte[] buf       = null;
                PrepareDataForSaving(ref allNames, ref allValues, ref buf, true, properties, userIsAuthenticated);
                if (allNames.Length != 0)
                {
                    SystemUserProfileEntity p = new SystemUserProfileEntity();
                    p.UserID = this.DataObjectsContainerIocID.SystemUserDataObjectInstance.GetUserByLoginID(loginUserID);
                    p.PropertyValuesBinary = buf;
                    p.PropertyValuesString = allValues;
                    p.LastUpdatedDate      = DateTime.Now;

                    if (GetUserProfileByUserID(loginUserID) == null)
                    {
                        selfDataObject.Save(p);
                    }
                    else
                    {
                        selfDataObject.Update(p);
                    }
                }
            }
        }
        internal static SystemUserProfileWrapper ConvertEntityToWrapper(SystemUserProfileEntity entity)
        {
            if (entity == null)
            {
                return(null);
            }

            if (entity.ProfileID == 0)
            {
                return(null);
            }

            return(new SystemUserProfileWrapper(entity));
        }
Exemple #3
0
        public ProfileInfoCollection FindProfilesByUserName(ProfileAuthenticationOption profileAuthenticationOption, string usernameToMatch, int pageIndex, int pageSize, out int totalRecords)
        {
            ProfileInfoCollection infos = new ProfileInfoCollection();

            SystemUserEntity user =
                this.DataObjectsContainerIocID.SystemUserDataObjectInstance.GetUserByLoginID(usernameToMatch);

            SystemUserProfileEntity prof = GetUserProfileByUserID(usernameToMatch);

            infos.Add(new ProfileInfo(user.UserLoginID, false, user.LastActivityDate, prof.LastUpdatedDate, prof.PropertyValuesBinary.Length + prof.PropertyValuesString.Length));
            totalRecords = 1;

            return(infos);
        }
Exemple #4
0
        public SettingsPropertyValueCollection GetPropertyValues(SettingsContext settingsContext, SettingsPropertyCollection properties)
        {
            SettingsPropertyValueCollection svc = new SettingsPropertyValueCollection();

            if (properties.Count == 0)
            {
                return(svc);
            }

            string[] names  = null;
            string   values = null;

            //Create the default structure of the properties
            foreach (SettingsProperty prop in properties)
            {
                if (prop.SerializeAs == SettingsSerializeAs.ProviderSpecific)
                {
                    if (prop.PropertyType.IsPrimitive || prop.PropertyType == typeof(string))
                    {
                        prop.SerializeAs = SettingsSerializeAs.String;
                    }
                    else
                    {
                        prop.SerializeAs = SettingsSerializeAs.Xml;
                    }
                }

                svc.Add(new SettingsPropertyValue(prop));
            }

            SystemUserProfileEntity dbProperties = GetUserProfileByUserID((string)settingsContext["UserName"]);

            if (dbProperties != null)
            {
                values = dbProperties.PropertyValuesString;

                if (names != null && names.Length > 0)
                {
                    ParseDataFromDB(names, values, dbProperties.PropertyValuesBinary, svc);
                }
            }

            return(svc);
        }
 internal SystemUserProfileWrapper(SystemUserProfileEntity entityObj)
     : base(entityObj)
 {
 }
 internal SystemUserProfileWrapper(SystemUserProfileEntity entityObj)
 {
     entity = entityObj;
 }