コード例 #1
0
ファイル: Factory.cs プロジェクト: hasnain-ahmad/timertask
        /// <summary>
        /// Gets the worker.
        /// </summary>
        /// <param name="wt">The wt.</param>
        /// <param name="bll">The BLL.</param>
        /// <param name="asType">As type.</param>
        /// <returns></returns>
        internal static IWorker GetWorker(WorkingTask wt, IBLLLogic bll, AssemblyType asType)
        {
            switch (asType)
            {
                case AssemblyType.Dll:
                    return new Worker_Assembly(wt, bll);
                    break;

                case AssemblyType.Exe:
                    return new Worker_Excutable(wt, bll);
                    break;
                default:
                    throw new Exception("尚未定义的工作类型,AssemblyType:" + asType.ToString());
                    break;

            }
        }
コード例 #2
0
ファイル: Worker.cs プロジェクト: hasnain-ahmad/timertask
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="paraTask"></param>
 /// <param name="paraBll"></param>
 public Worker(WorkingTask paraTask, BLL.IBLLLogic paraBll)
 {
     _WrkTask = paraTask;
     _BLL = paraBll;
 }
コード例 #3
0
 /// <summary>
 /// 该任务是否到时间并且可以执行
 /// <remarks>这个算法写了很长时间</remarks>
 /// </summary>
 /// <param name="paraWorkTask"></param>
 //[STAThread]
 private bool IsThisTaskOnTime(WorkingTask paraWorkTask)
 {
     DateTime dtNow = DateTime.Now;
     return paraWorkTask.Task.TaskEntity.Enable &&   //可用
         paraWorkTask.RunState != TaskRuningState.OutTime && //没有超时
         dtNow >= paraWorkTask.NextRunTime; //间隔到了
 }
コード例 #4
0
 /// <summary>
 /// 构造一个工作列表
 /// [根据日志]
 /// </summary>
 /// <param name="task"></param>
 /// <returns></returns>
 private IWorkingTask GetWorkingTask(Task task)
 {
     DateTime date = _IBLLLogic.GetTaskLastRunTime(task.TaskEntity.ID);
     IWorkingTask wt = new WorkingTask(task, _IBLLLogic, date);
     return wt;
 }