📄 quyugonggao.aspx.vb
字号:
End If '不为分局
If Mid(str, 1, 2) = "科室" Then
Label1.Text = "提示:该区域不能发布公告"
Label1.Visible = True
Dim int As Integer = 0
If int <> 0 Then
dnode = TreeView1.SelectedNode.Parent
snode = dnode.Parent
shengnode = snode.Parent
shengc = shengnode.Text.Length
sc = snode.Text.Length
dc = dnode.Text.Length
kc = str.Length
Dim fens = "select distinct kecode,deptcode,quyucode from quyuinfo where sf='" + Mid(shengnode.Text, 4, shengc - 3) + "' and quyuname='" + Mid(snode.Text, 4, sc - 3) + "' and deptname='" + Mid(dnode.Text, 4, dc - 3) + "' and kename='" + Mid(TreeView1.SelectedNode.Text, 4, kc - 3) + "'"
Dim fenr As SqlDataReader = pulic.execute(fens)
While fenr.Read()
quyucode = fenr("quyucode").trim
deptcode = fenr("deptcode").trim
kecode = fenr("kecode").trim
lei.a = quyucode
lei.b = deptcode
lei.c = kecode
lei.d = "kkk"
End While
fenr.Close()
If ((Session("bz") = "admin") Or (Session("quyucode") = quyucode And Session("bz") = "sss") Or (Session("quyucode") = quyucode And Session("deptcode") = deptcode And Session("bz") = "fff")) Then
' Button8.Enabled = true 屏蔽代码
' Button10.Enabled = true
fens = "select count(*) from gonggao_quyu where quyucode='" + quyucode + "' and deptcode='" + deptcode + "' and kecode='" + kecode + "' and taxcode='kkk'"
Dim count As Integer = Convert.ToInt32(pulic.noquery(fens)) 'count中即为总数目
If count <> 0 Then
fens = "select start,stop,info from gonggao_quyu where quyucode='" + quyucode + "' and deptcode='" + deptcode + "' and kecode='" + kecode + "' and taxcode='kkk'"
fenr = pulic.execute(fens)
While fenr.Read()
start = fenr("start").trim
sp = fenr("stop").trim
TextBox1.Text = fenr("info").trim
Button2.Enabled = True
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
'button8.enabled=true 屏蔽代码
End If
Else
Label1.Text = "提示:无公告内容"
Label1.Visible = True
End If
End If
End If '不为 科室
If Mid(str, 1, 2) = "片区" Then
knode = TreeView1.SelectedNode.Parent
dnode = knode.Parent
snode = dnode.Parent
shengnode = snode.Parent
shengc = shengnode.Text.Length
sc = snode.Text.Length
dc = dnode.Text.Length
kc = knode.Text.Length
tc = str.Length
Dim fens = "select distinct taxcode,kecode,deptcode,quyucode from quyuinfo where sf='" + Mid(shengnode.Text, 4, shengc - 3) + "' and quyuname='" + Mid(snode.Text, 4, sc - 3) + "' and deptname='" + Mid(dnode.Text, 4, dc - 3) + "' and kename='" + Mid(knode.Text, 4, kc - 3) + "' and taxname='" + Mid(TreeView1.SelectedNode.Text, 4, tc - 3) + "'"
Dim fenr As SqlDataReader = pulic.execute(fens)
While fenr.Read()
quyucode = fenr("quyucode").trim
deptcode = fenr("deptcode").trim
kecode = fenr("kecode").trim
taxcode = fenr("taxcode").trim
lei.a = quyucode
lei.b = deptcode
lei.c = kecode
lei.d = taxcode
End While
fenr.Close()
If ((Session("bz") = "admin") Or (Session("quyucode") = quyucode And Session("bz") = "sss") Or (Session("quyucode") = quyucode And Session("deptcode") = deptcode And Session("bz") = "fff") Or (Session("quyucode") = quyucode And Session("deptcode") = deptcode And Session("kecode") = kecode And Session("bz") = "kkk")) Then
Button1.Enabled = True
' Button10.Enabled = true
fens = "select count(*) from gonggao_quyu where quyucode='" + quyucode + "' and deptcode='" + deptcode + "' and kecode='" + kecode + "' and taxcode='" + taxcode + "'"
Dim count As Integer = Convert.ToInt32(pulic.Scalar(fens)) 'count中即为总数目
If count <> 0 Then
Button2.Enabled = True
fens = "select start,stop,info from gonggao_quyu where quyucode='" + quyucode + "' and deptcode='" + deptcode + "' and kecode='" + kecode + "' and taxcode='" + taxcode + "'"
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
TextBox1.Text = ""
End If
End If
End If
End Sub
Protected Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim del As New String("delete from gonggao_quyu where quyucode='" + lei.a + "' and deptcode='" + lei.b + "' and kecode='" + lei.c + "' and taxcode='" + lei.d + "'")
pulic.noquery(del)
TextBox1.Text = ""
Button2.Enabled = False
TextBox3.Text = Format(Now(), "yyyy-MM-dd")
TextBox2.Text = Format(Now(), "yyyy-MM-dd")
' MsgBox("删除成功!", 0, "提示:")
Label1.Text = "提示:删除成功"
Label1.Visible = True
End Sub
Protected Sub Button3_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button3.Click
Response.Redirect("index.aspx")
End Sub
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
If IsValid Then
If TextBox1.Text.Trim = "" Then
' MsgBox("发布的错误公告不能为空!", 0, "提示:")
Label1.Text = "提示:发布的错误公告不能为空"
Label1.Visible = True
Exit Sub
End If
If TreeView1.SelectedValue = "" Then
' MsgBox("没有选择区域,无法保存!", 0, "提示:")
Label1.Text = "提示:没有选择区域,无法保存"
Label1.Visible = True
Exit Sub
End If
Dim strL As Integer = 0
Dim s As String
For i As Integer = 1 To TextBox1.Text.Length
s = Mid(TextBox1.Text, i, 1)
If Asc(s) < 0 Then
strL += 2
Else
strL += 1
End If
Next
If strL < 78 Then
Dim start = Mid(TextBox2.Text, 1, 4) + Mid(TextBox2.Text, 6, 2) + Mid(TextBox2.Text, 9, 2)
Dim sp = Mid(TextBox3.Text, 1, 4) + Mid(TextBox3.Text, 6, 2) + Mid(TextBox3.Text, 9, 2)
Dim del As New String("delete from gonggao_quyu where quyucode='" + lei.a + "' and deptcode='" + lei.b + "' and kecode='" + lei.c + "' and taxcode='" + lei.d + "'")
pulic.noquery(del)
Dim strSQL1 As String = "INSERT INTO gonggao_quyu(quyucode,deptcode,kecode,taxcode,start,stop,info,flage) values ('" & lei.a & "','" & lei.b & "','" & lei.c & "','" & lei.d & "','" & start & "','" & sp & "','" & TextBox1.Text.Trim & "','1')"
pulic.noquery(strSQL1)
Label1.Text = "提示:公告发布成功"
Label1.Visible = True
Button2.Enabled = True
Else
'MsgBox("发布的公告长度超出最大值!", 0, "提示:")
Label1.Text = "提示:发布的公告长度超出最大值"
Label1.Visible = True
End If
End If
End Sub
Protected Sub CustomValidator1_ServerValidate(ByVal source As Object, ByVal args As System.Web.UI.WebControls.ServerValidateEventArgs) Handles CustomValidator1.ServerValidate
Dim st1 = Mid(TextBox2.Text, 1, 4) + Mid(TextBox2.Text, 6, 2) + Mid(TextBox2.Text, 9, 2)
Dim sp1 = Mid(TextBox3.Text, 1, 4) + Mid(TextBox3.Text, 6, 2) + Mid(TextBox3.Text, 9, 2)
If (st1 > sp1) Or (TextBox2.Text.Trim.Length <> 10) Or (TextBox3.Text.Trim.Length <> 10) Then
args.IsValid = False
Label1.Visible = False
Else
args.IsValid = True
End If
End Sub
End Class
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -