/// <summary> /// 保存工作分组 /// </summary> /// <param name="jobGroupInfo">工作分组对象</param> /// <returns>执行结果</returns> public Result <JobGroupDto> SaveJobGroup(JobGroupCmdDto jobGroupInfo) { using (var businessWork = WorkFactory.Create()) { if (jobGroupInfo == null) { return(Result <JobGroupDto> .FailedResult("分组信息不完整")); } var jobGroup = jobGroupInfo.MapTo <JobGroup>(); JobGroupDomainService.SaveJobGroup(jobGroup); var commitResult = businessWork.Commit(); Result <JobGroupDto> result = null; if (commitResult.ExecutedSuccess) { result = Result <JobGroupDto> .SuccessResult("保存成功"); result.Data = jobGroup.MapTo <JobGroupDto>(); } else { result = Result <JobGroupDto> .FailedResult("保存失败"); } return(result); } }
/// <summary> /// 删除工作分组 /// </summary> /// <param name="deleteInfo">删除信息</param> /// <returns>执行结果</returns> public Result DeleteJobGroup(DeleteJobGroupCmdDto deleteInfo) { using (var businessWork = WorkFactory.Create()) { #region 参数判断 if (deleteInfo == null || deleteInfo.JobGroupIds.IsNullOrEmpty()) { return(Result.FailedResult("没有指定要删除的工作分组")); } #endregion //删除逻辑 JobGroupDomainService.DeleteJobGroup(deleteInfo.JobGroupIds); var commitResult = businessWork.Commit(); return(commitResult.ExecutedSuccess ? Result.SuccessResult("删除成功") : Result.FailedResult("删除失败")); } }
/// <summary> /// 获取工作分组列表 /// </summary> /// <param name="filter">筛选信息</param> /// <returns></returns> public List <JobGroupDto> GetJobGroupList(JobGroupFilterDto filter) { var jobGroupList = JobGroupDomainService.GetJobGroupList(CreateQueryObject(filter)); return(jobGroupList.Select(c => c.MapTo <JobGroupDto>()).ToList()); }
/// <summary> /// 获取工作分组 /// </summary> /// <param name="filter">筛选信息</param> /// <returns></returns> public JobGroupDto GetJobGroup(JobGroupFilterDto filter) { var jobGroup = JobGroupDomainService.GetJobGroup(CreateQueryObject(filter)); return(jobGroup.MapTo <JobGroupDto>()); }
/// <summary> /// 获取工作分组分页 /// </summary> /// <param name="filter">筛选信息</param> /// <returns></returns> public IPaging <JobGroupDto> GetJobGroupPaging(JobGroupFilterDto filter) { var jobGroupPaging = JobGroupDomainService.GetJobGroupPaging(CreateQueryObject(filter)); return(jobGroupPaging.ConvertTo <JobGroupDto>()); }