예제 #1
0
    public string commandcolumn_direct_delete(string RoleId, string UserId)
    {
        if (string.IsNullOrWhiteSpace(RoleId))
        {
            return("请选择角色信息!");
        }
        if (string.IsNullOrWhiteSpace(UserId))
        {
            return("请选择用户信息!");
        }
        var         uid = Convert.ToInt32(UserId);
        var         rid = Convert.ToInt32(RoleId);
        SspUserRole m   = new SspUserRole();

        m.UserId = uid;
        m.RoleId = rid;
        sysUserRoleManager.Delete(m);
        return("删除成功!");
    }
예제 #2
0
    public string ResetRoleAction(string users, string roles)
    {
        if (this._.设置用户角色.Permit == 0)
        {
            return("您没有进行设置用户角色的权限!");
        }
        string             Result = string.Empty;
        List <SspUserRole> lst    = new List <SspUserRole>();

        string[] userList = users.Split('|');
        string[] roleList = GetRequest("RoleID").Split('|');
        foreach (string role in roleList)
        {
            if (string.IsNullOrWhiteSpace(role))
            {
                continue;
            }
            int irole = 0;
            if (!int.TryParse(role, out irole))
            {
                continue;
            }
            foreach (string user in userList)
            {
                if (string.IsNullOrWhiteSpace(user))
                {
                    continue;
                }
                var         uid = Convert.ToInt32(user);
                SspUserRole m   = new SspUserRole();
                m.UserId       = uid;
                m.RoleId       = irole;
                m.RecordUserId = this.Data.User.UserId;
                sysUserRoleManager.Delete(m);
                sysUserRoleManager.Insert(m);
            }
        }
        sysUserRoleManager.BatchInsert(lst);
        return(Result);
    }