Example #1
0
        public JsonResult RolesAssignUpdate(UserRolesForm model)
        {
            model.InputUser = AppBusiness.loginModel.UserNo;
            JsonResponses responses = assignSDK.CreateUserRoles(model);

            return(Json(responses, JsonRequestBehavior.AllowGet));
        }
Example #2
0
        public int UserRolesInsert(UserRolesForm model)
        {
            int result = 0;

            //删除原有权限
            DataHandleManager.Instance().PsUserRolesHandle.DeleteUserRoles(model.userNo);
            PsUserRoles userRoles = null;

            if (model.rolesNos != null)
            {
                model.rolesNos = model.rolesNos.Distinct().ToArray();
                foreach (var nos in model.rolesNos)
                {
                    PsRoles roles = DataHandleManager.Instance().PsRolesHandle.GetRolesInfo(nos);
                    if (roles != null)
                    {
                        userRoles = new PsUserRoles()
                        {
                            RolesNo    = nos,
                            UserNo     = Convert.ToInt64(model.userNo),
                            InputUser  = model.inputUser,
                            InputTime  = DateTime.Now,
                            UpdateTime = DateTime.Now
                        };
                        result += DataHandleManager.Instance().PsUserRolesHandle.Insert(userRoles);
                    }
                }
            }
            return(result);
        }
Example #3
0
        public ActionResult <JsonResponses> CreateUserRoles([FromBody] UserRolesForm model)
        {
            var ResultCode = -1;

            DataHandleManager.Instance().UcUsersHandle.CheckUserNoIsExist(model.userNo);
            if (model.rolesNos != null)
            {
                DataHandleManager.Instance().PsRolesHandle.CheckRolesNosIsExist(model.rolesNos.ToList());
            }
            ResultCode = DataHandleManager.Instance().PsUserRolesHandle.UserRolesInsert(model);
            return(ResultCode > 0 ? JsonResponses.Success : JsonResponses.Failed);
        }
Example #4
0
 /// <summary>
 /// 用户角色授权
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public JsonResponses CreateUserRoles(UserRolesForm model)
 {
     try
     {
         RequestBase request = RequestBase.PostJson as RequestBase;
         request.Url = CreateUserRolesUrl;
         request.SetJsonValue(model);
         return(sdkUtil.PostForVo(request));
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.ToString());
     }
     return(JsonResponses.Failed);
 }