Exemple #1
0
        /// <summary>
        /// Persists a new instance of TaskQueue. Returns true on success.
        /// </summary>
        /// <returns></returns>
        private bool Create()
        {
            int rowsAffected = DBTaskQueue.Create(
                this.newGuid,
                this.siteGuid,
                this.queuedBy,
                this.taskName,
                this.notifyOnCompletion,
                this.notificationToEmail,
                this.notificationFromEmail,
                this.notificationSubject,
                this.taskCompleteMessage,
                this.canStop,
                this.canResume,
                this.updateFrequency,
                this.queuedUTC,
                this.completeRatio,
                this.status,
                this.serializedTaskObject,
                this.serializedTaskType);

            this.guid = newGuid;

            return(rowsAffected > 0);
        }
Exemple #2
0
 /// <summary>
 /// Gets an instance of TaskQueue.
 /// </summary>
 /// <param name="guid"> guid </param>
 private void GetTaskQueue(Guid guid)
 {
     using (IDataReader reader = DBTaskQueue.GetOne(guid))
     {
         PopulateFromReader(reader);
     }
 }
Exemple #3
0
 public static bool DeleteByType(string taskType)
 {
     if (taskType.Length > 255)
     {
         taskType = taskType.Substring(255);
     }
     return(DBTaskQueue.DeleteByType(taskType));
 }
Exemple #4
0
 public static bool UnfinishedTaskExists(string taskType)
 {
     if (taskType.Length > 255)
     {
         taskType = taskType.Substring(255);
     }
     return(DBTaskQueue.GetCountUnfinishedByType(taskType) > 0);
 }
Exemple #5
0
        /// <summary>
        /// Gets an IList with page of instances of TaskQueue.
        /// </summary>
        public static List <TaskQueue> GetPageUnfinished(
            int pageNumber,
            int pageSize,
            out int totalPages)
        {
            totalPages = 1;
            IDataReader reader = DBTaskQueue.GetPageUnfinished(pageNumber, pageSize, out totalPages);

            return(LoadListFromReader(reader));
        }
Exemple #6
0
        /// <summary>
        /// Gets an IList with page of site specific instances of TaskQueue.
        /// </summary>
        public static List <TaskQueue> GetPageBySite(
            Guid siteGuid,
            int pageNumber,
            int pageSize,
            out int totalPages)
        {
            totalPages = 1;
            IDataReader reader = DBTaskQueue.GetPageBySite(siteGuid, pageNumber, pageSize, out totalPages);

            return(LoadListFromReader(reader));
        }
Exemple #7
0
        /// <summary>
        /// Updates this instance of TaskQueue. Returns true on success.
        /// </summary>
        /// <returns>bool</returns>
        private bool Update()
        {
            if (startUTC == DateTime.MinValue)
            {
                startUTC = DateTime.UtcNow;
            }

            if (lastStatusUpdateUTC == DateTime.MinValue)
            {
                lastStatusUpdateUTC = DateTime.UtcNow;
            }

            return(DBTaskQueue.Update(
                       this.guid,
                       this.startUTC,
                       this.completeUTC,
                       this.lastStatusUpdateUTC,
                       this.completeRatio,
                       this.status));
        }
Exemple #8
0
        /// <summary>
        /// Gets an IList with all site specific instances of TaskQueue that have not finished running yet.
        /// </summary>
        public static List <TaskQueue> GetUnfinished(Guid siteGuid)
        {
            IDataReader reader = DBTaskQueue.GetUnfinished(siteGuid);

            return(LoadListFromReader(reader));
        }
Exemple #9
0
        /// <summary>
        /// Gets an IList with all instances of TaskQueue that have completed but not been notified.
        /// </summary>
        public static List <TaskQueue> GetTasksForNotification()
        {
            IDataReader reader = DBTaskQueue.GetTasksForNotification();

            return(LoadListFromReader(reader));
        }
Exemple #10
0
        /// <summary>
        /// Gets an IList with all instances of TaskQueue that have not been started yet.
        /// </summary>
        public static List <TaskQueue> GetTasksNotStarted()
        {
            IDataReader reader = DBTaskQueue.GetTasksNotStarted();

            return(LoadListFromReader(reader));
        }
Exemple #11
0
 /// <summary>
 /// Deletes all completed tasks
 /// </summary>
 public static void DeleteCompleted()
 {
     DBTaskQueue.DeleteCompleted();
 }
Exemple #12
0
 /// <summary>
 /// Deletes an instance of TaskQueue. Returns true on success.
 /// </summary>
 /// <param name="guid"> guid </param>
 /// <returns>bool</returns>
 public static bool Delete(Guid guid)
 {
     return(DBTaskQueue.Delete(guid));
 }
Exemple #13
0
 public bool UpdateNotification()
 {
     return(DBTaskQueue.UpdateNotification(this.guid, DateTime.UtcNow));
 }