/// <summary> /// 锁定订单 /// </summary> /// <param name="sysNos">任务池编号数组</param> /// <param name="unLockState">是否自动解锁</param> /// <param name="remarks">备注</param> /// <param name="unLockDate">解锁日期</param> /// <param name="userId">操作用户编号</param> /// <returns>是否成功</returns> /// <remarks>2013-06-19 余勇 创建</remarks> public bool LockJob(int[] sysNos, int unLockState, DateTime?unLockDate, string remarks, int userId) { var res = false; if (sysNos != null && sysNos.Length > 0) { foreach (var id in sysNos) { if (id > 0) { int taskSysNo = 0; SyJobPool job = SyJobPoolManageBo.Instance.GetJob(id); if (job != null) { //string remark = remarks; //if (unLockState > 0 && unLockDate != null) //{ // remark = remarks + // string.Format("(自动解锁时间:'{0}')", unLockDate.Value.ToString("yyyy-MM-dd HH:mm")); //} job.Remarks = remarks; job.Status = (int)SystemStatus.任务池状态.已锁定; Update(job); taskSysNo = job.TaskSysNo; } //先删除任务 SyLockJobBo.Instance.Delete(id); //插入锁定任务表 var model = new SyLockJob { JobPoolSysNo = id, UnLockState = unLockState, CreatedBy = userId, CreatedDate = DateTime.Now }; if (unLockState > 0 && unLockDate != null) { model.UnLockDate = unLockDate.Value; } SyLockJobBo.Instance.Insert(model); SysLog.Instance.WriteLog(LogStatus.SysLogLevel.Info, LogStatus.系统日志来源.后台, "锁定任务,任务对象编号:" + taskSysNo, LogStatus.系统日志目标类型.任务池, id, null, null, userId); } } res = true; } return(res); }
/// <summary> /// 插入锁定任务 /// </summary> /// <param name="model">锁定任务实体</param> /// <returns>影响行数</returns> /// 2014-06-16 余勇 创建 public abstract int Insert(SyLockJob model);
/// <summary> /// 插入锁定任务 /// </summary> /// <param name="model">锁定任务实体</param> /// <returns>影响行数</returns> /// 2014-06-16 余勇 创建 public int Insert(SyLockJob model) { return(ISyLockJob.Instance.Insert(model)); }
/// <summary> /// 插入锁定任务 /// </summary> /// <param name="model">锁定任务实体</param> /// <returns>影响行数</returns> /// 2014-06-16 余勇 创建 public override int Insert(SyLockJob model) { return(Context.Insert("SyLockJob", model) .AutoMap() .Execute()); }