Beispiel #1
0
        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="task"></param>
        /// <param name="parabll"></param>
        public WorkingTask(Task task, BLL.IBLLLogic parabll, DateTime paraLastRunDate)
        {
            _Task = task;

            #region 根据任务的不同构造不同的任务执行者
            this._Worker = Factory.GetWorker(this, parabll, _Task.TaskAssembly.AssemblyType);
            #endregion

            _LastRunTime = paraLastRunDate;
            if (_Task.TaskEntity.DateEnd < DateTime.Now)
            {
                _RunState = TaskRuningState.OutTime;
            }
            else
            {
                _RunState = TaskRuningState.Waite;
            }
            this.RebuildTaskRunTimeList();
        }
Beispiel #2
0
        /// <summary>
        /// 查询(可用的)富计划对象
        /// [外部接口不用使用,内部处理计划用]
        /// </summary>
        /// <returns></returns>
        public List<Task> GetTaskList()
        {
            List<TaskEntity> entitylist = this.GetTaskEntityList().FindAll(delegate(TaskEntity entity) { return entity.Enable == true; });
            List<TaskAssembly> assList = this.GetRegistedApps();

            List<Task> list = new List<Task>();
            foreach (TaskEntity t in entitylist)
            {
                TaskAssembly assembly = assList.Find(delegate(TaskAssembly a) { return a.UserName == t.RegestesAppName; });
                if (assembly != null)
                {
                    Task task = new Task(t, assembly);
                    list.Add(task);
                }
            }
            return list;
        }
Beispiel #3
0
 /// <summary>
 /// 所有回收工作都由该方法完成。
 /// 子类应重写(override)该方法。
 /// </summary>
 /// <param name="disposing"><c>true</c> to release both managed and unmanaged resources; <c>false</c> to release only unmanaged resources.</param>
 protected virtual void Dispose(bool disposing)
 {
     // 避免重复调用 Dispose 。
     if (!disposed) return;
     // 适应多线程环境,避免产生线程错误。
     lock (this)
     {
         if (disposing)
         {
             //------------------------------------------------
             // 在此处写释放托管资源的代码
             // (1) 有 Dispose() 方法的,调用其 Dispose() 方法。
             // (2) 没有 Dispose() 方法的,将其设为 null。
             // 例如:
             //     xxDataTable.Dispose();
             //     xxDataAdapter.Dispose();
             //     xxString = null;
             // ------------------------------------------------
             this._RunTimeList = null;
             this._Task = null;
             this._Worker = null;
         }
         // ------------------------------------------------
         // 在此处写释放非托管资源
         // 例如:
         //     文件句柄等
         // ------------------------------------------------
         disposed = true;
     }
 }
Beispiel #4
0
        /// <summary>
        /// 获取计划富实体
        /// </summary>
        /// <param name="paraEntity"></param>
        /// <returns></returns>
        public Task GetTask(TaskEntity paraEntity)
        {
            List<TaskAssembly> assList = this.GetRegistedApps();

            List<Task> list = new List<Task>();
            TaskAssembly assembly = assList.Find(delegate(TaskAssembly a) { return a.UserName == paraEntity.RegestesAppName; });
            if (assembly != null)
            {
                Task task = new Task(paraEntity, assembly);
                return task;
            }
            return null;
        }