/// <summary>
        /// Merges current list with the list of lists specified in the parameter.
        /// </summary>
        /// <param name="lists">Lists to merge with.</param>
        /// <returns>Merged list.</returns>
        public PFListEx <T> Merge(PFListEx <PFListEx <T> > lists)
        {
            PFListEx <T> mergedList = new PFListEx <T>();

            if (lists == null)
            {
                return(mergedList);
            }

            foreach (T item in this)
            {
                mergedList.Add(item);
            }

            for (int listInx = 0; listInx < lists.Count; listInx++)
            {
                PFListEx <T> tempList = lists[listInx];
                if (tempList != null)
                {
                    foreach (T item in tempList)
                    {
                        mergedList.Add(item);
                    }
                }
            }

            return(mergedList);
        }
Example #2
0
        /// <summary>
        /// Merges current list with the list of lists specified in the parameter.
        /// </summary>
        /// <param name="lists">Lists to merge with.</param>
        /// <returns>Merged list.</returns>
        public PFKeyValueListEx <TKey, TValue> Merge(PFListEx <PFKeyValueListEx <TKey, TValue> > lists)
        {
            PFKeyValueListEx <TKey, TValue> mergedList = new PFKeyValueListEx <TKey, TValue>();

            if (lists == null)
            {
                return(mergedList);
            }

            foreach (pfKeyValuePair <TKey, TValue> item in this)
            {
                mergedList.Add(item);
            }

            for (int listInx = 0; listInx < lists.Count; listInx++)
            {
                PFKeyValueListEx <TKey, TValue> tempList = lists[listInx];
                if (tempList != null)
                {
                    foreach (pfKeyValuePair <TKey, TValue> item in tempList)
                    {
                        mergedList.Add(item);
                    }
                }
            }

            return(mergedList);
        }
        /// <summary>
        /// Creates and initializes an instance of the class by loading a serialized version of the instance from a database record.
        /// </summary>
        /// <param name="connectionString">Connection parameters for the database.</param>
        /// <param name="listName">Name of the list in the database.</param>
        /// <returns>PFListEx object.</returns>
        public static PFListEx <T> LoadFromDatabase(string connectionString, string listName)
        {
            string       sqlStmt            = string.Empty;
            PFListEx <T> objectInstance     = null;
            PFListEx <T> tempObjectInstance = new PFListEx <T>();
            PFDatabase   db             = new PFDatabase(DatabasePlatform.SQLServerCE35);
            DbDataReader rdr            = null;
            string       pfKeyListExXml = string.Empty;

            db.ConnectionString = connectionString;
            db.OpenConnection();

            sqlStmt = tempObjectInstance._listsSelectSQL.Replace("<listname>", listName);
            rdr     = db.RunQueryDataReader(sqlStmt, CommandType.Text);
            while (rdr.Read())
            {
                pfKeyListExXml = rdr.GetString(0);
                objectInstance = PFListEx <T> .LoadFromXmlString(pfKeyListExXml);

                break;  //should be only one record
            }

            db.CloseConnection();
            db = null;


            return(objectInstance);
        }
Example #4
0
        /// <summary>
        /// Converts current instance of a PFKeyValueListEx object to PFListEx object.
        /// </summary>
        /// <returns>PFListEx object.</returns>
        public PFListEx <pfKeyValuePair <TKey, TValue> > ConvertThisToPFListEx()
        {
            PFListEx <pfKeyValuePair <TKey, TValue> > list = new PFListEx <pfKeyValuePair <TKey, TValue> >();
            pfKeyValuePair <TKey, TValue>             kvp  = default(pfKeyValuePair <TKey, TValue>);

            if (this.Count > 0)
            {
                this.SetToBOF();
                kvp = this.FirstItem;
                while (this.EOF == false)
                {
                    list.Add(new pfKeyValuePair <TKey, TValue>(kvp.Key, kvp.Value));
                    kvp = this.NextItem;
                }
            }

            return(list);
        }
        /// <summary>
        /// Merges current list with the list specified in the parameter.
        /// </summary>
        /// <param name="list">List to merge with.</param>
        /// <returns>Merged list.</returns>
        public PFListEx <T> Merge(PFListEx <T> list)
        {
            PFListEx <T> mergedList = new PFListEx <T>();

            if (list == null)
            {
                return(mergedList);
            }

            foreach (T item in this)
            {
                mergedList.Add(item);
            }

            foreach (T item in list)
            {
                mergedList.Add(item);
            }

            return(mergedList);
        }
Example #6
0
        /// <summary>
        /// Routine that concatenates two or more lists into one list.
        /// </summary>
        /// <param name="lists">List of list objects to be concatenated.</param>
        /// <returns>Concatenated list.</returns>
        public static PFKeyValueListEx <TKey, TValue> ConcatenateLists(PFListEx <PFKeyValueListEx <TKey, TValue> > lists)
        {
            PFKeyValueListEx <TKey, TValue> concatenatedList = new PFKeyValueListEx <TKey, TValue>();

            if (lists == null)
            {
                return(concatenatedList);
            }

            for (int listInx = 0; listInx < lists.Count; listInx++)
            {
                PFKeyValueListEx <TKey, TValue> tempList = lists[listInx];
                if (tempList != null)
                {
                    foreach (pfKeyValuePair <TKey, TValue> item in tempList)
                    {
                        concatenatedList.Add(item);
                    }
                }
            }

            return(concatenatedList);
        }
        /// <summary>
        /// Routine that concatenates two or more lists into one list.
        /// </summary>
        /// <param name="lists">List of list objects to be concatenated.</param>
        /// <returns>Concatenated list.</returns>
        public static PFListEx <T> ConcatenateLists(PFListEx <PFListEx <T> > lists)
        {
            PFListEx <T> concatenatedList = new PFListEx <T>();

            if (lists == null)
            {
                return(concatenatedList);
            }

            for (int listInx = 0; listInx < lists.Count; listInx++)
            {
                PFListEx <T> tempList = lists[listInx];
                if (tempList != null)
                {
                    foreach (T item in tempList)
                    {
                        concatenatedList.Add(item);
                    }
                }
            }

            return(concatenatedList);
        }