public ResponseViewModel MoveDepartment(TreePostData postData) { Guard.Against.Null(postData, nameof(postData)); if (postData.Operation == TreeNodeOper.MOVE_NODE) { //当前部门 _platformDomain.OrgDeptSet.TryGetValue(postData.Id, out OrgDept currDept); //检查之前父部门子级 _platformDomain.OrgDeptSet.TryGetValueByPid(currDept.Pid, out IEnumerable <OrgDept> childs); if (childs.Any() && childs.Count() == 1) { if (_platformDomain.OrgDeptSet.TryGetValue(currDept.Pid, out OrgDept parentDept)) { parentDept.IsFinal = 1; _dbContext.Update(parentDept); } } currDept.Pid = postData.Parent; _dbContext.Update(currDept); } return(new ResponseViewModel { success = true }); }
public ResponseViewModel OperOrgJob(TreePostData postData) { Guard.Against.Null(postData, nameof(postData)); ResponseViewModel vm = new ResponseViewModel(); if (postData.Operation == TreeNodeOper.DELETE_NODE) { vm.success = _dbContext.Delete <OrgJob>(postData.Id); } else if (postData.Operation == TreeNodeOper.CREATE_NODE) { string pid = postData.Id; var parentJob = _dbContext.Get <OrgJob>(pid); OrgJob job = new OrgJob() { Pid = postData.Id, JobName = postData.Text, TreeLevel = parentJob == null ? 1 : parentJob.TreeLevel + 1, IsFinal = parentJob == null ? 0 : 1, FullName = parentJob == null?postData.Text:$"{parentJob.FullName}/{postData.Text}" }; if (parentJob != null) { parentJob.IsFinal = 0; _dbContext.Update(parentJob); } _dbContext.Insert(job); vm.success = true; vm.data = job.Fid; } else if (postData.Operation == TreeNodeOper.RENAME_NODE) { var job = _dbContext.Get <OrgJob>(postData.Id); job.FullName = job.FullName.Replace(job.JobName, postData.Text); job.JobName = postData.Text; vm.success = _dbContext.Update(job); } else if (postData.Operation == "move_node") { var job = _dbContext.Get <OrgJob>(postData.Id); job.Pid = postData.Parent; var parentJob = _dbContext.Get <OrgJob>(postData.Parent); job.FullName = parentJob == null ? postData.Text : $"{parentJob.FullName}/{postData.Text}"; job.TreeLevel = parentJob == null ? 1 : parentJob.TreeLevel + 1; job.IsFinal = parentJob == null ? 0 : job.IsFinal; if (parentJob != null) { parentJob.IsFinal = 0; _dbContext.Update(parentJob); } vm.success = _dbContext.Update(job); } else if (postData.Operation == TreeNodeOper.COPY_NODE) { throw new NotImplementedException(); } return(vm); }
public ResponseViewModel OperConfigGroup(TreePostData postData) { Guard.Against.Null(postData, nameof(postData)); ResponseViewModel vm = new ResponseViewModel(); if (postData.Operation == TreeNodeOper.DELETE_NODE) { vm.success = _configService.DeleteFapConfigGroup(postData.Id); } else if (postData.Operation == TreeNodeOper.CREATE_NODE) { FapConfigGroup configGroup = new FapConfigGroup() { Pid = postData.Id, CfName = postData.Text }; _configService.CreateFapConfigGroup(configGroup); vm.success = true; vm.data = configGroup.Fid; } else if (postData.Operation == TreeNodeOper.RENAME_NODE) { var configGroup = _dbContext.Get <FapConfigGroup>(postData.Id); configGroup.CfName = postData.Text; vm.success = _configService.EditFapConfigGroup(configGroup); } else if (postData.Operation == TreeNodeOper.MOVE_NODE) { var configGroup = _dbContext.Get <FapConfigGroup>(postData.Id); configGroup.Pid = postData.Parent; vm.success = _configService.EditFapConfigGroup(configGroup); } else if (postData.Operation == TreeNodeOper.COPY_NODE) { throw new NotImplementedException(); } return(vm); }
public ResponseViewModel OperSchemeCategory(TreePostData postData) { ResponseViewModel vm = new ResponseViewModel(); if (postData.Operation == TreeNodeOper.DELETE_NODE) { int c = _dbContext.DeleteExec(nameof(PerfProgramCategory), "Fid=@Fid", new DynamicParameters(new { Fid = postData.Id })); vm.success = c > 0 ? true : false; } else if (postData.Operation == TreeNodeOper.CREATE_NODE) { PerfProgramCategory ppc = new PerfProgramCategory { Pid = postData.Id, Name = postData.Text }; _dbContext.Insert(ppc); vm.success = true; vm.data = ppc.Fid; } else if (postData.Operation == TreeNodeOper.RENAME_NODE) { var prmCategory = _dbContext.Get <PerfProgramCategory>(postData.Id); prmCategory.Name = postData.Text; vm.success = _dbContext.Update(prmCategory); } else if (postData.Operation == TreeNodeOper.MOVE_NODE) { var prmCategory = _dbContext.Get <PerfProgramCategory>(postData.Id); prmCategory.Pid = postData.Parent; vm.success = _dbContext.Update(prmCategory); } else if (postData.Operation == TreeNodeOper.COPY_NODE) { throw new NotImplementedException(); } return(vm); }
public JsonResult OperProcessGroup(TreePostData postData) { ResponseViewModel vm = new ResponseViewModel(); if (postData.Operation == TreeNodeOper.DELETE_NODE) { int c = _dbContext.DeleteExec(nameof(WfProcessGroup), " Fid=@Fid", new DynamicParameters(new { Fid = postData.Id })); vm.success = c > 0 ? true : false; } else if (postData.Operation == TreeNodeOper.CREATE_NODE) { WfProcessGroup processGroup = new WfProcessGroup() { Pid = postData.Id, GroupName = postData.Text }; _dbContext.Insert <WfProcessGroup>(processGroup); vm.success = true; vm.data = processGroup.Fid; } else if (postData.Operation == TreeNodeOper.RENAME_NODE) { var processGroup = _dbContext.Get <WfProcessGroup>(postData.Id); processGroup.GroupName = postData.Text; vm.success = _dbContext.Update <WfProcessGroup>(processGroup); } else if (postData.Operation == "move_node") { var processGroup = _dbContext.Get <WfProcessGroup>(postData.Id); processGroup.Pid = postData.Parent; vm.success = _dbContext.Update(processGroup); } else if (postData.Operation == TreeNodeOper.COPY_NODE) { throw new NotImplementedException(); } return(Json(vm)); }
public JsonResult OperBusinessType(TreePostData postData) { ResponseViewModel vm = new ResponseViewModel(); if (postData.Operation == TreeNodeOper.DELETE_NODE) { int c = _dbContext.DeleteExec(nameof(WfBusinessType), " Fid=@Fid", new DynamicParameters(new { Fid = postData.Id })); vm.success = c > 0 ? true : false; } else if (postData.Operation == TreeNodeOper.CREATE_NODE) { WfBusinessType bizType = new WfBusinessType() { Pid = postData.Id, TypeName = postData.Text }; _dbContext.Insert(bizType); vm.success = true; vm.data = bizType.Fid; } else if (postData.Operation == TreeNodeOper.RENAME_NODE) { var bizType = _dbContext.Get <WfBusinessType>(postData.Id); bizType.TypeName = postData.Text; vm.success = _dbContext.Update(bizType); } else if (postData.Operation == "move_node") { var bizType = _dbContext.Get <WfBusinessType>(postData.Id); bizType.Pid = postData.Parent; vm.success = _dbContext.Update(bizType); } else if (postData.Operation == TreeNodeOper.COPY_NODE) { throw new NotImplementedException(); } return(Json(vm)); }
public ResponseViewModel OperUserGroup(TreePostData postData) { ResponseViewModel vm = new ResponseViewModel(); if (postData.Operation == TreeNodeOper.DELETE_NODE) { vm.success = _rbacService.DeleteUserGroup(postData.Id); } else if (postData.Operation == TreeNodeOper.CREATE_NODE) { FapUserGroup userGroup = new FapUserGroup() { Pid = postData.Id, UserGroupName = postData.Text }; _rbacService.CreateUserGroup(userGroup); vm.success = true; vm.data = userGroup.Fid; } else if (postData.Operation == TreeNodeOper.RENAME_NODE) { var userGroup = _dbContext.Get <FapUserGroup>(postData.Id); userGroup.UserGroupName = postData.Text; vm.success = _rbacService.EditUserGroup(userGroup); } else if (postData.Operation == "move_node") { var userGroup = _dbContext.Get <FapUserGroup>(postData.Id); userGroup.Pid = postData.Parent; vm.success = _rbacService.EditUserGroup(userGroup); } else if (postData.Operation == TreeNodeOper.COPY_NODE) { throw new NotImplementedException(); } return(vm); }
public ResponseViewModel OperBusinessRole(TreePostData postData) { ResponseViewModel vm = new ResponseViewModel(); if (postData.Operation == TreeNodeOper.DELETE_NODE) { vm.success = _rbacService.DeleteBizRole(postData.Id); } else if (postData.Operation == TreeNodeOper.CREATE_NODE) { FapBizRole bizRole = new FapBizRole() { Pid = postData.Id, BizRoleName = postData.Text }; _rbacService.CreateBizRole(bizRole); vm.success = true; vm.data = bizRole.Fid; } else if (postData.Operation == TreeNodeOper.RENAME_NODE) { var bizRole = _dbContext.Get <FapBizRole>(postData.Id); bizRole.BizRoleName = postData.Text; vm.success = _rbacService.EditBizRole(bizRole); } else if (postData.Operation == "move_node") { var bizRole = _dbContext.Get <FapBizRole>(postData.Id); bizRole.Pid = postData.Parent; vm.success = _rbacService.EditBizRole(bizRole); } else if (postData.Operation == TreeNodeOper.COPY_NODE) { throw new NotImplementedException(); } return(vm); }
public JsonResult GetMoveDept(TreePostData postData) { var rv = _organizationService.MoveDepartment(postData); return(Json(rv)); }
public JsonResult OperSchemeCategory(TreePostData postData) { var result = _assessService.OperSchemeCategory(postData); return(Json(result)); }
public JsonResult OperUserGroup(TreePostData postData) { var result = _organizationService.OperOrgJob(postData); return(Json(result)); }
public JsonResult OperUserGroup(TreePostData postData) { var result = _manageService.OperUserGroup(postData); return(Json(result)); }
public JsonResult OperBusinessRole(TreePostData postData) { var result = _manageService.OperBusinessRole(postData); return(Json(result)); }
public JsonResult GetOperRoleGroupData(TreePostData postData) { var result = _manageService.OperRoleGroup(postData); return(Json(result)); }