
加好友 发短信
等级:幼狐
帖子:126
积分:898
威望:0
精华:0
注册:2016/8/2 9:17:00
|
Post By:2017/1/10 23:19:00 [显示全部帖子]
If e.DataCol.Name.EndsWith("L") Then If e.newvalue > "" Then Dim cname As String = e.DataCol.name.Replace("L", "") If e.DataTable.DataCols.Contains(cname) Then e.DataRow(cname) = val(e.NewValue) End If cname = e.DataCol.name.Replace("L", "LN") If e.DataTable.DataCols.Contains(cname) Then e.DataRow(cname) = Math.Log(val(e.NewValue), Math.E) End If End If End If Select Case e.DataCol.Name Case "高锰酸盐指数" ,"氨氮","总磷" If e.DataRow.IsNull("高锰酸盐指数") OrElse e.DataRow.IsNull("氨氮") OrElse e.DataRow.IsNull("总磷") Then Return Dim dic As new Dictionary(of String, Double()) dic.Add("高锰酸盐指数", new Double() {4,6,10,15,999}) dic.Add("氨氮", new Double() {0.5,1,1.5,2,999}) dic.Add("总磷", new Double() {0.025,0.05,0.1,0.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 & "(" & e.DataRow(key) & ")" n = n & "," & format((e.DataRow(key)-ary(bz-2)) / 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 = {"", "", "Ⅱ类", "Ⅲ类", "Ⅳ类", "Ⅴ类", "劣Ⅴ类"} e.DataRow("规划类别数值") = fdr("类别") e.DataRow("规划类别") = ary(fdr("类别")) End If Case "高锰酸盐指数LN","总磷LN","总氮LN","叶绿素LN","透明度LN" Dim jg As Double = 0.1834 * 10 * (0.109 + 2.661 * e.DataRow("高锰酸盐指数LN")) + 0.1879 * 10 * (9.436 + 1.624 * e.DataRow("总磷LN")) + 0.18 * 10 * (5.453 + 1.694 * e.DataRow("总氮LN")) + 0.2663 * 10 * (2.5 + 1.086 * e.DataRow("叶绿素LN"))+ 0.1834 * 10 * (5.118 - 1.94 * e.DataRow("透明度LN")) If jg < 30 e.DataRow("营养状态") = "贫营养" ElseIf jg < 50 e.DataRow("营养状态") = "中营养" ElseIf jg < 60 e.DataRow("营养状态") = "轻度富营养" ElseIf jg < 70 e.DataRow("营养状态") = "中度富营养" ElseIf jg > 70 e.DataRow("营养状态") = "重度富营养" End If End Select
[此贴子已经被作者于2017/1/10 23:23:04编辑过]
|
|