コード例 #1
0
 /// <summary>
 /// 编辑
 /// </summary>
 /// <param name="orgid"></param>
 /// <returns></returns>
 public ActionResult Edit(string roleid)
 {
     if (!string.IsNullOrEmpty(roleid))
     {
         SysRoleEntity entity = roleLogic.Load(roleid);
         return(View(entity));
     }
     return(View(new OrganizationEntity()));
 }
コード例 #2
0
        public ActionResult SaveUserRole(string roles, string userid)
        {
            try
            {
                List <SysUserRoleEntity> roleList = new List <SysUserRoleEntity>();
                string[] list = roles.Split(',');

                for (int i = 0; i < list.Length; i++)
                {
                    if (list[i] != "")
                    {
                        SysUserRoleEntity userrole = new SysUserRoleEntity();
                        userrole.RoleId = list[i];
                        SysRoleEntity role = rolelogic.Load(userrole.RoleId);
                        userrole.RoleName = role.RoleName;
                        userrole.UserId   = userid;
                        UserInfoEntity usentity = userLogic.Load(userrole.UserId);
                        userrole.UserName = usentity.UserName;
                        roleList.Add(userrole);
                    }
                }
                bool isOk = sysuserroleLogic.SaveUserRole(roleList);
                if (isOk == true)
                {
                    return(Json("ok"));
                }
                else
                {
                    return(Json("no"));
                }
            }
            catch (Exception ex)
            {
                return(Json("no"));
            }
        }