Esempio n. 1
0
 public int IndexOf(DbContentClip value)
 {
     lock (this)
     {
         for (int x = 0; x < count; x++)
         {
             if (DbContentClipArray[x].Equals(value))
             {
                 return(x);
             }
         }
         return(-1);
     }
 }
Esempio n. 2
0
 /// <summary>
 /// Ensures that the index and object array are sized correctly
 /// for additions. This method should be protected by locks
 /// issued by calling methods.
 /// </summary>
 private void ensureArrays()
 {
     if (count > dbContentClipArray.GetUpperBound(0) + 1)
     {
         DbContentClip[] tempDbContentClipArray  = new DbContentClip[count * 2];
         DateTime[]      tempTimeStamps          = new DateTime[count * 2];
         DateTime[]      tempAbsoluteExpirations = new DateTime[count * 2];
         TimeSpan[]      tempSlidingExpirations  = new TimeSpan[count * 2];
         Array.Copy(dbContentClipArray, tempDbContentClipArray, count - 1);
         Array.Copy(timeStamps, tempTimeStamps, count - 1);
         Array.Copy(absoluteExpirations, tempAbsoluteExpirations, count - 1);
         Array.Copy(slidingExpirations, tempSlidingExpirations, count - 1);
         dbContentClipArray  = tempDbContentClipArray;
         timeStamps          = tempTimeStamps;
         absoluteExpirations = tempAbsoluteExpirations;
         slidingExpirations  = tempSlidingExpirations;
     }
 }
Esempio n. 3
0
 public int Add(DbContentClip value)
 {
     OnCollectionChanged(EventArgs.Empty);
     lock (this)
     {
         count++;
         // Resize the array if the count is greater than the length
         // of the array.
         if (count > DbContentClipArray.GetUpperBound(0) + 1)
         {
             DbContentClip[] tempDbContentClipArray = new DbContentClip[count * 2];
             Array.Copy(DbContentClipArray, tempDbContentClipArray, count - 1);
             DbContentClipArray = tempDbContentClipArray;
         }
         DbContentClipArray[count - 1] = value;
     }
     return(count - 1);
 }
Esempio n. 4
0
        public int Insert(DbContentClip clip, bool ApplyFilter)
        {
            if (clip.isSynced)
            {
                throw(new ContentManagerException("Clip is already synchronized.", 923));
            }

            if (ApplyFilter)
            {
                ApplySqlFilter(clip);
            }

            StringBuilder s = new StringBuilder();

            s.AppendFormat("INSERT INTO {0} ", dbTableName);
            s.Append("(Title, Subtitle, Description, AuthorID, OwnerID, ReviewerRoleID, " +
                     "EditorRoleID, PublisherRoleID, CreateDate, ModifyDate, PressDate, ExpireDate, " +
                     "ArchiveDate, ContentStatus, ArchiveCatalogID, ScanDate, ContentString, ContentType, " +
                     "HitCounterType, TrackChangesType) VALUES ");
            s.AppendFormat("('{0}',", clip.title);
            s.AppendFormat("'{0}',", clip.subtitle);
            s.AppendFormat("'{0}',", clip.description);
            s.AppendFormat("{0},", clip.authorID);
            s.AppendFormat("{0},", clip.ownerID);
            s.AppendFormat("{0},", clip.reviewerRoleID);
            s.AppendFormat("{0},", clip.editorRoleID);
            s.AppendFormat("{0},", clip.publisherRoleID);

            s.AppendFormat("'{0}',", clip.createDate.ToString());
            s.AppendFormat("'{0}',", clip.modifyDate.ToString());
            s.AppendFormat("'{0}',", clip.pressDate.ToString());
            s.AppendFormat("'{0}',", clip.expireDate.ToString());
            s.AppendFormat("'{0}',", clip.archiveDate.ToString());

            s.AppendFormat("{0},", (byte)clip.contentStatus);
            s.AppendFormat("{0},", clip.archiveCatalogID);
            s.AppendFormat("'{0}',", clip.scanDate.ToString());                         // ScanDate
            s.AppendFormat("'{0}',", clip.contentString);
            s.AppendFormat("{0},", (byte)clip.contentType);
            s.AppendFormat("{0},", (byte)clip.hitCounterType);
            s.AppendFormat("{0});", (byte)clip.trackChangesType);

            return(runOleDbIdentityCommand(s.ToString()));
        }
