📄 p2pgonggao.aspx.vb
字号:
Imports System.Data.SqlClient
Imports system.configuration
Imports System.Web.Configuration
Imports System.Data
Imports System.Drawing
Partial Class p2pgonggao
Inherits System.Web.UI.Page
Public pulic As New pulic1
Public Class lei
Public Shared p2pid, p2pquyucode, p2pdeptcode, p2pkecode, p2ptaxcode, cuowu As String
End Class
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If (Not IsPostBack) Then
setFields()
chushihua()
End If
End Sub
Protected Sub setFields()
'建立命令字段
GridView1.AutoGenerateColumns = False
Dim selectField As New CommandField()
selectField.ButtonType = ButtonType.Link
selectField.ShowSelectButton = True '显示选择按钮
selectField.SelectText = "选择"
selectField.HeaderText = "按钮"
selectField.ItemStyle.Wrap = False
'建立数据绑定字段
Dim employeeidField As New BoundField()
employeeidField.DataField = "nsrname" '指定数据来源字段
employeeidField.HeaderText = "纳税人名称" '设置字段头名称
'employeeidField.SortExpression = "nsrid" '指定排序字段名称
'employeeidField.ItemStyle.Wrap = False
'employeeidField.ItemStyle.HorizontalAlign = HorizontalAlign.Center
'将字段加入到GridView
GridView1.Columns.Add(selectField)
GridView1.Columns.Add(employeeidField)
End Sub
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
chushihua()
System.Threading.Thread.Sleep(800)
Dim str As String = "select distinct nsrname,nsrid,skkid from nsrinf where nsrid is not null"
If TextBox2.Text <> "" Then
str = str + " and nsrname like '%" + TextBox2.Text().Trim + "%'"
End If
If TextBox1.Text <> "" Then
str = str + " and nsrid like '%" + TextBox1.Text().Trim + "%'"
End If
If TextBox3.Text <> "" Then
str = str + " and skkid like '%" + TextBox3.Text().Trim + "%'"
End If
Dim cmd2 As SqlDataReader = pulic.execute(str)
If cmd2.HasRows Then
GridView1.DataSource = cmd2
GridView1.AllowSorting = True
GridView1.DataBind()
Else
' UpdateProgress1.ProgressTemplate.InstantiateIn(Label1)
' MsgBox("无相关信息!", 0, "提示:")
' MsgBox("无相关信息!", 0, "提示:")
' Dim mplabel As Label = CType(PreviousPage.FindControl("label9"), Label)
' CType(PreviousPage.FindControl("label9"), Label).Text = "无相关信息!"
'Dim bb, aa As Label
'Dim con As Content
'Dim conp As ContentPlaceHolder
'Dim ajax As UpdateProgress
' Dim ajax2 As UpdatePanel
' con = Me.FindControl("Content1")
' conp = Master.FindControl("ContentPlaceHolder1")
' ajax2 = conp.FindControl("UpdatePanel1")
' ajax = ajax2.FindControl("UpdateProgress1")
'aa = DirectCast(ajax2.FindControl("label11"), Label)
' aa = ajax2.Page.FindControl("label9")
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
End If
cmd2.Close()
End Sub
Protected Sub chushihua()
UpdateProgress1.Visible = True
GridView1.DataSource = ""
GridView1.DataBind()
GridView1.SelectedRowStyle.Reset()
Session("p2pname") = ""
TextBox6.Text = ""
TextBox4.Text = ""
TextBox5.Text = ""
TextBox7.Text = ""
TextBox8.Text = ""
TextBox9.Text = Format(Now(), "yyyy-MM-dd")
TextBox10.Text = Format(Now(), "yyyy-MM-dd")
End Sub
Protected Sub gridview1_SelectedIndexChanging(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewSelectEventArgs) Handles GridView1.SelectedIndexChanging
Session("p2pname") = GridView1.Rows(e.NewSelectedIndex).Cells(1).Text.Trim
chuli()
End Sub
Protected Sub chuli()
TextBox6.Text = ""
TextBox4.Text = ""
TextBox5.Text = ""
TextBox7.Text = ""
TextBox8.Text = ""
System.Threading.Thread.Sleep(800)
Dim name As String = Session("p2pname")
Dim cmd2 As New String("select * from nsrinf where nsrname='" & name & "'")
Dim myReader As SqlDataReader = pulic.execute(cmd2)
While myReader.Read()
TextBox5.Text = name.Trim
TextBox4.Text = (myReader("nsrid")).trim
TextBox6.Text = (myReader("skkid")).trim
lei.p2pid = (myReader("nsrid")).trim
lei.p2pquyucode = myReader("quyucode").trim
lei.p2pdeptcode = myReader("deptcode").trim
lei.p2pkecode = myReader("kecode").trim
lei.p2ptaxcode = myReader("taxcode").trim
End While
myReader.Close()
Dim cmm As New String("select * from erinfo where nsrid='" & TextBox4.Text & "' and erbz='00'")
Dim myReader22 As SqlDataReader = pulic.execute(cmm)
If myReader22.HasRows Then
While myReader22.Read()
CollapsiblePanelExtender1.Collapsed = True
Button6.Enabled = True
lei.cuowu = "you"
TextBox8.Text = (myReader22("cuowuinfo")).trim
End While
Else
Button6.Enabled = False
lei.cuowu = ""
TextBox8.Text = ""
End If
myReader22.Close()
Dim cmd3 As New String("select start,stop,info from gonggao_p2p where nsrid='" & lei.p2pid & "'")
Dim myReader2 As SqlDataReader = pulic.execute(cmd3)
If myReader2.HasRows Then
While myReader2.Read()
Dim tp = myReader2.GetString(0)
Dim sp = myReader2.GetString(1)
TextBox7.Text = myReader2.GetString(2).Trim
Label9.Text = "(提示:)"
Label9.Visible = False
End While
Else
Label9.Text = "(提示:此用户暂无公告)"
Label9.Visible = True
' MsgBox("此用户暂无公告!", 0, "提示:")
TextBox7.Text = ""
End If
Button3.Enabled = True
myReader2.Close()
End Sub
Protected Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.Click
If TextBox7.Text.Trim = "" Then
' MsgBox("发布的错误公告不能为空!", 0, "提示:")
Label9.Text = "(提示:发布的用户公告不能为空)"
Label9.Visible = True
Exit Sub
End If
If Session("p2pname") = "" Then
' MsgBox("没有选择纳税人,无法操作!", 0, "提示:")
Label9.Text = "(提示:没有选择纳税人)"
Label9.Visible = True
Exit Sub
End If
If IsValid Then
Dim strL As Integer = 0
Dim s As String
For i As Integer = 1 To TextBox7.Text.Length
s = Mid(TextBox7.Text, i, 1)
If Asc(s) < 0 Then
strL += 2
Else
strL += 1
End If
Next
Dim start, sp
If strL < 160 Then
start = Mid(TextBox9.Text, 1, 4) + Mid(TextBox9.Text, 6, 2) + Mid(TextBox9.Text, 9, 2)
sp = Mid(TextBox10.Text, 1, 4) + Mid(TextBox10.Text, 6, 2) + Mid(TextBox10.Text, 9, 2)
Else
' MsgBox("发布的公告长度超出最大值!", 0, "提示:")
Label9.Text = "(提示:发布的用户公告长度超出最大值)"
Label9.Visible = True
Exit Sub
End If
Dim del As New String("delete from gonggao_p2p where nsrid='" & lei.p2pid & "'")
pulic.noquery(del)
Dim strSQL1 As String = "INSERT INTO gonggao_p2p(nsrid,start,stop,flage,info,quyucode,deptcode,kecode,taxcode) values ('" & Trim(TextBox4.Text) & "','" & Trim(start) & "','" & Trim(sp) & "','1','" & Trim(TextBox7.Text) & "','" & lei.p2pquyucode & "','" & lei.p2pdeptcode & "','" & lei.p2pkecode & "','" & lei.p2ptaxcode & "')"
pulic.noquery(strSQL1)
Label9.Text = "(提示:用户公告发布成功)"
Label9.Visible = True
End If
End Sub
Protected Sub Button5_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button5.Click
If TextBox8.Text.Trim = "" Then
' MsgBox("发布的错误公告不能为空!", 0, "提示:")
Label10.Text = "(提示:发布的错误公告不能为空)"
Label10.Visible = True
Exit Sub
End If
If Session("p2pname") = "" Then
' MsgBox("没有选择纳税人,无法操作!", 0, "提示:")
Label10.Text = "(提示:没有选择纳税人,无法操作)"
Label10.Visible = True
TextBox7.Text = ""
Exit Sub
End If
Dim strL As Integer = 0
Dim s As String
For i As Integer = 1 To TextBox8.Text.Length
s = Mid(TextBox8.Text, i, 1)
If Asc(s) < 0 Then
strL += 2
Else
strL += 1
End If
Next
If strL > 40 Then
' MsgBox("发布的公告长度超出最大值!", 0, "提示:")
Label10.Text = "(提示:发布的错误公告长度超出最大值)"
Label10.Visible = True
Exit Sub
Else
lei.cuowu = "you"
Dim del As New String("delete from erinfo where nsrid='" & lei.p2pid & "'")
pulic.noquery(del)
Dim strSQL1 As String = "INSERT INTO erinfo(nsrid,skkid,cuowuinfo,erbz,usebz) values ('" & Trim(TextBox4.Text) & "','" & Trim(TextBox4.Text) & "','" & Trim(TextBox8.Text) & "','00','1'" & ")"
pulic.noquery(strSQL1)
Label10.Text = "(提示:此用户错误公告发布成功)"
Label10.Visible = True
Button6.Enabled = True
End If
End Sub
Protected Sub CustomValidator1_ServerValidate(ByVal source As Object, ByVal args As System.Web.UI.WebControls.ServerValidateEventArgs)
Dim st1 = Mid(TextBox9.Text, 1, 4) + Mid(TextBox9.Text, 6, 2) + Mid(TextBox9.Text, 9, 2)
Dim sp1 = Mid(TextBox10.Text, 1, 4) + Mid(TextBox10.Text, 6, 2) + Mid(TextBox10.Text, 9, 2)
If (st1 > sp1) Or (TextBox9.Text.Trim.Length <> 10) Or (TextBox10.Text.Trim.Length <> 10) Then
args.IsValid = False
Else
args.IsValid = True
End If
End Sub
Protected Sub Button4_Click(ByVal sender As Object, ByVal e As System.EventArgs)
Response.Redirect("index.aspx")
End Sub
Protected Sub Button3_Click(ByVal sender As Object, ByVal e As System.EventArgs)
Dim del As New String("delete from gonggao_p2p where nsrid='" & lei.p2pid & "'")
pulic.noquery(del)
Label9.Text = "(提示:此用户公告删除成功)"
Label9.Visible = True
Button3.Enabled = False
TextBox7.Text = ""
End Sub
Protected Sub Button6_Click(ByVal sender As Object, ByVal e As System.EventArgs)
Dim del As New String("delete from erinfo where nsrid='" & lei.p2pid & "'")
pulic.noquery(del)
Label10.Text = "(提示:此用户错误公告删除成功)"
Label10.Visible = True
Button6.Enabled = False
TextBox8.Text = ""
End Sub
End Class
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -