Пример #1
0
        /// <summary>
        /// Inserts a GreyFoxUserPreference into the database. All children should have been
        /// saved to the database before insertion. New children will not be
        /// related to this object in the database.
        /// </summary>
        /// <param name="_GreyFoxUserPreference">The GreyFoxUserPreference to insert into the database.</param>
        internal static int _insert(GreyFoxUserPreference greyFoxUserPreference)
        {
            OleDbConnection dbConnection = new OleDbConnection(connectionString);
            OleDbCommand    dbCommand    = new OleDbCommand();

            dbCommand.Connection  = dbConnection;
            dbCommand.CommandText = "INSERT INTO sysGlobal_UserPreferences (UserID," +
                                    "Name," +
                                    "Value) VALUES (" +
                                    "inUserID," +
                                    "inName," +
                                    "inValue);";

            fillParameters(dbCommand, greyFoxUserPreference);

            dbConnection.Open();
            dbCommand.ExecuteNonQuery();
            dbCommand.CommandText = "SELECT @@IDENTITY AS IDVal";
            int id = (int)dbCommand.ExecuteScalar();

            dbConnection.Close();
            // Store greyFoxUserPreference in cache.
            if (cacheEnabled)
            {
                cacheStore(greyFoxUserPreference);
            }
            return(id);
        }
Пример #2
0
        internal static int _update(GreyFoxUserPreference greyFoxUserPreference)
        {
            OleDbConnection dbConnection = new OleDbConnection(connectionString);
            OleDbCommand    dbCommand    = new OleDbCommand();

            dbCommand.Connection  = dbConnection;
            dbCommand.CommandText = "UPDATE sysGlobal_UserPreferences SET UserID=inUserID," +
                                    "Name=inName," +
                                    "Value=inValue WHERE GreyFoxUserPreferenceID=inGreyFoxUserPreferenceID";

            fillParameters(dbCommand, greyFoxUserPreference);

            dbCommand.Parameters.Add("inGreyFoxUserPreferenceID", OleDbType.Integer).Value = greyFoxUserPreference.iD;
            dbConnection.Open();

            // Abandon remaining updates if no rows have been updated by returning false immediately.
            if (dbCommand.ExecuteNonQuery() == 0)
            {
                return(-1);
            }

            dbConnection.Close();

            // Store greyFoxUserPreference in cache.
            if (cacheEnabled)
            {
                cacheStore(greyFoxUserPreference);
            }

            return(greyFoxUserPreference.iD);
        }
Пример #3
0
        /// <summary>
        /// Makes a deep copy of the current GreyFoxUserPreference.
        /// </summary>
        /// <returns> A new GreyFoxUserPreference object reflecting the cloned GreyFoxUserPreference object.</returns>
        /// <param name="isolation">Placeholders are used to isolate the GreyFoxUserPreference from its children.</param>
        public GreyFoxUserPreference Copy(bool isolation)
        {
            GreyFoxUserPreference greyFoxUserPreference = new GreyFoxUserPreference();

            CopyTo(greyFoxUserPreference, isolation);
            return(greyFoxUserPreference);
        }
Пример #4
0
        internal static int _update(GreyFoxUserPreference greyFoxUserPreference)
        {
            Database  database;
            DbCommand dbCommand;

            database = DatabaseFactory.CreateDatabase();

            dbCommand = database.GetSqlStringCommand("UPDATE sysGlobal_UserPreferences SET UserID=@UserID," +
                                                     "Name=@Name," +
                                                     "PrefValue=@PrefValue WHERE GreyFoxUserPreferenceID=@GreyFoxUserPreferenceID;");

            fillParameters(database, dbCommand, greyFoxUserPreference);
            database.AddInParameter(dbCommand, "GreyFoxUserPreferenceID", DbType.Int32, greyFoxUserPreference.iD);
            // Abandon remaining updates if no rows have been updated by returning false immediately.
            if (database.ExecuteNonQuery(dbCommand) == 0)
            {
                return(-1);
            }

            // Store greyFoxUserPreference in cache.
            if (cacheEnabled)
            {
                cacheStore(greyFoxUserPreference);
            }

            return(greyFoxUserPreference.iD);
        }
Пример #5
0
        public static GreyFoxUserPreference ParseFromReader(IDataReader r, int idOffset, int dataOffset)
        {
            GreyFoxUserPreference greyFoxUserPreference = new GreyFoxUserPreference();

            FillFromReader(greyFoxUserPreference, r, idOffset, dataOffset);
            return(greyFoxUserPreference);
        }
Пример #6
0
        /// <summary>
        /// Makes a deep copy of the current GreyFoxUserPreference.
        /// </summary>
        /// <returns> A new GreyFoxUserPreference object reflecting the cloned GreyFoxUserPreference object.</returns>
        public GreyFoxUserPreference Copy()
        {
            GreyFoxUserPreference greyFoxUserPreference = new GreyFoxUserPreference();

            CopyTo(greyFoxUserPreference);
            return(greyFoxUserPreference);
        }
Пример #7
0
        public static GreyFoxUserPreference NewPlaceHolder(int iD)
        {
            GreyFoxUserPreference greyFoxUserPreference = new GreyFoxUserPreference();

            greyFoxUserPreference.iD            = iD;
            greyFoxUserPreference.isPlaceHolder = true;
            greyFoxUserPreference.isSynced      = true;
            return(greyFoxUserPreference);
        }
Пример #8
0
        public bool Equals(GreyFoxUserPreference greyFoxUserPreference)
        {
            if (greyFoxUserPreference == null)
            {
                return(false);
            }

            return(this.iD == greyFoxUserPreference.iD);
        }
Пример #9
0
        /// <summary>
        /// Duplicates GreyFoxUserPreference object into a database; may or may not be the same database
        /// as the parent object.
        /// </summary>
        /// <returns> A new GreyFoxUserPreference object reflecting the replicated GreyFoxUserPreference object.</returns>
        public GreyFoxUserPreference Duplicate()
        {
            GreyFoxUserPreference clonedGreyFoxUserPreference = this.Clone();

            // Insert must be called after children are replicated!
            clonedGreyFoxUserPreference.iD       = GreyFoxUserPreferenceManager._insert(clonedGreyFoxUserPreference);
            clonedGreyFoxUserPreference.isSynced = true;
            return(clonedGreyFoxUserPreference);
        }
Пример #10
0
 private static void cacheStore(GreyFoxUserPreference greyFoxUserPreference)
 {
     CatchWebCache();
     if (_webCache == null)
     {
         return;
     }
     _webCache.Insert("GFX_GreyFoxUserPreference_" + greyFoxUserPreference.ID.ToString(), greyFoxUserPreference.Copy(true), null, DateTime.MaxValue, TimeSpan.FromSeconds(1800), CacheItemPriority.Normal, null);
 }
        public void Remove(GreyFoxUserPreference value)
        {
            OnCollectionChanged(EventArgs.Empty);
            int index = IndexOf(value);

            if (index == -1)
            {
                throw(new Exception("GreyFoxUserPreference not found in collection."));
            }
            RemoveAt(index);
        }
Пример #12
0
        /// <summary>
        /// Fills the {0} from a OleIDataReader.
        /// </summary>
        public static void FillFromReader(GreyFoxUserPreference greyFoxUserPreference, IDataReader r, int idOffset, int dataOffset)
        {
            greyFoxUserPreference.iD            = r.GetInt32(idOffset);
            greyFoxUserPreference.isSynced      = true;
            greyFoxUserPreference.isPlaceHolder = false;

            if (!r.IsDBNull(0 + dataOffset) && r.GetInt32(0 + dataOffset) > 0)
            {
                greyFoxUserPreference.user = GreyFoxUser.NewPlaceHolder(r.GetInt32(0 + dataOffset));
            }
            greyFoxUserPreference.name      = r.GetString(1 + dataOffset);
            greyFoxUserPreference.prefValue = r.GetString(2 + dataOffset);
        }
 public int IndexOf(GreyFoxUserPreference value)
 {
     lock (this)
     {
         for (int x = 0; x < count; x++)
         {
             if (GreyFoxUserPreferenceArray[x].Equals(value))
             {
                 return(x);
             }
         }
         return(-1);
     }
 }
Пример #14
0
        /// <summary>
        /// Inserts a GreyFoxUserPreference into the database. All children should have been
        /// saved to the database before insertion. New children will not be
        /// related to this object in the database.
        /// </summary>
        /// <param name="_GreyFoxUserPreference">The GreyFoxUserPreference to insert into the database.</param>
        internal static int _insert(GreyFoxUserPreference greyFoxUserPreference)
        {
            int       id;
            string    query;
            Database  database;
            DbCommand dbCommand;

            database = DatabaseFactory.CreateDatabase();

            query = "INSERT INTO sysGlobal_UserPreferences " +
                    "(" +
                    "UserID," +
                    "Name," +
                    "PrefValue) VALUES (" +
                    "@UserID," +
                    "@Name," +
                    "@PrefValue);";

            if (database.ConnectionStringWithoutCredentials.StartsWith("provider=microsoft.jet.oledb.4.0"))
            {
                // Microsoft Access
                // Connection must remain open for IDENTITY to return correct value,
                // therefore use the dbCommand object's Connection directly to control
                // connection state.
                dbCommand = database.GetSqlStringCommand(query);
                fillParameters(database, dbCommand, greyFoxUserPreference);
                dbCommand.Connection = database.CreateConnection();
                dbCommand.Connection.Open();
                dbCommand.ExecuteNonQuery();
                dbCommand.CommandText = "SELECT @@IDENTITY AS LastID";
                id = (int)dbCommand.ExecuteScalar();
                dbCommand.Connection.Close();
            }
            else
            {
                //// Microsoft SQL Server
                dbCommand = database.GetSqlStringCommand(query + " SELECT @LastID = SCOPE_IDENTITY();");
                fillParameters(database, dbCommand, greyFoxUserPreference);
                database.AddOutParameter(dbCommand, "@LastID", DbType.Int32, 10);
                database.ExecuteNonQuery(dbCommand);
                id = (int)dbCommand.Parameters["@LastID"].Value;
            }
            // Store greyFoxUserPreference in cache.
            if (cacheEnabled)
            {
                cacheStore(greyFoxUserPreference);
            }
            return(id);
        }
Пример #15
0
        /// <summary>
        /// Clones GreyFoxUserPreference object and clones child objects with cloning or replication.
        /// as the parent object.
        /// </summary>
        /// <returns> A new GreyFoxUserPreference object reflecting the replicated GreyFoxUserPreference object.</returns>
        public GreyFoxUserPreference Clone()
        {
            GreyFoxUserPreference clonedGreyFoxUserPreference = new GreyFoxUserPreference();

            clonedGreyFoxUserPreference.iD       = iD;
            clonedGreyFoxUserPreference.isSynced = isSynced;
            clonedGreyFoxUserPreference.name     = name;
            clonedGreyFoxUserPreference.value    = value;

            if (user != null)
            {
                clonedGreyFoxUserPreference.user = user;
            }

            return(clonedGreyFoxUserPreference);
        }
Пример #16
0
        private static void fillParameters(OleDbCommand command, GreyFoxUserPreference greyFoxUserPreference)
        {
            #region New Folder

            if (greyFoxUserPreference.user == null)
            {
                command.Parameters.Add("inUserID", OleDbType.Integer).Value = DBNull.Value;
            }
            else
            {
                command.Parameters.Add("inUserID", OleDbType.Integer).Value = greyFoxUserPreference.user.ID;
            }
            command.Parameters.Add("inName", OleDbType.VarChar).Value  = greyFoxUserPreference.name;
            command.Parameters.Add("inValue", OleDbType.VarChar).Value = greyFoxUserPreference.value;
            #endregion
        }
Пример #17
0
        internal static bool _fill(GreyFoxUserPreference greyFoxUserPreference)
        {
            // Clone item from cache.
            if (cacheEnabled)
            {
                object cachedObject = cacheFind(greyFoxUserPreference.iD);
                if (cachedObject != null)
                {
                    ((GreyFoxUserPreference)cachedObject).CopyTo(greyFoxUserPreference, true);
                    return(greyFoxUserPreference.isSynced);
                }
            }

            StringBuilder query;
            Database      database;
            DbCommand     dbCommand;

            query = new StringBuilder("SELECT ");
            query.Append(string.Join(",", InnerJoinFields));
            query.Append(" FROM sysGlobal_UserPreferences WHERE GreyFoxUserPreferenceID=");
            query.Append(greyFoxUserPreference.iD);
            query.Append(";");

            database  = DatabaseFactory.CreateDatabase();
            dbCommand = database.GetSqlStringCommand(query.ToString());
            IDataReader r = database.ExecuteReader(dbCommand);

            if (!r.Read())
            {
                throw(new Exception(string.Format("Cannot find GreyFoxUserPreferenceID '{0}'.",
                                                  greyFoxUserPreference.iD)));
            }

            FillFromReader(greyFoxUserPreference, r, 0, 1);

            // Microsoft DAAB still needs to have the reader closed.
            r.Close();

            // Store greyFoxUserPreference in cache.
            if (cacheEnabled)
            {
                cacheStore(greyFoxUserPreference);
            }

            return(true);
        }