Esempio n. 5
0
 public void CheckedAdd(DbContentClip dbContentClip, TimeSpan slidingExpiration)
 {
     lock (this)
     {
         int i = binarySearch(dbContentClip.iD);
         if (i != -1)
         {
             dbContentClipArray[i]  = dbContentClip;
             absoluteExpirations[i] = DateTime.Now.Add(slidingExpiration);  // Expires
             slidingExpirations[i]  = slidingExpiration;                    // Never slides
             return;
         }
         count++;
         ensureArrays();
         dbContentClipArray[count - 1]  = dbContentClip;
         timeStamps[count - 1]          = DateTime.Now;
         absoluteExpirations[count - 1] = DateTime.Now.Add(slidingExpiration); // Expires
         slidingExpirations[count - 1]  = slidingExpiration;                   // Never slides
         quickSort(0, count - 1);
     }
 }
Esempio n. 6
0
        /// <summary>
        /// Fills the {0} from a OleIDataReader.
        /// </summary>
        public static void FillFromReader(DbContentHit dbContentHit, IDataReader r, int idOffset, int dataOffset)
        {
            dbContentHit.iD            = r.GetInt32(idOffset);
            dbContentHit.isSynced      = true;
            dbContentHit.isPlaceHolder = false;

            if (!r.IsDBNull(0 + dataOffset) && r.GetInt32(0 + dataOffset) > 0)
            {
                dbContentHit.user = GreyFoxUser.NewPlaceHolder(r.GetInt32(0 + dataOffset));
            }
            dbContentHit.userAgent       = r.GetString(1 + dataOffset);
            dbContentHit.userHostAddress = r.GetString(2 + dataOffset);
            dbContentHit.userHostName    = r.GetString(3 + dataOffset);
            dbContentHit.requestDate     = r.GetDateTime(4 + dataOffset);
            dbContentHit.requestReferrer = r.GetString(5 + dataOffset);
            if (!r.IsDBNull(6 + dataOffset) && r.GetInt32(6 + dataOffset) > 0)
            {
                dbContentHit.requestContent = DbContentClip.NewPlaceHolder(r.GetInt32(6 + dataOffset));
            }
            dbContentHit.isUnique = r.GetBoolean(7 + dataOffset);
        }
Esempio n. 7
0
 public void Insert(int index, DbContentClip value)
 {
     OnCollectionChanged(EventArgs.Empty);
     lock (this)
     {
         count++;
         // Resize the array if the count is greater than the length
         // of the array.
         if (count > DbContentClipArray.GetUpperBound(0) + 1)
         {
             DbContentClip[] tempDbContentClipArray = new DbContentClip[count * 2];
             Array.Copy(DbContentClipArray, tempDbContentClipArray, count - 1);
             DbContentClipArray = tempDbContentClipArray;
         }
         for (int x = index + 1; x == count - 2; x++)
         {
             DbContentClipArray[x] = DbContentClipArray[x - 1];
         }
         DbContentClipArray[index] = value;
     }
 }
Esempio n. 8
0
        public int Update(DbContentClip clip, bool ApplyFilter)
        {
            if (ApplyFilter)
            {
                ApplySqlFilter(clip);
            }

            StringBuilder s = new StringBuilder();

            s.AppendFormat("UPDATE {0} SET ", dbTableName);
            s.AppendFormat("Title='{0}',", clip.title);
            s.AppendFormat("Subtitle='{0}',", clip.subtitle);
            s.AppendFormat("Description='{0}',", clip.description);
            s.AppendFormat("AuthorID={0},", clip.authorID);
            s.AppendFormat("OwnerID={0},", clip.ownerID);
            s.AppendFormat("ReviewerRoleID={0},", clip.reviewerRoleID);
            s.AppendFormat("EditorRoleID={0},", clip.editorRoleID);
            s.AppendFormat("PublisherRoleID={0},", clip.publisherRoleID);

            s.AppendFormat("CreateDate='{0}',", clip.createDate.ToString());
            s.AppendFormat("ModifyDate='{0}',", clip.modifyDate.ToString());
            s.AppendFormat("PressDate='{0}',", clip.pressDate.ToString());
            s.AppendFormat("ExpireDate='{0}',", clip.expireDate.ToString());
            s.AppendFormat("ArchiveDate='{0}',", clip.archiveDate.ToString());

            s.AppendFormat("ContentStatus={0},", (byte)clip.contentStatus);
            s.AppendFormat("ArchiveCatalogID={0},", clip.archiveCatalogID);
            s.AppendFormat("ScanDate='{0}',", clip.scanDate.ToString());                        // ScanDate
            s.AppendFormat("ContentString='{0}',", clip.contentString);
            s.AppendFormat("ContentType={0},", (byte)clip.contentType);
            s.AppendFormat("HitCounterType={0},", (byte)clip.hitCounterType);
            s.AppendFormat("TrackChangesType={0} ", (byte)clip.trackChangesType);
            s.AppendFormat("WHERE ClipID='{0}';", clip.ID);

            return(runOleDbCommand(s.ToString()));
        }
