📄 zhzx.aspx
字号:
<%@ Page Language="VB" Debug="true" %>
<%@ import Namespace="system.data" %>
<%@ import Namespace="system.data.sqlclient" %>
<script runat="server">
dim Cnn as sqlconnection
dim cmd as sqlcommand
Sub Page_Load(Sender As Object, E As EventArgs)
dim Sql as string
If Not IsPostBack Then
If Session("curruser") = "" Then
Response.Redirect("../index.aspx")
End If
end if
End Sub
Sub save_click(Sender As Object, E As EventArgs)
dim sql as string
dim datar as sqldatareader
dim dycode as string
dim dystr as string=dyname.text
dim sqrstr as string=sqr.text
dim sqdatestr as string=sqdate.text
dim zxnrstr as string=zxnr.text
dim sprstr as string=spr.text
dim zxyjstr as string=zxyj.text
dim spdatestr as string=spdate.text
dim spyjstr as string=spyj.text
dim telstr as string=tel.text
dim sgdwstr as string=sgdw.text
dim begindatestr as string=begindate.text
dim fzrstr as string=fzr.text
dim ysrstr as string=ysr.text
dim enddatestr as string=enddate.text
dim ysyjstr as string=ysyj.text
dim ysdatestr as string=ysdate.text
dim memostr as string=memo.text
if trim(dystr)="" then
page.registerstartupscript("",getalertinfo("请输入单元名称!"))
exit sub
end if
cnn=new sqlconnection(configurationsettings.appsettings("connection"))
sql="select * from fc_cell where name='" & trim(dystr) & "'"
cmd=new sqlcommand(sql,cnn)
cnn.open
datar=cmd.executereader()
if datar.read() then
dycode=datar("code")
else
page.registerstartupscript("",getalertinfo("该单元不存在,数据无法保存!"))
exit sub
end if
datar.close()
sql="select * from zh_zhzx where cellcode='" & trim(dycode) & "'"
cmd=new sqlcommand(sql,cnn)
datar=cmd.executereader()
if datar.read() then
sql="update zh_zhzx set sqr='" & sqrstr & "',sqdate='" & sqdatestr & "',zxnr='" & zxnrstr & "',spr='" & sprstr & "',zxyj=" & zxyjstr & ",spdate='" & spdatestr & "',spyj='" & spyjstr & "',tel='" & telstr & "',sgdw='" & sgdwstr & "',begindate='" & begindatestr & "',fzr='" & fzrstr & "',ysr='" & ysrstr & "',enddate='" & enddatestr & "',ysyj='" & ysyjstr & "',ysdate='" & ysdatestr & "',memo='" & memostr & "' where cellcode='" & dycode & "'"
else
sql="insert into zh_zhzx(cellcode,sqr,sqdate,zxnr,spr,zxyj,spdate,spyj,tel,sgdw,begindate,fzr,ysr,enddate,ysyj,ysdate,memo) values('" & dycode & "','" & sqrstr & "','" & sqdatestr & "','" & zxnrstr & "','" & sprstr & "'," & zxyjstr & ",'" & spdatestr & "','" & spyjstr & "','" & telstr & "','" & sgdwstr & "','" & begindatestr & "','" & fzrstr & "','" & ysrstr & "','" & enddatestr & "','" & ysyjstr & "','" & ysdatestr & "','" & memostr & "')"
end if
datar.close()
cmd=new sqlcommand(sql,cnn)
cmd.executenonquery
dyname.text=""
call cleardata()
page.registerstartupscript("",getalertinfo("数据保存成功!"))
End Sub
Function GetAlertInfo(byval str1 as string) as String
dim Str2 as String
str2="<script language='javascript'>alert('" & str1 & "')<"
str2+="/"
str2+="script>"
return trim(str2)
End Function
sub cleardata()
sqr.text=""
sqdate.text=""
zxnr.text=""
spr.text=""
zxyj.text=""
spdate.text=""
spyj.text=""
tel.text=""
sgdw.text=""
begindate.text=""
fzr.text=""
ysr.text=""
enddate.text=""
ysyj.text=""
ysdate.text=""
memo.text=""
end sub
Sub sure_click(Sender As Object, E As EventArgs)
dim sql as string
dim datar as sqldatareader
dim dystr as string=dyname.text
if trim(dystr)="" then
page.registerstartupscript("",getalertinfo("请输入单元名称!"))
else
cnn=new sqlconnection(configurationsettings.appsettings("connection"))
sql="select code from fc_cell where name='" & trim(dystr) & "'"
cmd=new sqlcommand(sql,cnn)
cnn.open
datar=cmd.executereader()
if datar.read() then
datar.close()
call cleardata()
sql="select * from zh_zhzx where cellcode in (select code from fc_cell where name='" & trim(dystr) & "')"
cmd=new sqlcommand(sql,cnn)
datar=cmd.executereader()
if datar.read() then
sqr.text=Iif(IsDbNull(datar("sqr")),"",datar("sqr"))
sqdate.text=Iif(IsDbNull(datar("sqdate")),"",datar("sqdate"))
zxnr.text=Iif(IsDbNull(datar("zxnr")),"",datar("zxnr"))
spr.text=Iif(IsDbNull(datar("spr")),"",datar("spr"))
zxyj.text=Iif(IsDbNull(datar("zxyj")),"",datar("zxyj"))
spdate.text=Iif(IsDbNull(datar("spdate")),"",datar("spdate"))
spyj.text=Iif(IsDbNull(datar("spyj")),"",datar("spyj"))
tel.text=Iif(IsDbNull(datar("tel")),"",datar("tel"))
sgdw.text=Iif(IsDbNull(datar("sgdw")),"",datar("sgdw"))
begindate.text=Iif(IsDbNull(datar("begindate")),"",datar("begindate"))
fzr.text=Iif(IsDbNull(datar("fzr")),"",datar("fzr"))
ysr.text=Iif(IsDbNull(datar("ysr")),"",datar("ysr"))
enddate.text=Iif(IsDbNull(datar("enddate")),"",datar("enddate"))
ysyj.text=Iif(IsDbNull(datar("ysyj")),"",datar("ysyj"))
ysdate.text=Iif(IsDbNull(datar("ysdate")),"",datar("ysdate"))
memo.text=Iif(IsDbNull(datar("memo")),"",datar("memo"))
end if
else
page.registerstartupscript("",getalertinfo("该单元不存在,请重新输入!"))
end if
datar.close()
end if
End Sub
Sub del_click(Sender As Object, E As EventArgs)
dim sql as string
dim dystr as string=dyname.text
if trim(dystr)="" then
page.registerstartupscript("",getalertinfo("请输入单元名称!"))
else
cnn=new sqlconnection(configurationsettings.appsettings("connection"))
sql="delete from zh_zhzx where cellcode in (select code from fc_cell where name='" & trim(dystr) & "')"
cmd=new sqlcommand(sql,cnn)
cnn.open
cmd.executenonquery
cnn.close
dyname.text=""
call cleardata()
end if
End Sub
</script>
<html>
<head>
<title>住户装修</title>
<link href="../Main.css" type="text/css" rel="stylesheet" />
</head>
<body background="../images/1.jpg">
<form runat="server">
<table id="search" cellspacing="1" cellpadding="0" width="80%" align="center" border="0">
<tbody>
<tr>
<td width="34%" height="30">
单元名称
<asp:TextBox class="input_text" id="dyname" runat="server" width="130"></asp:TextBox>
</td>
<td>
<asp:button class="input_button" id="SureBtn" onclick="Sure_Click" runat="server" text="确 定"></asp:button>
</td>
<td></td>
</tr>
<tr><td colspan=3><hr></td></tr>
<tr>
<td width="34%" height="30">
申 请 人
<asp:TextBox class="input_text" id="sqr" runat="server" width="130"></asp:TextBox>
</td>
<td width="33%">
申请日期
<asp:TextBox class="input_text" id="sqdate" runat="server" width="130"></asp:TextBox>
</td>
<td width="33%"></td>
</tr>
<tr>
<td colspan="3" height="50">
装修内容<br />
<asp:TextBox id="zxnr" runat="server" width="650" TextMode="MultiLine" Rows="2"></asp:TextBox>
</td>
</tr>
<tr>
<td width="34%" height="30">
审 批 人
<asp:TextBox class="input_text" id="spr" runat="server" width="130"></asp:TextBox>
</td>
<td width="33%">
装修押金
<asp:TextBox class="input_text" id="zxyj" runat="server" width="130"></asp:TextBox>
</td>
<td width="33%">
审批日期
<asp:TextBox class="input_text" id="spdate" runat="server" width="130"></asp:TextBox>
</td>
</tr>
<tr>
<td colspan="3" height="50">
审批意见<br />
<asp:TextBox id="spyj" runat="server" width="650" TextMode="MultiLine" Rows="2"></asp:TextBox>
</td>
</tr>
<tr>
<td width="34%" height="30">
施工单位
<asp:TextBox class="input_text" id="sgdw" runat="server" width="130"></asp:TextBox>
</td>
<td width="33%">
负 责 人
<asp:TextBox class="input_text" id="fzr" runat="server" width="130"></asp:TextBox>
</td>
<td width="33%">
联系电话
<asp:TextBox class="input_text" id="tel" runat="server" width="130"></asp:TextBox>
</td>
</tr>
<tr>
<td width="34%" height="30">
开始日期
<asp:TextBox class="input_text" id="begindate" runat="server" width="130"></asp:TextBox>
</td>
<td width="33%">
截止日期
<asp:TextBox class="input_text" id="enddate" runat="server" width="130"></asp:TextBox>
</td>
<td width="33%"></td>
</tr>
<tr>
<td width="34%" height="30">
验 收 人
<asp:TextBox class="input_text" id="ysr" runat="server" width="130"></asp:TextBox>
</td>
<td width="33%">
验收日期
<asp:TextBox class="input_text" id="ysdate" runat="server" width="130"></asp:TextBox>
</td>
<td width="33%"></td>
</tr>
<tr>
<td colspan="3" height="50">
验收意见<br />
<asp:TextBox id="ysyj" runat="server" width="650" TextMode="MultiLine" Rows="2"></asp:TextBox>
</td>
</tr>
<tr class="tr4">
<td colspan="3" height="30">
备注信息
<asp:TextBox class="input_text" id="memo" runat="server" width="640"></asp:TextBox>
</td>
</tr>
</tbody>
</table>
<p align=center>
<asp:button class="input_button" id="SaveBtn" onclick="Save_Click" runat="server" text="保 存"></asp:button>
<asp:button class="input_button" id="DelBtn" onclick="Del_Click" runat="server" text="删 除"></asp:button>
</form>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -