Ejemplo n.º 1
0
 /// <summary>
 /// 更新任务状态
 /// </summary>
 /// <param name="entity"></param>
 /// <returns></returns>
 public bool Update(TaskItemEntity entity)
 {
     try
     {
         lock (this)
         {
             return(this._db.Update(this._tbName, new
             {
                 id = entity.Id
             }, entity) == 1);
         }
     }
     catch (Exception ex)
     {
         LoggerProxy.Error(LogSource, "call AddObj error.", ex);
     }
     return(false);
 }
Ejemplo n.º 2
0
 /// <summary>
 /// 添加任务的最上层执行者,如果存在,不继续添加
 /// </summary>
 /// <param name="task"></param>
 /// <returns></returns>
 public bool AddRoot(TaskItemEntity task)
 {
     try
     {
         lock (this)
         {
             var taskInfo = this.Get(new { taskId = task.TaskId });
             if (taskInfo != null)
             {
                 return(true);
             }
             return(this.Add(task));
         }
     }
     catch (Exception ex)
     {
         LoggerProxy.Error(LogSource, "call AddRoot error.", ex);
     }
     return(false);
 }
Ejemplo n.º 3
0
 /// <summary>
 /// 添加一个任务
 /// </summary>
 /// <param name="task">任务对象</param>
 /// <returns>返回是否添加成功</returns>
 public bool Add(TaskItemEntity task)
 {
     try
     {
         lock (this)
         {
             return(this._db.Insert(this._tbName, new
             {
                 parentId = task.ParentId,
                 script = task.Script,
                 taskId = task.TaskId,
                 url = task.Url,
             }) > 0);
         }
     }
     catch (Exception ex)
     {
         LoggerProxy.Error(LogSource, "call Add error.", ex);
     }
     return(false);
 }