Ejemplo n.º 1
0
        public int GetHitCount()
        {
            // TODO: Get hit count on this clip

            DbContentHitManager    hm   = new DbContentHitManager();
            DbContentHitCollection hits = hm.GetCollection("RequestContentID=" + this.ID.ToString(), "RequestDate", null);

            return(hits.Count);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Duplicates DbContentHit object into a database; may or may not be the same database
        /// as the parent object.
        /// </summary>
        /// <returns> A new DbContentHit object reflecting the replicated DbContentHit object.</returns>
        public DbContentHit Duplicate()
        {
            DbContentHit clonedDbContentHit = this.Clone();

            // Insert must be called after children are replicated!
            clonedDbContentHit.iD       = DbContentHitManager._insert(clonedDbContentHit);
            clonedDbContentHit.isSynced = true;
            return(clonedDbContentHit);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Ensures that the object's fields and children are
        /// pre-loaded before any updates or reads.
        /// </summary>
        public void EnsurePreLoad()
        {
            if (!isPlaceHolder)
            {
                return;
            }

            DbContentHitManager._fill(this);
            isPlaceHolder = false;
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Saves the DbContentHit object state to the database.
        /// </summary>
        public int Save()
        {
            if (isSynced)
            {
                return(iD);
            }

            if (iD == -1)
            {
                throw (new Exception("Invalid record; cannot be saved."));
            }
            if (iD == 0)
            {
                iD = DbContentHitManager._insert(this);
            }
            else
            {
                DbContentHitManager._update(this);
            }
            isSynced = iD != -1;
            return(iD);
        }
Ejemplo n.º 5
0
 /// <summary>
 /// Overwrites and existing DbContentHit object in the database.
 /// </summary>
 public void Overwrite(int id)
 {
     iD = id;
     DbContentHitManager._update(this);
     isSynced = true;
 }
Ejemplo n.º 6
0
 public void Delete()
 {
     DbContentHitManager._delete(this.iD);
 }
Ejemplo n.º 7
0
 public DbContentHit(int id)
 {
     this.iD  = id;
     isSynced = DbContentHitManager._fill(this);
 }
Ejemplo n.º 8
0
 public void Delete()
 {
     DbContentHitManager._delete(this.iD);
     this.iD  = 0;
     isSynced = false;
 }