Пример #1
0
        public CreateRolePermissionOut CreateRolePermission(CreateRolePermissionIn input)
        {
            CreateRolePermissionOut output = new CreateRolePermissionOut()
            {
                result = Entities.Common.Result.Error
            };

            using (var dataContext = DataContextHelper.GetDataContext <RoleDataContext>())
            {
                var linqResult = dataContext.spr_setRolePermission(input.rolePermission.rl_code,
                                                                   input.rolePermission.pm_code,
                                                                   input.rolePermission.rp_creationUser);
                if (linqResult > 0)
                {
                    output.rpID   = linqResult;
                    output.result = Entities.Common.Result.Success;
                }
            }
            return(output);
        }
Пример #2
0
        public CreateRolePermissionOut CreateRolePermission(CreateRolePermissionIn input)
        {
            var output = new CreateRolePermissionOut()
            {
                result = Entities.Common.Result.Error
            };
            var listresult = new List <MethodParameters.Controllers.SystemManagementApi.Role.CreateRolePermissionOut.CreateRolePermission>();
            var request    = new Business.Role.Role();

            foreach (var item in input.listRolePermission)
            {
                var createRoletOut = request.CreateRolePermission(new MethodParameters.Role.CreateRolePermissionIn()
                {
                    rolePermission = new Entities.Database.RolePermission()
                    {
                        rl_code         = item.rl_code,
                        pm_code         = item.pm_code,
                        rp_creationUser = item.rp_creationUser
                    }
                });

                if (createRoletOut.result != Entities.Common.Result.Success)
                {
                    MethodParameters.Controllers.SystemManagementApi.Role.CreateRolePermissionOut.CreateRolePermission result = null;
                    result.rpID   = createRoletOut.rpID;
                    result.deatil = createRoletOut.result;
                    listresult.Add(result);
                }


                if (listresult.Count() == 0)
                {
                    output.result = Entities.Common.Result.Success;
                }
            }
            return(output);
        }