web/web/SysUser.ashx
@@ -34,6 +34,9 @@
            //修改密码
            case "updatePwd":
                return UpdatePwd(context);
            //根据数组字符串转换字典
            case "arrayStrToDict":
                return ArrayStrToDict(context);
            default:
                throw new Exception("Invalid Action=" + @string);
@@ -88,7 +91,8 @@
    private JsonPageResult LoadUserMenuList(PageContext<SysUser> context)
    {
        context.CheckRight("104", FailedOperation.PromptOnly);
        return new JsonPageResult(true, (object) this._Dao.LoadUserMenuList(context.GetInt("userid")).Keys);
        //return new JsonPageResult(true, (object) this._Dao.LoadUserMenuList(context.GetInt("userid")).Keys);
        return new JsonPageResult(true, (object) this._Dao.LoadUserRoleMenuList(context.GetInt("userid")).Keys);
    }
    private JsonPageResult SaveUser(PageContext<SysUser> context)
@@ -98,6 +102,15 @@
        string string2 = context.GetString("password");
        string userName = context.GetString("userName");
        string userType = context.GetString("userType");
        List<string> tmpList = new List<string>();
        //数组合并
        tmpList.AddRange( JsonConvert.DeserializeObject<string[]>(context.GetString("userType")) );
        //数组去重
        string[] tmpArray = DataConverter.DelRepeatData(tmpList.ToArray() );
        userType = string.Join(",", tmpArray) ;
        string string3 = context.GetString("email");
        string string4 = context.GetString("mobile");
        int int2 = context.GetInt("emailFlag");
@@ -140,7 +153,7 @@
            throw new ArgumentException("账户名称已经存在,请重新输入!");
        sysUser.UserName = userName;
        sysUser.UserType = string.IsNullOrEmpty(userType) ? 0 : int.Parse(userType);
        sysUser.UserType = userType;
        sysUser.CreateTime = DateTime.Now;
        /**
@@ -249,5 +262,24 @@
        _Dao.UpdatePwd(account, newPwd );
        return new JsonPageResult(true, (object)"修改密码成功!");
    }
    //根据数组字符串转换字典
    private JsonPageResult ArrayStrToDict(PageContext<Model.SysUser> context)
    {
        string userId = context.GetString("userId");
        string userType = context.GetString("userType");
        Dictionary<string, object> dictionary = new Dictionary<string, object>();
        List<object> list = DataConverter.stringToList(userType);
        for (int i = 0; i < list.Count; i++)
        {
            //dictionary[userId.ToString()] = list[i];
            dictionary[list[i].ToString()] = list[i];
        }
        return new JsonPageResult(true, dictionary.Keys);
    }
}