Foxtable(狐表)用户栏目专家坐堂 → [求助]


  共有3048人关注过本帖树形打印复制链接

主题:[求助]

帅哥哟,离线,有人找我吗?
有点甜
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2018/8/2 15:43:00 [显示全部帖子]

代码

 

Dim dt As DataTable = DataTables("test")
dt.ResumeRedraw
dt.StopRedraw
Dim xxmcs = dt.getvalues("学校名称", "学校名称 is not null")
Dim ls_drs As new List(of object)
dt.ReplaceFor("选择", False)
For Each xxmc As String In xxmcs
    Dim drs = dt.Select("学校名称 = '" & xxmc & "' and 填答检测 = '正常完成'")
    Dim ls_dr As new List(of DataRow)
    If drs.count >= 140 Then
        Dim cnt = drs.count-1
        Dim ids As new List(of Integer)
        For i As Integer = 0 To cnt
            ids.Add(i)
        Next
        For i As Integer = 0 To cnt*5 '洗牌次数
            Dim id1 As Integer = rand.Next(0,cnt)
            Dim id2 As Integer = rand.Next(0,cnt)
            Dim vid As Integer = ids(id1)
            ids(id1) = ids(id2)
            ids(id2) = vid
        Next
       
        For i As Integer = 0 To 140-1
            ls_dr.add(drs(ids(i)))
        Next
    Else
        For Each dr As DataRow In drs
            ls_dr.add(dr)
        Next
        drs = dt.Select("学校名称 = '" & xxmc & "' and 填答检测 = '过快提交'")
        Dim cnt = drs.count-1
        Dim ids As new List(of Integer)
        For i As Integer = 0 To cnt
            ids.Add(i)
        Next
        For i As Integer = 0 To cnt '洗牌次数
            Dim id1 As Integer = rand.Next(0,cnt)
            Dim id2 As Integer = rand.Next(0,cnt)
            Dim vid As Integer = ids(id1)
            ids(id1) = ids(id2)
            ids(id2) = vid
        Next
        If drs.count + ls_dr.count >= 140
            For i As Integer = 0 To 140-ls_dr.count-1
                ls_dr.add(drs(ids(i)))
            Next
        Else
            For Each dr As DataRow In drs
                ls_dr.add(dr)
            Next
        End If
    End If
    output.show(xxmc & ls_dr.count)
    ls_drs.add(ls_dr)
Next
For Each ls_dr As object In ls_drs
    For Each dr As DataRow In ls_dr
        dr("选择") = True
        'output.show(Date.now)
    Next
Next
'Tables("test").filter = "选择 = true"
dt.ResumeRedraw

 

 

 下载信息  [文件大小:   下载次数: ]
图片点击可在新窗口打开查看点击浏览该文件:管理项目33.rar


 回到顶部