-- 作者:有点甜
-- 发布时间: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
|