Ejemplo n.º 1
0
        /// <summary>
        ///     复制
        /// </summary>
        /// <param name="input">复制信息</param>
        /// <returns></returns>
        public async Task <OperateStatus> CopyPost(SystemCopyInput input)
        {
            var operateStatus = new OperateStatus();

            try
            {
                //获取信息
                var role = await GetByIdAsync(input.Id);

                role.PostId     = CombUtil.NewComb();
                role.Name       = input.Name;
                role.CreateTime = DateTime.Now;

                //获取拥有的权限及人员
                var allUser = (await _permissionUserLogic.GetPermissionUsersByPrivilegeMasterAdnPrivilegeMasterValue(EnumPrivilegeMaster.岗位,
                                                                                                                     input.Id)).ToList();
                var allPer = (await _permissionLogic.GetSystemPermissionsByPrivilegeMasterValueAndValue(EnumPrivilegeMaster.岗位, input.Id)).ToList();
                foreach (var user in allUser)
                {
                    user.PrivilegeMasterValue = role.PostId;
                }
                foreach (var per in allPer)
                {
                    per.PrivilegeMasterValue = role.PostId;
                }
                //批量插入
                operateStatus = await _permissionUserLogic.InsertMultipleAsync(allUser);

                operateStatus = await _permissionLogic.InsertMultipleAsync(allPer);

                operateStatus = await InsertAsync(role);

                operateStatus.Message    = Chs.Successful;
                operateStatus.ResultSign = ResultSign.Successful;
            }
            catch (Exception e)
            {
                operateStatus.Message = e.Message;
            }
            return(operateStatus);
        }
Ejemplo n.º 2
0
 public async Task <JsonResult> CopyRole(SystemCopyInput input)
 {
     input.CreateUserId   = _currentUser.UserId;
     input.CreateUserName = _currentUser.Name;
     return(Json(await _roleLogic.CopyRole(input)));
 }