/// <summary> /// 保存任务执行计划 /// </summary> /// <param name="saveInfo">保存信息</param> /// <returns>执行结果</returns> public Result <TriggerDto> SaveTrigger(SaveTriggerCmdDto saveInfo) { using (var businessWork = WorkFactory.Create()) { if (saveInfo == null || saveInfo.Trigger == null) { return(Result <TriggerDto> .FailedResult("保存信息为空")); } Result <TriggerDto> result = null; var trigger = saveInfo.Trigger.MapTo <Trigger>(); TriggerDomainService.SaveTrigger(trigger);//保存执行计划 var commitResult = businessWork.Commit(); if (commitResult.ExecutedSuccess) { result = Result <TriggerDto> .SuccessResult("保存成功"); result.Data = trigger.MapTo <TriggerDto>(); } else { result = Result <TriggerDto> .FailedResult("保存失败"); } return(result); } }
Trigger LoadTrigger() { if (!AllowLazyLoad(r => r.Trigger)) { return(trigger.CurrentValue); } if (trigger.CurrentValue == null) { return(trigger.CurrentValue); } return(TriggerDomainService.GetTrigger(trigger.CurrentValue.Id)); }
/// <summary> /// 修改执行计划状态 /// </summary> /// <param name="stateInfo">状态信息</param> /// <returns></returns> public Result ModifyTriggerState(ModifyTriggerStatusCmdDto stateInfo) { if (stateInfo == null || stateInfo.Triggers.IsNullOrEmpty()) { return(Result.FailedResult("没有指定任何要修改的信息")); } using (var businessWork = WorkFactory.Create()) { TriggerDomainService.ModifyTriggerState(stateInfo.Triggers.Select(c => c.MapTo <Trigger>())); var commitResult = businessWork.Commit(); var result = commitResult.ExecutedSuccess ? Result.SuccessResult("修改成功") : Result.FailedResult("修改失败"); return(result); } }
/// <summary> /// 删除任务执行计划 /// </summary> /// <param name="deleteInfo">删除信息</param> /// <returns>执行结果</returns> public Result DeleteTrigger(DeleteTriggerCmdDto deleteInfo) { using (var businessWork = WorkFactory.Create()) { #region 参数判断 if (deleteInfo == null || deleteInfo.TriggerIds.IsNullOrEmpty()) { return(Result.FailedResult("没有指定要删除的任务执行计划")); } #endregion //删除逻辑 TriggerDomainService.DeleteTrigger(deleteInfo.TriggerIds); var commitResult = businessWork.Commit(); return(commitResult.ExecutedSuccess ? Result.SuccessResult("删除成功") : Result.FailedResult("删除失败")); } }
/// <summary> /// 获取任务执行计划列表 /// </summary> /// <param name="filter">查询条件</param> /// <returns></returns> public List <TriggerDto> GetTriggerList(TriggerFilterDto filter) { var triggerList = TriggerDomainService.GetTriggerList(CreateQueryObject(filter)); return(triggerList.Select(c => c.MapTo <TriggerDto>()).ToList()); }
/// <summary> /// 获取任务执行计划 /// </summary> /// <param name="filter">查询条件</param> /// <returns></returns> public TriggerDto GetTrigger(TriggerFilterDto filter) { var trigger = TriggerDomainService.GetTrigger(CreateQueryObject(filter)); return(trigger.MapTo <TriggerDto>()); }
/// <summary> /// 获取任务执行计划分页 /// </summary> /// <param name="filter">查询条件</param> /// <returns></returns> public IPaging <TriggerDto> GetTriggerPaging(TriggerFilterDto filter) { var triggerPaging = TriggerDomainService.GetTriggerPaging(CreateQueryObject(filter)); return(triggerPaging.ConvertTo <TriggerDto>()); }