📄 quyugonggao.aspx.vb
字号:
Imports System.Data.SqlClient
Imports system.configuration
Imports System.Web.Configuration
Imports System.Data
Imports System.Drawing
Partial Class quyugonggao
Inherits System.Web.UI.Page
Public Class lei
Public Shared a, b, c, d As String
End Class
Public pulic As New pulic1
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If (Not IsPostBack) Then
Button2.Enabled = False
Dim i, j, l, p, q As Integer
Dim sf, shi, dept, ke, tax, shis, depts, kes, taxs As String
Dim s(4), ss(4), k(8), kk(8), t(20), tt(20), d(15), dd(15) As String
TreeView1.Nodes.Clear()
Dim str = "select distinct sf from quyuinfo where sf is not NULL"
Dim myReader As SqlDataReader = pulic.execute(str)
Dim node As New TreeNode
While myReader.Read()
sf = myReader("sf").trim
node.Text = "省份:" + sf
TreeView1.Nodes.Add(node)
End While
myReader.Close()
i = 0
j = 0
l = 0
p = 0
q = 0
If Session("bz") = "admin" Then
shis = "select distinct quyucode, quyuname from quyuinfo where sf=" + sf.Trim + " and quyucode is not NULL"
Else
shis = "select distinct quyucode, quyuname from quyuinfo where sf='" + sf.Trim + "' and quyucode ='" + Session("quyucode") + "'"
End If
Dim shir As SqlDataReader = pulic.execute(shis)
While shir.Read()
i = i + 1
s(i) = shir("quyuname").trim
ss(i) = shir("quyucode").trim
End While
shir.Close()
While i > 0
Dim shinode As New TreeNode
shi = s(i)
shinode.Text = "市局:" + shi
node.ChildNodes.Add(shinode)
If ((Session("bz") = "admin") Or (Session("quyucode") = ss(i) And Session("bz") = "sss")) Then
depts = "select distinct deptcode,deptname from quyuinfo where quyucode='" + Session("quyucode") + "' and sf='" + sf + "' and deptcode is not null"
Else
depts = "select distinct deptcode,deptname from quyuinfo where quyucode='" + Session("quyucode") + "' and sf='" + sf + "' and deptcode='" + Session("deptcode") + "'"
End If
j = 0
Dim deptr As SqlDataReader = pulic.execute(depts)
While deptr.Read()
j = j + 1
d(j) = deptr("deptname").trim
dd(j) = deptr("deptcode").trim
End While
deptr.Close()
While j > 0
Dim deptnode As New TreeNode
dept = d(j)
deptnode.Text = "分局:" + dept
shinode.ChildNodes.Add(deptnode)
If (Session("bz") = "admin") Or (Session("quyucode") = ss(i) And Session("bz") = "sss") Or (Session("quyucode") = ss(i) And Session("bz") = "fff" And Session("deptcode") = dd(j)) Then
kes = "select distinct kecode,kename from quyuinfo where quyucode='" + ss(i) + "' and deptcode='" + dd(j) + "' and sf='" + sf + "' and kecode is not null"
Else
kes = "select distinct kecode,kename from quyuinfo where quyucode='" + ss(i) + "' and deptcode='" + dd(j) + "' and sf='" + sf + "' and kecode='" + Session("kecode") + "'"
End If
l = 0
Dim ker As SqlDataReader = pulic.execute(kes)
While ker.Read()
l = l + 1
k(l) = ker("kename").trim
kk(l) = ker("kecode").trim
End While
ker.Close()
While l > 0
Dim kenode As New TreeNode
ke = k(l)
kenode.Text = "科室:" + ke
deptnode.ChildNodes.Add(kenode)
If (Session("bz") = "admin") Or (Session("quyucode") = ss(i) And Session("bz") = "sss") Or (Session("quyucode") = ss(i) And Session("bz") = "fff" And Session("deptcode") = dd(j)) Or (Session("quyucode") = ss(i) And Session("bz") = "kkk" And Session("kecode") = kk(l) And Session("deptcode") = dd(j)) Then
taxs = "select distinct taxname from quyuinfo where kecode='" + kk(l) + "' and quyucode='" + ss(i) + "' and deptcode='" + dd(j) + "' and sf='" + sf + "' and taxcode is not null"
Else
taxs = "select distinct taxname from quyuinfo where kecode='" + kk(l) + "' and quyucode='" + ss(i) + "' and deptcode='" + dd(j) + "' and sf='" + sf + "' and taxcode='" + Session("taxcode") + "'"
End If
p = 0
Dim taxr As SqlDataReader = pulic.execute(taxs)
While taxr.Read()
p = p + 1
t(p) = taxr("taxname").trim
End While
taxr.Close()
While p > 0
Dim taxnode As New TreeNode
tax = t(p)
taxnode.Text = "片区:" + tax
kenode.ChildNodes.Add(taxnode)
p = p - 1
End While
l = l - 1
End While
j = j - 1
End While
i = i - 1
End While
TreeView1.CollapseAll()
TreeView1.ExpandAll()
End If
End Sub
Protected Sub TreeView1_SelectedNodeChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles TreeView1.SelectedNodeChanged
TextBox2.Text = Format(Now, "yyyy-MM-dd")
TextBox3.Text = Format(Now, "yyyy-MM-dd")
Dim shi, dept, ke, tax, quyucode, deptcode, kecode, taxcode, a, b, c, d As String
Dim start, sp, info As String
Dim shengc, sc, dc, kc, tc As Integer
Dim shengnode, snode, dnode, knode, tnode As New TreeNode
Dim str = TreeView1.SelectedNode.Text
Dim cp = Mid(str, 1, 2)
Label1.Visible = False
Button1.Enabled = False
Button2.Enabled = False
TextBox1.Text = ""
If Mid(str, 1, 2) = "省份" Or Mid(str, 1, 2) = "市局" Then
Label1.Text = "提示:该区域不能发布公告"
Label1.Visible = True
End If
If Mid(str, 1, 2) = "分局" Then
snode = TreeView1.SelectedNode.Parent
shengnode = snode.Parent
shengc = shengnode.Text.Length
sc = snode.Text.Length
dc = str.Length
Dim fens = "select distinct deptcode,quyucode from quyuinfo where sf='" + Mid(shengnode.Text, 4, shengc - 3) + "' and quyuname='" + Mid(snode.Text, 4, sc - 3) + "' and deptname='" + Mid(TreeView1.SelectedNode.Text, 4, dc - 3) + "'"
Dim fenr As SqlDataReader = pulic.execute(fens)
While fenr.Read()
quyucode = fenr("quyucode").trim
deptcode = fenr("deptcode").trim
lei.a = quyucode
lei.b = deptcode
lei.c = "fff"
lei.d = "fff"
End While
fenr.Close()
If ((Session("bz") = "admin") Or (Session("quyucode") = quyucode And Session("bz") = "sss")) Then
fens = "select count(*) from gonggao_quyu where quyucode='" + quyucode + "' and deptcode='" + deptcode + "' and kecode='fff'"
Dim count As Integer = Convert.ToInt32(pulic.Scalar(fens)) 'count中即为总数目
If count <> 0 Then
Button1.Enabled = True
Button2.Enabled = True
fens = "select start,stop,info from gonggao_quyu where quyucode='" + quyucode + "' and deptcode='" + deptcode + "' and kecode='fff'"
fenr = pulic.execute(fens)
While fenr.Read()
start = fenr("start").trim
sp = fenr("stop").trim
TextBox1.Text = fenr("info").trim
TextBox2.Text = Mid(start, 1, 4) + "-" + Mid(start, 5, 2) + "-" + Mid(start, 7, 2)
TextBox3.Text = Mid(sp, 1, 4) + "-" + Mid(sp, 5, 2) + "-" + Mid(sp, 7, 2)
End While
fenr.Close()
Else
'无记录
Label1.Text = "提示:无公告内容"
Label1.Visible = True
Button1.Enabled = True
End If 'bz不为admin
End If
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -