Ejemplo n.º 1
0
        /// <summary>
        /// 修改分组排序
        /// </summary>
        /// <param name="sortIndexInfo">排序修改信息</param>
        /// <returns></returns>
        public Result ModifyAuthorityGroupSort(ModifyAuthorityGroupSortCmdDto sortIndexInfo)
        {
            using (var businessWork = WorkFactory.Create())
            {
                #region 参数判断

                if (sortIndexInfo == null || sortIndexInfo.AuthorityGroupSysNo <= 0)
                {
                    return(Result.FailedResult("没有指定要修改的分组"));
                }

                #endregion

                #region 修改分组状态信息

                var modifyResult = authorityGroupService.ModifyAuthorityGroupSort(sortIndexInfo.AuthorityGroupSysNo, sortIndexInfo.NewSortIndex);
                if (!modifyResult.Success)
                {
                    return(modifyResult);
                }

                #endregion

                var executeVal = businessWork.Commit();
                return(executeVal.ExecutedSuccess ? Result.SuccessResult("排序修改成功") : Result.FailedResult("排序修改失败"));
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// 修改权限状态
 /// </summary>
 /// <param name="statusInfo">状态信息</param>
 /// <returns>执行结果</returns>
 public Result ModifyAuthorityStatus(ModifyAuthorityStatusCmdDto statusInfo)
 {
     using (var businessWork = WorkFactory.Create())
     {
         if (statusInfo == null || statusInfo.AuthorityStatusInfo == null)
         {
             return(Result.FailedResult("没有指定任何要修改的权限信息"));
         }
         List <ModifyAuthorityStatus> modifyStatusList = new List <ModifyAuthorityStatus>();
         foreach (var statusItem in statusInfo.AuthorityStatusInfo)
         {
             modifyStatusList.Add(new ModifyAuthorityStatus()
             {
                 Code   = statusItem.Key,
                 Status = statusItem.Value
             });
         }
         var modifyResult = authorityService.ModifyAuthorityStatus(modifyStatusList.ToArray());
         if (!modifyResult.Success)
         {
             return(modifyResult);
         }
         var commitVal = businessWork.Commit();
         return(commitVal.ExecutedSuccess ? Result.SuccessResult("修改成功") : Result.FailedResult("修改失败"));
     }
 }
Ejemplo n.º 3
0
        /// <summary>
        /// 保存角色
        /// </summary>
        /// <param name="saveInfo">保存信息</param>
        /// <returns></returns>
        public Result <RoleDto> SaveRole(SaveRoleCmdDto saveInfo)
        {
            if (saveInfo == null)
            {
                return(Result <RoleDto> .FailedResult("没有指定任何要保存的信息"));
            }
            using (var businessWork = WorkFactory.Create())
            {
                var roleResult = RoleDomainService.SaveRole(saveInfo.Role.MapTo <Role>());
                if (!roleResult.Success)
                {
                    return(Result <RoleDto> .FailedResult(roleResult.Message));
                }
                var commitResult        = businessWork.Commit();
                Result <RoleDto> result = null;
                if (commitResult.ExecutedSuccess)
                {
                    result = Result <RoleDto> .SuccessResult("保存成功");

                    result.Data = roleResult.Data.MapTo <RoleDto>();
                }
                else
                {
                    result = Result <RoleDto> .FailedResult("保存失败");
                }
                return(result);
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 保存权限
        /// </summary>
        /// <param name="saveInfo">权限对象</param>
        /// <returns>执行结果</returns>
        public Result <AuthorityDto> SaveAuthority(SaveAuthorityCmdDto saveInfo)
        {
            using (var businessWork = WorkFactory.Create())
            {
                if (saveInfo == null)
                {
                    return(Result <AuthorityDto> .FailedResult("没有指定任何要保存的权限信息"));
                }

                #region 保存权限数据

                var authSaveResult = authorityService.SaveAuthority(saveInfo.Authority.MapTo <Authority>());
                if (!authSaveResult.Success)
                {
                    return(Result <AuthorityDto> .FailedResult(authSaveResult.Message));
                }

                #endregion

                var commitVal = businessWork.Commit();
                Result <AuthorityDto> result = null;
                if (commitVal.ExecutedSuccess)
                {
                    result = Result <AuthorityDto> .SuccessResult("保存成功");

                    result.Data = authSaveResult.Data.MapTo <AuthorityDto>();
                }
                else
                {
                    result = Result <AuthorityDto> .FailedResult("保存失败");
                }
                return(result);
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 保存授权操作
        /// </summary>
        /// <param name="saveInfo">授权操作对象</param>
        /// <returns>执行结果</returns>
        public Result <AuthorityOperationDto> SaveAuthorityOperation(SaveAuthorityOperationCmdDto saveInfo)
        {
            if (saveInfo == null)
            {
                return(Result <AuthorityOperationDto> .FailedResult("授权操作信息不完整"));
            }
            using (var businessWork = WorkFactory.Create())
            {
                var saveResult = authorityOperationService.SaveAuthorityOperation(saveInfo.AuthorityOperation.MapTo <AuthorityOperation>());
                if (!saveResult.Success)
                {
                    return(Result <AuthorityOperationDto> .FailedResult(saveResult.Message));
                }
                var commitResult = businessWork.Commit();
                Result <AuthorityOperationDto> result = null;
                if (commitResult.ExecutedSuccess)
                {
                    result = Result <AuthorityOperationDto> .SuccessResult("保存成功");

                    result.Data = saveResult.Data.MapTo <AuthorityOperationDto>();
                }
                else
                {
                    result = Result <AuthorityOperationDto> .SuccessResult("保存失败");
                }
                return(result);
            }
        }
Ejemplo n.º 6
0
        /// <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);
            }
        }
Ejemplo n.º 7
0
        /// <summary>
        /// 修改授权操作状态
        /// </summary>
        /// <param name="statusInfo">状态信息</param>
        /// <returns>执行结果</returns>
        public Result ModifyAuthorityOperationStatus(ModifyAuthorityOperationStatusCmdDto statusInfo)
        {
            if (statusInfo == null || statusInfo.StatusInfo == null || statusInfo.StatusInfo.Count <= 0)
            {
                return(Result.FailedResult("没有指定任何要修改的状态信息"));
            }
            using (var businessWork = WorkFactory.Create())
            {
                #region 修改状态信息

                List <ModifyAuthorityOperationStatus> newStatusList = new List <ModifyAuthorityOperationStatus>();
                foreach (var statusItem in statusInfo.StatusInfo)
                {
                    newStatusList.Add(new ModifyAuthorityOperationStatus()
                    {
                        OperationId = statusItem.Key,
                        Status      = statusItem.Value
                    });
                }
                var modifyResult = authorityOperationService.ModifyStatus(newStatusList.ToArray());
                if (!modifyResult.Success)
                {
                    return(modifyResult);
                }

                #endregion

                var commitVal = businessWork.Commit();
                return(commitVal.ExecutedSuccess ? Result.SuccessResult("修改成功") : Result.FailedResult("修改失败"));
            }
        }
Ejemplo n.º 8
0
        /// <summary>
        /// 保存用户
        /// </summary>
        /// <param name="saveInfo">保存信息</param>
        /// <returns></returns>
        public Result <UserDto> SaveUser(SaveUserCmdDto saveInfo)
        {
            if (saveInfo == null || saveInfo.User == null)
            {
                return(Result <UserDto> .FailedResult("没有指定任何要保存的用户信息"));
            }
            using (var businessWork = WorkFactory.Create())
            {
                var user           = saveInfo.User.MapTo <User>();
                var userSaveResult = userService.SaveUser(user);
                if (!userSaveResult.Success)
                {
                    return(Result <UserDto> .FailedResult(userSaveResult.Message));
                }
                var commitResult        = businessWork.Commit();
                Result <UserDto> result = null;
                if (commitResult.EmptyResultOrSuccess)
                {
                    result = Result <UserDto> .SuccessResult("保存成功");

                    result.Data = userSaveResult.Data.MapTo <UserDto>();
                }
                else
                {
                    result = Result <UserDto> .FailedResult("保存失败");
                }
                return(result);
            }
        }
Ejemplo n.º 9
0
        /// <summary>
        /// 保存权限分组
        /// </summary>
        /// <param name="authorityGroup">权限分组对象</param>
        /// <returns>执行结果</returns>
        public Result <AuthorityGroupDto> SaveAuthorityGroup(SaveAuthorityGroupCmdDto saveInfo)
        {
            if (saveInfo == null || saveInfo.AuthorityGroup == null)
            {
                return(Result <AuthorityGroupDto> .FailedResult("分组信息不完整"));
            }
            using (var businessWork = WorkFactory.Create())
            {
                var saveResult = AuthorityGroupDomainService.SaveAuthorityGroup(saveInfo.AuthorityGroup.MapTo <AuthorityGroup>());
                if (!saveResult.Success)
                {
                    return(Result <AuthorityGroupDto> .FailedResult(saveResult.Message));
                }
                var commitResult = businessWork.Commit();
                Result <AuthorityGroupDto> result = null;
                if (commitResult.ExecutedSuccess)
                {
                    result = Result <AuthorityGroupDto> .SuccessResult("保存成功");

                    result.Data = saveResult.Data.MapTo <AuthorityGroupDto>();
                }
                else
                {
                    result = Result <AuthorityGroupDto> .FailedResult("保存失败");
                }
                return(result);
            }
        }
Ejemplo n.º 10
0
        /// <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);
            }
        }
Ejemplo n.º 11
0
        /// <summary>
        /// 保存工作任务
        /// </summary>
        /// <param name="saveInfo">保存信息</param>
        /// <returns>执行结果</returns>
        public Result <JobDto> SaveJob(SaveJobCmdDto saveInfo)
        {
            using (var businessWork = WorkFactory.Create())
            {
                if (saveInfo == null || saveInfo.Job == null)
                {
                    return(Result <JobDto> .FailedResult("任务保存信息不完整"));
                }
                var job = saveInfo.Job.MapTo <Job>();
                JobDomainService.SaveJob(job);
                Result <JobDto> result       = null;
                var             commitResult = businessWork.Commit();
                if (commitResult.ExecutedSuccess)
                {
                    result = Result <JobDto> .SuccessResult("保存成功");

                    result.Data = job.MapTo <JobDto>();
                }
                else
                {
                    result = Result <JobDto> .FailedResult("保存失败");
                }
                return(result);
            }
        }
Ejemplo n.º 12
0
        /// <summary>
        /// 保存服务节点
        /// </summary>
        /// <param name="saveInfo">服务节点对象</param>
        /// <returns>执行结果</returns>
        public Result <ServerNodeDto> SaveServerNode(SaveServerNodeCmdDto saveInfo)
        {
            using (var businessWork = WorkFactory.Create())
            {
                if (saveInfo == null || saveInfo.ServerNode == null)
                {
                    return(Result <ServerNodeDto> .FailedResult("服务节点信息为空"));
                }
                var serverNode = saveInfo.ServerNode.MapTo <ServerNode>();
                serverNodeService.SaveServerNode(serverNode);
                var commitResult = businessWork.Commit();
                Result <ServerNodeDto> result = null;
                if (commitResult.ExecutedSuccess)
                {
                    result = Result <ServerNodeDto> .SuccessResult("保存成功");

                    result.Data = serverNode.MapTo <ServerNodeDto>();
                }
                else
                {
                    result = Result <ServerNodeDto> .FailedResult("保存失败");
                }
                return(result);
            }
        }
Ejemplo n.º 13
0
 /// <summary>
 /// 保存服务节点执行计划
 /// </summary>
 /// <param name="saveInfo">保存信息</param>
 /// <returns></returns>
 public Result SaveTriggerServer(SaveTriggerServerCmdDto saveInfo)
 {
     using (var businessWork = WorkFactory.Create())
     {
         if (saveInfo == null || saveInfo.TriggerServers.IsNullOrEmpty())
         {
             return(Result.FailedResult("没有指定任何要保存的信息"));
         }
         TriggerServerDomainService.SaveTriggerServer(saveInfo.TriggerServers.Select(c => c.MapTo <TriggerServer>()));
         var commitResult = businessWork.Commit();
         return(commitResult.EmptyResultOrSuccess ? Result.SuccessResult("保存成功") : Result.FailedResult("保存失败"));
     }
 }
Ejemplo n.º 14
0
 /// <summary>
 /// 修改计划服务运行状态
 /// </summary>
 /// <param name="stateInfo">状态信息</param>
 /// <returns></returns>
 public Result ModifyRunState(ModifyTriggerServerRunStatusCmdDto stateInfo)
 {
     using (var businessWork = WorkFactory.Create())
     {
         if (stateInfo == null || stateInfo.TriggerServers.IsNullOrEmpty())
         {
             return(Result.FailedResult("没有指定要修改的信息"));
         }
         TriggerServerDomainService.ModifyRunState(stateInfo.TriggerServers.Select(c => c.MapTo <TriggerServer>()));
         var commitResult = businessWork.Commit();
         return(commitResult.ExecutedSuccess ? Result.SuccessResult("修改成功") : Result.FailedResult("修改失败"));
     }
 }
Ejemplo n.º 15
0
 /// <summary>
 /// 保存任务异常日志
 /// </summary>
 /// <param name="saveInfo">保存信息</param>
 /// <returns>执行结果</returns>
 public Result SaveErrorLog(SaveErrorLogCmdDto saveInfo)
 {
     if (saveInfo == null || saveInfo.ErrorLogs.IsNullOrEmpty())
     {
         return(Result.FailedResult("没有指定要保存的信息"));
     }
     using (var businessWork = WorkFactory.Create())
     {
         errorLogService.SaveErrorLog(saveInfo.ErrorLogs.Select(c => { c.Id = ErrorLog.GenerateErrorLogId(); return(c.MapTo <ErrorLog>()); }));
         var commitResult = businessWork.Commit();
         return(commitResult.ExecutedSuccess ? Result.SuccessResult("保存成功") : Result.FailedResult("保存失败"));
     }
 }
Ejemplo n.º 16
0
 /// <summary>
 /// 修改工作任务运行状态
 /// </summary>
 /// <param name="stateInfo">状态信息</param>
 /// <returns></returns>
 public Result ModifyJobRunState(ModifyJobRunStatusCmdDto stateInfo)
 {
     if (stateInfo == null || stateInfo.Jobs.IsNullOrEmpty())
     {
         return(Result.FailedResult("没有指定要修改的任务信息"));
     }
     using (var businessWork = WorkFactory.Create())
     {
         JobDomainService.ModifyJobRunState(stateInfo.Jobs.Select(c => c.MapTo <Job>()));
         var    commitResult = businessWork.Commit();
         Result result       = commitResult.ExecutedSuccess ? Result.SuccessResult("修改成功") : Result.FailedResult("修改失败");
         return(result);
     }
 }
Ejemplo n.º 17
0
 /// <summary>
 /// 修改服务节点运行状态
 /// </summary>
 /// <param name="stateInfo">状态信息</param>
 /// <returns></returns>
 public Result ModifyRunState(ModifyServerNodeRunStatusCmdDto stateInfo)
 {
     using (var businessWork = WorkFactory.Create())
     {
         if (stateInfo == null || stateInfo.Servers.IsNullOrEmpty())
         {
             return(Result.FailedResult("没有指定要修改的服务信息"));
         }
         var servers = stateInfo.Servers.Select(c => c.MapTo <ServerNode>());
         serverNodeService.ModifyServerNodeRunState(servers);
         var commitResult = businessWork.Commit();
         return(commitResult.ExecutedSuccess ? Result.SuccessResult("修改成功") : Result.FailedResult("修改失败"));
     }
 }
Ejemplo n.º 18
0
 /// <summary>
 /// 删除工作承载节点
 /// </summary>
 /// <param name="deleteInfo">删除信息</param>
 /// <returns>执行结果</returns>
 public Result DeleteJobServerHost(DeleteJobServerHostCmdDto deleteInfo)
 {
     using (var businessWork = WorkFactory.Create())
     {
         if (deleteInfo == null || deleteInfo.JobServerHosts.IsNullOrEmpty())
         {
             return(Result.FailedResult("没有指定要删除的信息"));
         }
         List <JobServerHost> serverHosts = deleteInfo.JobServerHosts.Select(c => JobServerHost.CreateJobServerHost(c.Job?.Id, c.Server?.Id)).ToList();
         jobServerHostService.DeleteJobServerHost(serverHosts);
         var commitResult = businessWork.Commit();
         var result       = commitResult.ExecutedSuccess ? Result.SuccessResult("删除成功") : Result.FailedResult("删除失败");
         return(result);
     }
 }
Ejemplo n.º 19
0
 /// <summary>
 /// 保存工作承载节点
 /// </summary>
 /// <param name="saveInfo">保存信息</param>
 /// <returns>执行结果</returns>
 public Result SaveJobServerHost(SaveJobServerHostCmdDto saveInfo)
 {
     using (var businessWork = WorkFactory.Create())
     {
         if (saveInfo == null || saveInfo.JobServerHosts.IsNullOrEmpty())
         {
             return(Result.FailedResult("工作承载保存信息为空"));
         }
         List <JobServerHost> jobServerHostList = saveInfo.JobServerHosts.Select(c => { var jobServer = JobServerHost.CreateJobServerHost(c.Job?.Id, c.Server?.Id); jobServer.RunStatus = c.RunStatus; return(jobServer); }).ToList();
         jobServerHostService.SaveJobServerHost(jobServerHostList);
         var commitResult = businessWork.Commit();
         var result       = commitResult.ExecutedSuccess ? Result.SuccessResult("保存成功") : Result.FailedResult("保存失败");
         return(result);
     }
 }
Ejemplo n.º 20
0
 /// <summary>
 /// 修改承载服务运行状态
 /// </summary>
 /// <param name="modifyInfo">修改信息</param>
 /// <returns></returns>
 public Result ModifyRunState(ModifyJobServerHostRunStatusCmdDto modifyInfo)
 {
     using (var businessWork = WorkFactory.Create())
     {
         if (modifyInfo == null || modifyInfo.JobServerHosts.IsNullOrEmpty())
         {
             return(Result.FailedResult("没有指定要修改的信息"));
         }
         var jobServerHostList = modifyInfo.JobServerHosts.Select(c => c.MapTo <JobServerHost>());
         jobServerHostService.ModifyRunState(jobServerHostList);
         var commitResult = businessWork.Commit();
         var result       = commitResult.ExecutedSuccess ? Result.SuccessResult("修改成功") : Result.FailedResult("修改失败");
         return(result);
     }
 }
Ejemplo n.º 21
0
 /// <summary>
 /// 修改用户授权
 /// </summary>
 /// <param name="authorizeInfo">用户授权信息</param>
 /// <returns></returns>
 public Result ModifyUserAuthorize(ModifyUserAuthorizeCmdDto authorizeInfo)
 {
     if (authorizeInfo == null || authorizeInfo.UserAuthorizes.IsNullOrEmpty())
     {
         return(Result.FailedResult("没有指定任何要修改的用户授权信息"));
     }
     using (var businessWork = WorkFactory.Create())
     {
         var modifyResult = authorizeService.ModifyUserAuthorize(authorizeInfo.UserAuthorizes.Select(c => c.MapTo <UserAuthorize>()));
         if (!modifyResult.Success)
         {
             return(modifyResult);
         }
         var commitResult = businessWork.Commit();
         return(commitResult.ExecutedSuccess ? Result.SuccessResult("修改成功") : Result.FailedResult("修改失败"));
     }
 }
Ejemplo n.º 22
0
 /// <summary>
 /// 修改角色授权
 /// </summary>
 /// <param name="authInfo">授权信息</param>
 /// <returns></returns>
 public Result ModifyRoleAuthorize(ModifyRoleAuthorizeCmdDto authInfo)
 {
     if (authInfo == null)
     {
         return(Result.FailedResult("没有指定任何要修改的角色授权信息"));
     }
     using (var businessWork = WorkFactory.Create())
     {
         var modifyResult = authorizeService.ModifyRoleAuthorize(authInfo.MapTo <ModifyRoleAuthorize>());
         if (!modifyResult.Success)
         {
             return(modifyResult);
         }
         var commitResult = businessWork.Commit();
         return(commitResult.ExecutedSuccess ? Result.SuccessResult("修改成功") : Result.FailedResult("修改失败"));
     }
 }
Ejemplo n.º 23
0
 /// <summary>
 /// 修改权限及权限操作绑定
 /// </summary>
 /// <param name="bindInfo">绑定信息</param>
 /// <returns></returns>
 public Result ModifyAuthorityOperationBindAuthority(ModifyAuthorityBindAuthorityOperationCmdDto bindInfo)
 {
     if (bindInfo == null)
     {
         return(Result.FailedResult("没有指定任何要修改的信息"));
     }
     using (var businessWork = WorkFactory.Create())
     {
         var modifyResult = authorityBindAuthorityOperationService.ModifyAuthorityAndAuthorityOperationBind(bindInfo.MapTo <ModifyAuthorityAndAuthorityOperationBind>());
         if (!modifyResult.Success)
         {
             return(modifyResult);
         }
         var commitResult = businessWork.Commit();
         return(commitResult.ExecutedSuccess ? Result.SuccessResult("修改成功") : Result.FailedResult("修改失败"));
     }
 }
Ejemplo n.º 24
0
 /// <summary>
 /// 删除用户
 /// </summary>
 /// <param name="deleteInfo">删除信息</param>
 /// <returns></returns>
 public Result DeleteUser(DeleteUserCmdDto deleteInfo)
 {
     if (deleteInfo == null || deleteInfo.UserIds.IsNullOrEmpty())
     {
         return(Result.FailedResult("没有指定任何要删除的用户信息"));
     }
     using (var businessWork = WorkFactory.Create())
     {
         var deleteResult = userService.DeleteUser(deleteInfo.UserIds);
         if (!deleteResult.Success)
         {
             return(deleteResult);
         }
         var commitResult = businessWork.Commit();
         return(commitResult.ExecutedSuccess ? Result.SuccessResult("删除成功") : Result.FailedResult("删除失败"));
     }
 }
Ejemplo n.º 25
0
 /// <summary>
 /// 修改分组排序
 /// </summary>
 /// <param name="sortInfo">排序信息</param>
 /// <returns>执行结果</returns>
 public Result ModifySortIndex(ModifyAuthorityOperationGroupSortCmdDto sortInfo)
 {
     if (sortInfo == null)
     {
         return(Result.FailedResult("没有指定任何要修改的信息"));
     }
     using (var businessWork = WorkFactory.Create())
     {
         var modifyResult = authorityOperationGroupService.ModifySortIndex(sortInfo.AuthorityOperationGroupSysNo, sortInfo.NewSort);
         if (!modifyResult.Success)
         {
             return(modifyResult);
         }
         var commitResult = businessWork.Commit();
         return(commitResult.ExecutedSuccess ? Result.SuccessResult("修改成功") : Result.FailedResult("修改失败"));
     }
 }
Ejemplo n.º 26
0
        /// <summary>
        /// 删除授权操作
        /// </summary>
        /// <param name="deleteInfo">删除信息</param>
        /// <returns>执行结果</returns>
        public Result DeleteAuthorityOperation(DeleteAuthorityOperationCmdDto deleteInfo)
        {
            using (var businessWork = WorkFactory.Create())
            {
                #region 参数判断

                if (deleteInfo == null || deleteInfo.AuthorityOperationIds.IsNullOrEmpty())
                {
                    return(Result.FailedResult("没有指定要删除的授权操作"));
                }

                #endregion

                authorityOperationService.DeleteAuthorityOperation(deleteInfo.AuthorityOperationIds);
                var exectVal = businessWork.Commit();
                return(exectVal.ExecutedSuccess ? Result.SuccessResult("删除成功") : Result.FailedResult("删除失败"));
            }
        }
Ejemplo n.º 27
0
        /// <summary>
        /// 删除角色
        /// </summary>
        /// <param name="deleteInfo">删除信息</param>
        /// <returns>执行结果</returns>
        public Result DeleteRole(DeleteRoleCmdDto deleteInfo)
        {
            using (var businessWork = WorkFactory.Create())
            {
                #region 参数判断

                if (deleteInfo == null || deleteInfo.RoleIds.IsNullOrEmpty())
                {
                    return(Result.FailedResult("没有指定要删除的角色"));
                }

                #endregion

                RoleDomainService.RemoveRole(deleteInfo.RoleIds);
                var exectVal = businessWork.Commit();
                return(exectVal.ExecutedSuccess ? Result.SuccessResult("删除成功") : Result.FailedResult("删除失败"));
            }
        }
Ejemplo n.º 28
0
        /// <summary>
        /// 删除服务节点执行计划
        /// </summary>
        /// <param name="deleteInfo">删除信息</param>
        /// <returns>执行结果</returns>
        public Result DeleteTriggerServer(DeleteTriggerServerCmdDto deleteInfo)
        {
            using (var businessWork = WorkFactory.Create())
            {
                #region 参数判断

                if (deleteInfo == null || deleteInfo.TriggerServers.IsNullOrEmpty())
                {
                    return(Result.FailedResult("没有指定要删除的服务节点执行计划"));
                }

                #endregion

                TriggerServerDomainService.DeleteTriggerServer(deleteInfo.TriggerServers.Select(c => c.MapTo <TriggerServer>()));
                var commitResult = businessWork.Commit();
                return(commitResult.ExecutedSuccess ? Result.SuccessResult("删除成功") : Result.FailedResult("删除失败"));
            }
        }
Ejemplo n.º 29
0
        /// <summary>
        /// 保存任务执行日志
        /// </summary>
        /// <param name="saveInfo">保存信息</param>
        /// <returns>执行结果</returns>
        public Result SaveExecuteLog(SaveExecuteLogCmdDto saveInfo)
        {
            if (saveInfo == null || saveInfo.ExecuteLogs.IsNullOrEmpty())
            {
                return(Result.FailedResult("没有指定要保存的信息"));
            }
            List <ExecuteLog> logs = saveInfo.ExecuteLogs.Select(c => c.MapTo <ExecuteLog>()).ToList();

            using (var businessWork = WorkFactory.Create())
            {
                ExecuteLogDomainService.SaveExecuteLog(logs);
                var commitResult = businessWork.Commit();
                if (commitResult.ExecutedSuccess)
                {
                    return(Result.SuccessResult("保存成功"));
                }
                return(Result.FailedResult("保存失败"));
            }
        }
Ejemplo n.º 30
0
        /// <summary>
        /// 删除工作任务
        /// </summary>
        /// <param name="deleteInfo">删除信息</param>
        /// <returns>执行结果</returns>
        public Result DeleteJob(DeleteJobCmdDto deleteInfo)
        {
            using (var businessWork = WorkFactory.Create())
            {
                #region 参数判断

                if (deleteInfo == null || deleteInfo.JobIds.IsNullOrEmpty())
                {
                    return(Result.FailedResult("没有指定要删除的工作任务"));
                }

                #endregion

                //删除逻辑
                JobDomainService.DeleteJob(deleteInfo.JobIds);
                var commitResult = businessWork.Commit();
                return(commitResult.ExecutedSuccess ? Result.SuccessResult("删除成功") : Result.FailedResult("删除失败"));
            }
        }