Пример #18
0
        private static void fillParameters(Database database, DbCommand dbCommand, GreyFoxUserPreference greyFoxUserPreference)
        {
            #region New Folder

            if (greyFoxUserPreference.user == null)
            {
                addParameter(database, dbCommand, "@UserID", DbType.Int32, DBNull.Value);
            }
            else
            {
                addParameter(database, dbCommand, "@UserID", DbType.Int32, greyFoxUserPreference.user.ID);
            }
            addParameter(database, dbCommand, "@Name", DbType.String, greyFoxUserPreference.name);
            addParameter(database, dbCommand, "@PrefValue", DbType.String, greyFoxUserPreference.prefValue);

            #endregion
        }
 public int Add(GreyFoxUserPreference value)
 {
     OnCollectionChanged(EventArgs.Empty);
     lock (this)
     {
         count++;
         // Resize the array if the count is greater than the length
         // of the array.
         if (count > GreyFoxUserPreferenceArray.GetUpperBound(0) + 1)
         {
             GreyFoxUserPreference[] tempGreyFoxUserPreferenceArray = new GreyFoxUserPreference[count * 2];
             Array.Copy(GreyFoxUserPreferenceArray, tempGreyFoxUserPreferenceArray, count - 1);
             GreyFoxUserPreferenceArray = tempGreyFoxUserPreferenceArray;
         }
         GreyFoxUserPreferenceArray[count - 1] = value;
     }
     return(count - 1);
 }
Пример #20
0
        internal static bool _fill(GreyFoxUserPreference greyFoxUserPreference)
        {
            // Clone item from cache.
            if (cacheEnabled)
            {
                GreyFoxUserPreference cachedGreyFoxUserPreference = cacheFind(greyFoxUserPreference.iD);
                if (cachedGreyFoxUserPreference != null)
                {
                    cachedGreyFoxUserPreference.CopyTo(greyFoxUserPreference, true);
                    return(greyFoxUserPreference.isSynced);
                }
            }

            StringBuilder query = new StringBuilder("SELECT ");

            query.Append(string.Join(",", InnerJoinFields));
            query.Append(" FROM sysGlobal_UserPreferences WHERE GreyFoxUserPreferenceID=");
            query.Append(greyFoxUserPreference.iD);
            query.Append(";");

            OleDbConnection dbConnection = new OleDbConnection(connectionString);
            OleDbCommand    dbCommand    = new OleDbCommand(query.ToString(), dbConnection);

            dbConnection.Open();
            OleDbDataReader r = dbCommand.ExecuteReader(CommandBehavior.SingleRow);

            if (!r.Read())
            {
                throw(new Exception(string.Format("Cannot find GreyFoxUserPreferenceID '{0}'.",
                                                  greyFoxUserPreference.iD)));
            }

            FillFromReader(greyFoxUserPreference, r, 0, 1);

            r.Close();
            dbConnection.Close();
            // Store greyFoxUserPreference in cache.
            if (cacheEnabled)
            {
                cacheStore(greyFoxUserPreference);
            }
            return(true);
        }
Пример #21
0
 /// <summary>
 /// Deep copies the current GreyFoxUserPreference to another instance of GreyFoxUserPreference.
 /// </summary>
 /// <param name="GreyFoxUserPreference">The GreyFoxUserPreference to copy to.</param>
 /// <param name="isolation">Placeholders are used to isolate the GreyFoxUserPreference from its children.</param>
 public void CopyTo(GreyFoxUserPreference greyFoxUserPreference, bool isolation)
 {
     greyFoxUserPreference.iD            = iD;
     greyFoxUserPreference.isPlaceHolder = isPlaceHolder;
     greyFoxUserPreference.isSynced      = isSynced;
     if (user != null)
     {
         if (isolation)
         {
             greyFoxUserPreference.user = user.NewPlaceHolder();
         }
         else
         {
             greyFoxUserPreference.user = user.Copy(false);
         }
     }
     greyFoxUserPreference.name      = name;
     greyFoxUserPreference.prefValue = prefValue;
 }