Esempio n. 9
0
//		private static readonly string _createInterCatalogXRef = "CREATE TABLE kitCms_InterCatalogXRef" +
//			"(XRefID COUNTER(1,1) CONSTRAINT XRefIDKey PRIMARY KEY, " +
//			"OrigCatalogID LONG, " +
//			"OrigClipID LONG, " +
//			"TargetCatalogID LONG, " +
//			"TargetClipID LONG)";

        public DbContentClip PrepareNewClip(int authorID, int ownerID, string title)
        {
            if (!sync)
            {
                throw(new ContentManagerException("Catalog is not synchronized, cannot prepare a new clip.", 114));
            }

            DbContentClip clip = new DbContentClip();

            clip.iD       = 0;
            clip.isSynced = false;

            clip.title           = title;
            clip.subtitle        = string.Empty;
            clip.description     = string.Empty;
            clip.authorID        = authorID;
            clip.ownerID         = ownerID;
            clip.reviewerRoleID  = reviewerRoleID;
            clip.editorRoleID    = editorRoleID;
            clip.publisherRoleID = publisherRoleID;
            clip.createDate      = DateTime.Now.ToUniversalTime();
            clip.modifyDate      = DateTime.Now.ToUniversalTime();

            if (pressDate != DateTime.MinValue)
            {
                clip.pressDate = pressDate;
            }
            else
            {
                clip.pressDate = DateTime.Now.ToUniversalTime().Add(pressTime);
            }

            if (expireDate != DateTime.MinValue)
            {
                clip.expireDate = expireDate;
            }
            else
            {
                clip.expireDate = DateTime.Now.ToUniversalTime().Add(expireTime);
            }

            if (archiveDate != DateTime.MinValue)
            {
                clip.archiveDate = archiveDate;
            }
            else
            {
                clip.archiveDate = DateTime.Now.ToUniversalTime().Add(archiveTime);
            }

            clip.contentStatus = ContentStatusCode.Authoring;

            clip.archiveCatalogID    = archiveCatalogID;
            clip.archiveOnExpiration = archiveOnExpiration;
            clip.scanDate            = DateTime.MinValue;
            clip.contentString       = string.Empty;
            clip.contentType         = contentType;
            clip.trackChangesType    = trackChangesType;
            clip.hitCounterType      = hitCounterType;

            return(clip);
        }
Esempio n. 10
0
        /// <summary>
        /// Deep copies the current DbContentClip to another instance of DbContentClip.
        /// </summary>
        /// <param name="DbContentClip">The DbContentClip to copy to.</param>
        /// <param name="isolation">Placeholders are used to isolate the DbContentClip from its children.</param>
        public void CopyTo(DbContentClip dbContentClip, bool isolation)
        {
            dbContentClip.iD                = iD;
            dbContentClip.isPlaceHolder     = isPlaceHolder;
            dbContentClip.isSynced          = isSynced;
            dbContentClip.createDate        = createDate;
            dbContentClip.modifyDate        = modifyDate;
            dbContentClip.title             = title;
            dbContentClip.description       = description;
            dbContentClip.keywords          = keywords;
            dbContentClip.icon              = icon;
            dbContentClip.body              = body;
            dbContentClip.publishDate       = publishDate;
            dbContentClip.expirationDate    = expirationDate;
            dbContentClip.archiveDate       = archiveDate;
            dbContentClip.priority          = priority;
            dbContentClip.sortOrder         = sortOrder;
            dbContentClip.commentsEnabled   = commentsEnabled;
            dbContentClip.notifyOnComments  = notifyOnComments;
            dbContentClip.overrideUrl       = overrideUrl;
            dbContentClip.menuLabel         = menuLabel;
            dbContentClip.menuTooltip       = menuTooltip;
            dbContentClip.menuEnabled       = menuEnabled;
            dbContentClip.menuOrder         = menuOrder;
            dbContentClip.menuLeftIcon      = menuLeftIcon;
            dbContentClip.menuLeftIconOver  = menuLeftIconOver;
            dbContentClip.menuRightIcon     = menuRightIcon;
            dbContentClip.menuRightIconOver = menuRightIconOver;
            dbContentClip.menuBreak         = menuBreak;

            if (status != null)
            {
                if (isolation)
                {
                    dbContentClip.status = status.NewPlaceHolder();
                }
                else
                {
                    dbContentClip.status = status.Copy(false);
                }
            }
            if (parentCatalog != null)
            {
                if (isolation)
                {
                    dbContentClip.parentCatalog = parentCatalog.NewPlaceHolder();
                }
                else
                {
                    dbContentClip.parentCatalog = parentCatalog.Copy(false);
                }
            }
            if (rating != null)
            {
                if (isolation)
                {
                    dbContentClip.rating = rating.NewPlaceHolder();
                }
                else
                {
                    dbContentClip.rating = rating.Copy(false);
                }
            }
            if (references != null)
            {
                if (isolation)
                {
                    dbContentClip.references = references.Copy(true);
                }
                else
                {
                    dbContentClip.references = references.Copy(false);
                }
            }
            if (workingDraft != null)
            {
                if (isolation)
                {
                    dbContentClip.workingDraft = workingDraft.NewPlaceHolder();
                }
                else
                {
                    dbContentClip.workingDraft = workingDraft.Copy(false);
                }
            }
            if (authors != null)
            {
                if (isolation)
                {
                    dbContentClip.authors = authors.Copy(true);
                }
                else
                {
                    dbContentClip.authors = authors.Copy(false);
                }
            }
            if (editors != null)
            {
                if (isolation)
                {
                    dbContentClip.editors = editors.Copy(true);
                }
                else
                {
                    dbContentClip.editors = editors.Copy(false);
                }
            }
        }
