--
cnt 值还是不会自动更新呢。 \'设置表设备的筛选加载
Dim bm As String
Dim cmd As New SQLCommand
Dim dt As DataTable
cmd.C
S elect Case user.Type
Case UserTypeEnum.Developer,UserTypeEnum.Administrator
cmd.CommandText = "S ELECT DISTINCT 所属部门,所在位置 From {设备}"
Case UserTypeEnum.User
S elect Case user.group
Case "桩基部"
bm = "桩基部"
Case "建材部"
bm = "建材部"
Case "环境部"
bm ="环境部"
Case "结构部"
bm ="结构部"
Case "路桥部"
bm ="路桥部"
Case "管理层","管理部","报告室"
cmd.CommandText = "S ELECT DISTINCT 所属部门,所在位置 From {设备}"
End S elect
cmd.CommandText = "S ELECT DISTINCT 所属部门,所在位置 From {设备} where 所属部门=\'" & bm & "\'"
End S elect
dt = cmd.ExecuteReader()
Dim trv As WinForm.TreeView = e.Form.Controls("TreeView1")
trv.BuildTree(dt,"所属部门|所在位置")
S elect Case user.Type
Case UserTypeEnum.Developer,UserTypeEnum.Administrator
trv.Nodes.Insert("所有设备",0)
Case UserTypeEnum.User
Select Case user.group
Case "管理部","管理层"
trv.Nodes.Insert("所有设备",0)
Case Else
\'\'
End Select
End Select
\'设置导航
Dim Page1 As WinForm.Topicpage
Dim Page2 As WinForm.Topicpage
Dim filter As String = DataTables("设备").LoadFilter
If filter > "" Then
filter = filter & "and "
Dim cnt1 As Integer = DataTables("设备").SQLCompute("Count(设备编号)", filter & "[有效期] <= 0 and 设备状态=\'正常\'")
Dim cnt2 As Integer = DataTables("设备").SQLCompute("Count(设备编号)",filter & "有效期 < 30 And 有效期 > 0 And 设备状态=\'正常\'")
Dim cnt3 As Integer = DataTables("设备").SQLCompute("Count(设备编号)",filter & "设备状态=\'正常\'")
Dim cnt4 As Integer = DataTables("设备").SQLCompute("Count(设备编号)",filter & "设备状态=\'停用\'")
Dim cnt5 As Integer = DataTables("设备").SQLCompute("Count(设备编号)",filter & "设备状态=\'报废\'")
Dim cnt6 As Integer = DataTables("设备").SQLCompute("Count(设备编号)",filter & "设备状态 is null")
Page1 = e.Form.Controls("TopicBar1").Pages.Add("设备检定","设备检定")
Page1.Links.Add("已过期","已过期(" & cnt1 & ")" )
Page1.Links.Add("即将过期","即将过期(" & cnt2 & ")" )
Page2 = e.Form.Controls("TopicBar1").Pages.Add("设备状态","设备状态")
Page2.Links.Add("正常","正常(" & cnt3 & ")" )
Page2.Links.Add("停用","停用(" & cnt4 & ")" )
Page2.Links.Add("报废","报废(" & cnt5 & ")" )
Page2.Links.Add("其他","其他(" & cnt6 & ")" )
End If
Dim dh As WinForm.Form = Forms("设备导航")
dh.TimerEnabled=True
dh.TimerInterval = 60