Пример #22
0
        /// <summary>
        /// Fills the {0} from a OleDbDataReader.
        /// </summary>
        public static void FillFromReader(GreyFoxUserPreference greyFoxUserPreference, OleDbDataReader r, int idOffset, int dataOffset)
        {
            greyFoxUserPreference.iD            = r.GetInt32(idOffset);
            greyFoxUserPreference.isSynced      = true;
            greyFoxUserPreference.isPlaceHolder = false;

            //
            // Parse Children From Database
            //
            if (!r.IsDBNull(0 + dataOffset) && r.GetInt32(0 + dataOffset) > 0)
            {
                greyFoxUserPreference.user = GreyFoxUser.NewPlaceHolder(r.GetInt32(0 + dataOffset));
            }

            //
            // Parse Fields From Database
            //
            greyFoxUserPreference.name  = r.GetString(1 + dataOffset);
            greyFoxUserPreference.value = r.GetString(2 + dataOffset);
        }
 public void Insert(int index, GreyFoxUserPreference value)
 {
     OnCollectionChanged(EventArgs.Empty);
     lock (this)
     {
         count++;
         // Resize the array if the count is greater than the length
         // of the array.
         if (count > GreyFoxUserPreferenceArray.GetUpperBound(0) + 1)
         {
             GreyFoxUserPreference[] tempGreyFoxUserPreferenceArray = new GreyFoxUserPreference[count * 2];
             Array.Copy(GreyFoxUserPreferenceArray, tempGreyFoxUserPreferenceArray, count - 1);
             GreyFoxUserPreferenceArray = tempGreyFoxUserPreferenceArray;
         }
         for (int x = index + 1; x == count - 2; x++)
         {
             GreyFoxUserPreferenceArray[x] = GreyFoxUserPreferenceArray[x - 1];
         }
         GreyFoxUserPreferenceArray[index] = value;
     }
 }
 public bool Contains(GreyFoxUserPreference value)
 {
     return(IndexOf(value) != -1);
 }
Пример #25
0
 /// <summary>
 /// Compares the object's ID to another object's ID.
 /// </summary>
 public int CompareTo(GreyFoxUserPreference greyFoxUserPreference)
 {
     return(this.iD - greyFoxUserPreference.iD);
 }
Пример #26
0
        /// <summary>
        /// Compares the object's ID to another object's ID.
        /// </summary>
        int IComparable.CompareTo(object obj)
        {
            GreyFoxUserPreference greyFoxUserPreference = (GreyFoxUserPreference)obj;

            return(this.iD - greyFoxUserPreference.iD);
        }
Пример #27
0
 /// <summary>
 /// Deep copies the current GreyFoxUserPreference to another instance of GreyFoxUserPreference.
 /// This method does not provide isolated copies; use overriden method for this feature.
 /// </summary>
 /// <param name="GreyFoxUserPreference">The GreyFoxUserPreference to copy to.</param>
 public void CopyTo(GreyFoxUserPreference greyFoxUserPreference)
 {
     CopyTo(greyFoxUserPreference, false);
 }
Пример #28
0
        private static void cacheStore(GreyFoxUserPreference greyFoxUserPreference)
        {
            CacheManager cache = CacheFactory.GetCacheManager();

            cache.Add("sysGlobal_UserPreferences_" + greyFoxUserPreference.iD.ToString(), greyFoxUserPreference);
        }
