コード例 #1
0
        /// <summary>
        /// Insert a new task
        /// </summary>
        /// <param name="task">
        /// The task.
        /// </param>
        /// <returns>
        /// </returns>
        /// <remarks>
        /// </remarks>
        public virtual SchedulerTask InsertTask(SchedulerTask task)
        {
            if (task.IDTask != -1)
            {
                throw new SchedulerException("Could not insert an inserted task");
            }

            task.SetIDTask(this.localSchDB.InsertTask(task));
            return(task);
        }
コード例 #2
0
        /// <summary>
        /// Insert a new task
        /// </summary>
        /// <param name="task">
        /// </param>
        /// <remarks>
        /// After a new task is inserted it obtains a IDTask. Before it's -1.
        /// </remarks>
        /// <returns>
        /// </returns>
        public override SchedulerTask InsertTask(SchedulerTask task)
        {
            if (task.IDTask != -1)
            {
                throw new SchedulerException("Could not insert an inserted task");
            }

            task.SetIDTask(this.localSchDB.InsertTask(task));
            if (this._cache.Count != 0 &&
                task.DueTime < ((SchedulerTask)this._cache.GetKey(this._cache.Count - 1)).DueTime)
            {
                lock (this._cache.SyncRoot)
                {
                    this._cache.RemoveAt(this._cache.Count - 1);
                    this._cache.Add(task, task);
                }
            }

            return(task);
        }
コード例 #3
0
        /// <summary>
        /// Insert a new task
        /// </summary>
        /// <param name="task">
        /// </param>
        /// <remarks>
        /// After a new task is inserted it obtains a IDTask. Before it's -1.
        /// </remarks>
        /// <returns>
        /// </returns>
        public override SchedulerTask InsertTask(SchedulerTask task)
        {
            if (task.IDTask != -1)
            {
                throw new SchedulerException("Could not insert an inserted task");
            }

            task.SetIDTask(this.localSchDB.InsertTask(task));
            if (this._cache.Count != 0 &&
                task.DueTime < ((SchedulerTask)this._cache.GetKey(this._cache.Count - 1)).DueTime)
            {
                lock (this._cache.SyncRoot)
                {
                    this._cache.RemoveAt(this._cache.Count - 1);
                    this._cache.Add(task, task);
                }
            }

            return task;
        }
コード例 #4
0
        /// <summary>
        /// Insert a new task
        /// </summary>
        /// <param name="task">
        /// The task.
        /// </param>
        /// <returns>
        /// </returns>
        /// <remarks>
        /// </remarks>
        public virtual SchedulerTask InsertTask(SchedulerTask task)
        {
            if (task.IDTask != -1)
            {
                throw new SchedulerException("Could not insert an inserted task");
            }

            task.SetIDTask(this.localSchDB.InsertTask(task));
            return task;
        }