Select Case e.DataCol.Name Case "高锰酸盐指数","五日生化需氧量","氨氮", "规划类别数值" Dim dic As new Dictionary(of String, Double()) dic.Add("高锰酸盐指数", new Double() {4,6,10,15,999}) dic.Add("五日生化需氧量", new Double() {3,4,6,10,999}) dic.Add("氨氮", new Double() {0.5,1,1.5,2,999}) Dim s As String = "" Dim n As String = "" Dim max As Double = 0 Dim bz As Integer = e.DataRow("规划类别数值") If bz >= 2 Then For Each key As String In dic.Keys Dim ary() As Double = dic(key) For i As Integer = 0 To ary.length - 1 If e.DataRow(key) <= ary(i) Then If i+2 > max Then max = i+2 End If If i+2 > bz Then s = s & "," & key n = n & "," & format(e.DataRow(key) / ary(bz-2), "0.##") End If Exit For End If Next Next End If e.DataRow("超标项目") = s.trim(",") e.DataRow("超标倍数") = n.trim(",") Dim ary1() As String = {"", "", "Ⅱ类", "Ⅲ类", "Ⅳ类", "Ⅴ类", "劣Ⅴ类"} e.DataRow("断面类别数值") = max e.DataRow("断面类别") = ary1(max) Case "断面名称" Dim fdr As DataRow = DataTables("名称类别").find("名称 = '" & e.DataRow("断面名称") & "'") If fdr IsNot Nothing Then Dim ary() As String = {"", "", "Ⅱ类", "Ⅲ类", "Ⅳ类", "Ⅴ类", "劣Ⅴ类"} systemready = False e.DataRow("规划类别数值") = fdr("类别") e.DataRow("规划类别") = ary(fdr("类别")) systemready = True End If End Select
|