Пример #29
0
        public GreyFoxUserPreferenceCollection GetCollection(int topCount, string whereClause, string sortClause, params GreyFoxUserPreferenceFlags[] optionFlags)
        {
            StringBuilder query;
            Database      database;
            DbCommand     dbCommand;
            IDataReader   r;
            GreyFoxUserPreferenceCollection greyFoxUserPreferenceCollection;

            int innerJoinOffset;

            query = new StringBuilder("SELECT ");

            if (topCount > 0)
            {
                query.Append("TOP ");
                query.Append(topCount);
                query.Append(" ");
            }

            foreach (string columnName in InnerJoinFields)
            {
                query.Append("GreyFoxUserPreference.");
                query.Append(columnName);
                query.Append(",");
            }

            innerJoinOffset = InnerJoinFields.GetUpperBound(0) + 1;
            int userOffset        = -1;
            int userContactOffset = -1;

            //
            // Append Option Flag Fields
            //
            if (optionFlags != null)
            {
                for (int x = 0; x < optionFlags.Length; x++)
                {
                    switch (optionFlags[x])
                    {
                    case GreyFoxUserPreferenceFlags.User:
                        for (int i = 0; i <= GreyFoxUserManager.InnerJoinFields.GetUpperBound(0); i++)
                        {
                            query.Append("User.");
                            query.Append(GreyFoxUserManager.InnerJoinFields[i]);
                            query.Append(",");
                        }
                        userOffset      = innerJoinOffset;
                        innerJoinOffset = userOffset + GreyFoxUserManager.InnerJoinFields.GetUpperBound(0) + 1;
                        break;

                    case GreyFoxUserPreferenceFlags.UserContact:
                        for (int i = 0; i <= GreyFoxContactManager.InnerJoinFields.GetUpperBound(0); i++)
                        {
                            query.Append("User_Contact.");
                            query.Append(GreyFoxContactManager.InnerJoinFields[i]);
                            query.Append(",");
                        }
                        userContactOffset = innerJoinOffset;
                        innerJoinOffset   = userContactOffset + GreyFoxContactManager.InnerJoinFields.GetUpperBound(0) + 1;
                        break;
                    }
                }
            }

            //
            // Remove trailing comma
            //
            query.Length--;
            if (optionFlags != null)
            {
                query.Append(" FROM ");

                //
                // Start INNER JOIN expressions
                //
                for (int x = 0; x < optionFlags.Length; x++)
                {
                    query.Append("(");
                }

                query.Append("sysGlobal_UserPreferences AS GreyFoxUserPreference");
            }
            else
            {
                query.Append(" FROM sysGlobal_UserPreferences AS GreyFoxUserPreference");
            }
            //
            // Finish INNER JOIN expressions
            //
            if (optionFlags != null)
            {
                for (int x = 0; x < optionFlags.Length; x++)
                {
                    switch (optionFlags[x])
                    {
                    case GreyFoxUserPreferenceFlags.User:
                        query.Append(" LEFT JOIN sysGlobal_Users AS User ON GreyFoxUserPreference.UserID = User.GreyFoxUserID)");
                        break;

                    case GreyFoxUserPreferenceFlags.UserContact:
                        query.Append(" LEFT JOIN sysGlobal_Contacts AS User_Contact ON User.ContactID = User_Contact.GreyFoxContactID)");
                        break;
                    }
                }
            }

            //
            // Render where clause
            //
            if (whereClause != string.Empty)
            {
                query.Append(" WHERE ");
                query.Append(whereClause);
            }

            //
            // Render sort clause
            //
            if (sortClause != string.Empty)
            {
                query.Append(" ORDER BY ");
                query.Append(sortClause);
            }

            //
            // Render final semicolon
            //
            query.Append(";");
            database  = DatabaseFactory.CreateDatabase();
            dbCommand = database.GetSqlStringCommand(query.ToString());
                        #if DEBUG
            try
            {
                r = database.ExecuteReader(dbCommand);
            }
            catch (Exception e)
            {
                string msg = e.Message;
                throw(new Exception(msg + " --- Query: " + query.ToString()));
            }
                        #else
            r = database.ExecuteReader(dbCommand);
                        #endif

            greyFoxUserPreferenceCollection = new GreyFoxUserPreferenceCollection();

            while (r.Read())
            {
                GreyFoxUserPreference greyFoxUserPreference = ParseFromReader(r, 0, 1);

                // Fill User
                if (userOffset != -1 && !r.IsDBNull(userOffset))
                {
                    GreyFoxUserManager.FillFromReader(greyFoxUserPreference.user, r, userOffset, userOffset + 1);

                    // Fill
                    if (userContactOffset != -1 && !r.IsDBNull(userContactOffset))
                    {
                        GreyFoxContactManager.FillFromReader(greyFoxUserPreference.user.Contact, "sysGlobal_Contacts", r, userContactOffset, userContactOffset + 1);
                    }
                }

                greyFoxUserPreferenceCollection.Add(greyFoxUserPreference);
            }

            // Microsoft DAAB still needs to close readers.
            r.Close();

            return(greyFoxUserPreferenceCollection);
        }