Esempio n. 11
0
 /// <summary>
 /// Deep copies the current DbContentClip to another instance of DbContentClip.
 /// This method does not provide isolated copies; use overriden method for this feature.
 /// </summary>
 /// <param name="DbContentClip">The DbContentClip to copy to.</param>
 public void CopyTo(DbContentClip dbContentClip)
 {
     CopyTo(dbContentClip, false);
 }
Esempio n. 12
0
        /// <summary>
        /// Clones DbContentClip object and clones child objects with cloning or replication.
        /// as the parent object.
        /// </summary>
        /// <returns> A new DbContentClip object reflecting the replicated DbContentClip object.</returns>
        public DbContentClip Clone()
        {
            DbContentClip clonedDbContentClip = new DbContentClip();

            clonedDbContentClip.iD                = iD;
            clonedDbContentClip.isSynced          = isSynced;
            clonedDbContentClip.createDate        = createDate;
            clonedDbContentClip.modifyDate        = modifyDate;
            clonedDbContentClip.title             = title;
            clonedDbContentClip.description       = description;
            clonedDbContentClip.keywords          = keywords;
            clonedDbContentClip.icon              = icon;
            clonedDbContentClip.body              = body;
            clonedDbContentClip.publishDate       = publishDate;
            clonedDbContentClip.expirationDate    = expirationDate;
            clonedDbContentClip.archiveDate       = archiveDate;
            clonedDbContentClip.priority          = priority;
            clonedDbContentClip.sortOrder         = sortOrder;
            clonedDbContentClip.commentsEnabled   = commentsEnabled;
            clonedDbContentClip.notifyOnComments  = notifyOnComments;
            clonedDbContentClip.overrideUrl       = overrideUrl;
            clonedDbContentClip.menuLabel         = menuLabel;
            clonedDbContentClip.menuTooltip       = menuTooltip;
            clonedDbContentClip.menuEnabled       = menuEnabled;
            clonedDbContentClip.menuOrder         = menuOrder;
            clonedDbContentClip.menuLeftIcon      = menuLeftIcon;
            clonedDbContentClip.menuLeftIconOver  = menuLeftIconOver;
            clonedDbContentClip.menuRightIcon     = menuRightIcon;
            clonedDbContentClip.menuRightIconOver = menuRightIconOver;
            clonedDbContentClip.menuBreak         = menuBreak;


            if (status != null)
            {
                clonedDbContentClip.status = status;
            }

            if (parentCatalog != null)
            {
                clonedDbContentClip.parentCatalog = parentCatalog;
            }

            if (rating != null)
            {
                clonedDbContentClip.rating = rating;
            }

            if (references != null)
            {
                clonedDbContentClip.references = references.Clone();
            }

            if (workingDraft != null)
            {
                clonedDbContentClip.workingDraft = workingDraft;
            }

            if (authors != null)
            {
                clonedDbContentClip.authors = authors.Clone();
            }

            if (editors != null)
            {
                clonedDbContentClip.editors = editors.Clone();
            }

            return(clonedDbContentClip);
        }
Esempio n. 13
0
 /// <summary>
 /// Compares the object's ID to another object's ID.
 /// </summary>
 public int CompareTo(DbContentClip dbContentClip)
 {
     return(this.iD - dbContentClip.iD);
 }
Esempio n. 14
0
        /// <summary>
        /// Compares the object's ID to another object's ID.
        /// </summary>
        int IComparable.CompareTo(object obj)
        {
            DbContentClip dbContentClip = (DbContentClip)obj;

            return(this.iD - dbContentClip.iD);
        }
Esempio n. 15
0
 public bool Contains(DbContentClip value)
 {
     return(IndexOf(value) != -1);
 }