Esempio n. 1
0
        public YariMediaKeywordCollection Clone()
        {
            YariMediaKeywordCollection clonedYariMediaKeyword = new YariMediaKeywordCollection(count);

            lock (this)
            {
                foreach (YariMediaKeyword item in this)
                {
                    clonedYariMediaKeyword.Add(item);
                }
            }
            return(clonedYariMediaKeyword);
        }
Esempio n. 2
0
        /// <summary>
        /// Makes a deep copy of the current YariMediaKeyword.
        /// </summary>
        /// <param name="isolation">Placeholders are used to isolate the
        /// items in the YariMediaKeywordCollection from their children.</param>
        public YariMediaKeywordCollection Copy(bool isolated)
        {
            YariMediaKeywordCollection isolatedCollection = new YariMediaKeywordCollection(count);

            lock (this)
            {
                if (isolated)
                {
                    for (int i = 0; i < count; i++)
                    {
                        isolatedCollection.Add(YariMediaKeywordArray[i].NewPlaceHolder());
                    }
                }
                else
                {
                    for (int i = 0; i < count; i++)
                    {
                        isolatedCollection.Add(YariMediaKeywordArray[i].Copy());
                    }
                }
            }
            return(isolatedCollection);
        }
Esempio n. 3
0
        //--- Begin Custom Code ---

        public void SetKeywords(string keywordString)
        {
            if (keywords == null)
            {
                keywords = new YariMediaKeywordCollection();
            }
            else
            {
                keywords.Clear();
            }

            string[] keywordArray = keywordString.Split(';');

            YariMediaKeywordManager m = new YariMediaKeywordManager();

            for (int x = 0; x < keywordArray.Length; x++)
            {
                keywords.Add(m.FindByKeyword(keywordArray[x], true));
            }
        }
Esempio n. 4
0
        public YariMediaKeywordCollection GetCollection(int topCount, string whereClause, string sortClause)
        {
            StringBuilder query;
            Database      database;
            DbCommand     dbCommand;
            IDataReader   r;
            YariMediaKeywordCollection yariMediaKeywordCollection;


            query = new StringBuilder("SELECT ");

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

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

            //
            // Remove trailing comma
            //
            query.Length--;
            query.Append(" FROM kitYari_MediaKeywords ");
            //
            // 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

            yariMediaKeywordCollection = new YariMediaKeywordCollection();

            while (r.Read())
            {
                YariMediaKeyword yariMediaKeyword = ParseFromReader(r, 0, 1);

                yariMediaKeywordCollection.Add(yariMediaKeyword);
            }

            return(yariMediaKeywordCollection);
        }