⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 room_edit.asp

📁 ASP程序实现的酒店预定系统
💻 ASP
字号:
<!--#include file="../Include/AdoConn.asp"-->
<%
Num=10
	
redim var(Num)
for i=0 to Num
	var(i)=""
next
	
'''''''''''是否已经有酒店信息
code=Request("code")
if code="" then response.redirect("hotel_query.asp")
strsql="select 酒店名_cn from xt_td_hotel where 酒店编码='" & code & "'"
set rst=conn.execute(strsql)
if rst.eof then response.redirect("hotel_query.asp")
sHotelName=rst(0)

'修改
code1=request.QueryString("code1")
if code1<>"" then 
	set rst=server.createobject("adodb.recordset")
	strsql="select top 1 * from xt_td_room where 酒店编码='" & code & "' and 房型序号='" & code1 & "'"
	rst.open strsql,conn
	if not rst.eof then 
		for i=0 to rst.fields.count-1
			var(i)=rst(i)
		next
	end if
	rst.Close
	set rst=nothing
end if

if Request.QueryString ("submit")="submit" then'是否是提交状态
	set rst=server.CreateObject ("adodb.recordset")
	strsql="select top 1 * from xt_td_room"
	rst.Open strsql,conn
	N=Num
	code=Request.Form ("code")
	code1=Request.Form ("code1")
	if code<>"" and code1<>"" then'修改
	for i=2 to N
		if i=4 or i=5 then
			if isdate(Request.Form(i)) then
				strSet=strSet & rst(i).name & "=" & "#" & Request.Form(i-1) & "#"
			else
				strSet=strSet & rst(i).name & "=" & "#" & date() & "#"
			end if	
		elseif i=6 or i=7 or i=8 then	
			if isNumeric(Request.Form(i)) then
				strSet=strSet&rst(i).name & "= " & Request.Form(i-1)
			else
				strSet=strSet&rst(i).name & "=0"
			end if	
		else
			strSet=strSet&rst(i).name&"="&"'"&Request.Form(i-1)&"'"
		end if
		if i<>N then 
			strSet=strSet+","
		end if
	next
	strsql="update xt_td_room set "&strSet&" where 酒店编码='" & code & "' and 房型序号='" & code1 & "'"

	conn.execute (strsql)
	info="您已提交修改成功!"

	else '新增
		if code<>"" and code1="" then
	
'''''''''''''''''''''检查数据库内是否有此房型
set rst2=server.CreateObject ("ADODB.recordset")
StrSQL="select 房型_cn from xt_td_room where 酒店编码='"& code &"' and 房型_cn='"&Request.Form (1)&"'"
rst2.Open strsql,conn,3,2
if not rst2.EOF then
%>
<script Language="JavaScript">
	<!--
	alert("系统中已有此房型,如添加同名房型请在房型后加上序号!");
	history.back(-1);
	// -->
</script>

<%
	Response.End 
end if
rst2.Close
set rst2=nothing
'''''''''''''''''''''检查结束


'''''''''''''''''''''确定房型序号
'房型序号:同一酒店,房型顺次加1

set rst1=server.CreateObject ("ADODB.recordset")
StrSQL="select max(房型序号) as 序号 from XT_TD_room where 酒店编码='" & code & "'"
set rst1=conn.execute(StrSQL)
if  isnull(rst1("序号")) then
	roomCodeNum=1
else
	roomCodeNum=clng(rst1("序号"))+1
end if
rst1.Close
set rst1=nothing
'''''''''''''''''''''结束

	dim strTitle,strValue'记录自动生成form\rst.fields语句的变量
	strTitle=rst(0).name+","
	strValue="'" & code & "'"  & ","
	strTitle=strTitle & rst(1).name+","
	strValue=strValue&"'"&roomCodeNum&"'"+","
	for i=2 to N '从2开始是去掉“酒店编码、房型序号”
		strTitle=strTitle&rst(i).name
		if i=4 or i=5 then
			if isdate(Request.Form(i)) then
				strValue=strValue & "#" & Request.Form(i-1) & "#"
			else
				strValue=strValue & "#" & date() & "#"
			end if	
		elseif i=6 or i=7 or i=8 then	
			if isNumeric(Request.Form(i)) then
				strValue=strValue & Request.Form(i-1)
			else
				strValue=strValue & "0"
			end if	
		else
				strValue=strValue&"'"&Request.Form(i-1)&"'"
		end if

		if i<>N then 
			strTitle=strTitle+","
			strValue=strValue+","
		end if
	next
	strsql="insert into xt_td_room (" & strTitle & " )values(" & strValue & ")"
	conn.execute (strsql)
	info="您已提交成功!“继续添加房型”请继续输入信息并提交。"
	end if
	rst.Close
	set rst=nothing
end if
end if
%>

<html>
<head>
<title>注册房型</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="/Css/All.css">
<script language="javascript">
ArrayString=new Array(0,"textfield","房型不能为空!");
</script>
<script language="javascript" src="../js/checkForm.js"></script>
<script language="javascript" src="../js/Check_email_num.js"></script>
</head>

<body bgcolor="#FFFFFF" text="#000000">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td align="center"><%=info&"<br>"%></td>
  </tr>
</table>
<table width="500" border="0" cellspacing="0" cellpadding="0" align="center" background="../Images/title_edit.gif">
  <tr > 
    <td width="199" height="30">&nbsp;</td>
    <td width="112" height="30" align="center">注 册 房 型</td>     
    <td width="189" height="30">&nbsp;</td>     
  </tr>     
</table>     
<table width="500" border="0" cellspacing="0" cellpadding="0" align="center" class="snd">     
  <tr>      
    <td width="12" align="right" height="5">&nbsp;</td>     
    <td width="67" align="right" height="5">&nbsp;</td>     
    <td width="28" height="5" align="center">&nbsp;</td>     
    <td width="250" height="5">&nbsp;</td>     
    <td width="119" height="5">&nbsp;</td>     
    <td width="24" height="5">&nbsp;</td>     
  </tr>     
  <form name="form1" method="post" action="room_edit.asp?submit=submit" onsubmit="return CheckForm(this)">     
    <tr bgcolor="#FFF7F0">      
      <td width="12" align="right" height="20">&nbsp;</td>     
      <td colspan="3" bgcolor="#FFF8F0" height="25">      
        <p><font color="#FF0000" size="3">此房型所属酒店为:<%=sHotelName%></font></p>     
      </td>     
      <td bgcolor="#FFF8F0" height="25">      
       <a href="room_list.asp?code=<%=code%>">本酒店房型列表</a>
      </td>     
      <td width="24" height="20">&nbsp;</td>     
    </tr>     
    <tr>      
      <td width="12" align="right"><font size="2">&nbsp;</font></td>    
      <td width="67" align="right"><font size="2">&nbsp;</font></td>    
      <td width="28" align="center"><font size="2">&nbsp;</font></td>    
      <td width="250"><font size="2">&nbsp;</font></td>    
      <td width="119"><font size="2">&nbsp;</font></td>    
      <td width="24"><font size="2">&nbsp;</font></td>    
    </tr>    
    <tr>     
      <td width="12" align="right" height="20"><font size="2">&nbsp;</font></td>    
      <td width="67" align="right" height="20"><font size="2">房型</font></td>    
      <td width="28" height="20" align="center"><font size="2">(中)</font></td>    
      <td width="250" height="20">     
        <font size="2">     
        <input type="text" name="textfield" size="20" maxlength="10" value=<%=var(2)%>>    
        **</font> </td>    
      <td width="119" height="20"><font size="2">&nbsp;</font></td>    
      <td width="24" height="20"><font size="2">&nbsp;</font></td>    
    </tr>    
    <tr>     
      <td width="12" align="right" height="20"><font size="2">&nbsp;</font></td>    
      <td width="67" align="right" height="20"><font size="2">&nbsp;</font></td>    
      <td width="28" height="20" align="center"><font size="2">(韩)</font></td>    
      <td width="250" height="20">     
        <font size="2">     
        <input type="text" name="textfield2" size="20" maxlength="10" value=<%=var(3)%>>    
        **</font></td>    
      <td width="119" height="20">     
        <p><font size="2">(**为必填项,下同)</font></p>    
      </td>    
      <td width="24" height="20"><font size="2">&nbsp;</font></td>    
    </tr>    
    <tr>     
      <td width="12" align="right" height="20"><font size="2">&nbsp;</font></td>    
      <td width="67" align="right" height="20"><font size="2">起时间</font></td>    
      <td width="28" height="20" align="center"><font size="2">&nbsp;</font></td>    
      <td width="250" height="20">     
        <font size="2">     
        <input type="text" name="textfield3" size="20" maxlength="20" value="<%=var(4)%>">    
        <img src="../Images/calendar.gif" width="34" height="21"> </font> </td>     
      <td width="119" height="20"><font size="2">&nbsp;</font></td>    
      <td width="24" height="20"><font size="2">&nbsp;</font></td>    
    </tr>    
    <tr>     
      <td width="12" align="right" height="20"><font size="2">&nbsp;</font></td>    
      <td width="67" align="right" height="20"><font size="2">止时间</font></td>    
      <td width="28" height="20" align="center"><font size="2">&nbsp;</font></td>    
      <td width="250" height="20">     
        <font size="2">     
        <input type="text" name="textfield4" size="20" maxlength="20" value="<%=var(5)%>">    
        <img src="../Images/calendar.gif" width="34" height="21"> </font> </td>     
      <td width="119" height="20"><font size="2">&nbsp;</font></td>    
      <td width="24" height="20"><font size="2">&nbsp;</font></td>    
    </tr>    
    <tr>     
      <td width="12" align="right" height="20"><font size="2">&nbsp;</font></td>    
      <td width="67" align="right" height="20"><font size="2">门市价</font></td>    
      <td width="28" height="20" align="center"><font size="2">&nbsp;</font></td>    
      <td width="250" height="20">     
        <font size="2">     
        <input type="text" name="textfield5" size="20" maxlength="6" value="<%=var(6)%>">    
        </font>    
      </td>    
      <td width="119" height="20"><font size="2">&nbsp;</font></td>    
      <td width="24" height="20"><font size="2">&nbsp;</font></td>    
    </tr>    
    <tr>     
      <td width="12" align="right" height="20"><font size="2">&nbsp;</font></td>    
      <td width="67" align="right" height="20"><font size="2">会员价</font></td>    
      <td width="28" height="20" align="center"><font size="2">&nbsp;</font></td>    
      <td width="250" height="20">     
        <font size="2">     
        <input type="text" name="textfield6" size="20" maxlength="6"  value="<%=var(7)%>">    
        </font>    
      </td>    
      <td width="119" height="20"><font size="2">&nbsp;</font></td>    
      <td width="24" height="20"><font size="2">&nbsp;</font></td>    
    </tr>    
    <tr>     
      <td width="12" align="right" height="20"><font size="2">&nbsp;</font></td>    
      <td width="67" align="right" height="20"><font size="2">周末会员价</font></td>    
      <td width="28" height="20" align="center"><font size="2">&nbsp;</font></td>    
      <td width="250" height="20">     
        <font size="2">     
        <input type="text" name="textfield7" size="20" maxlength="15"  value="<%=var(8)%>">    
        </font>    
      </td>    
      <td width="119" height="20"><font size="2">&nbsp;</font></td>    
      <td width="24" height="20"><font size="2">&nbsp;</font></td>    
    </tr>    
    <tr>     
      <td width="12" align="right" height="20"><font size="2">&nbsp;</font></td>    
      <td width="67" align="right" height="20"><font size="2">价格包含</font></td>    
      <td width="28" height="20" align="center"><font size="2">(中)</font></td>    
      <td width="250" height="20">     
        <font size="2">     
        <input type="text" name="textfield8" size="25" maxlength="25" value="<%=var(9)%>">    
        </font>    
      </td>    
      <td width="119" height="20"><font size="2">&nbsp;</font></td>    
      <td width="24" height="20"><font size="2">&nbsp;</font></td>    
    </tr>    
    <tr>     
      <td width="12" align="right" height="20"><font size="2">&nbsp;</font></td>    
      <td width="67" align="right" height="20"><font size="2">&nbsp;</font></td>    
      <td width="28" height="20" align="center"><font size="2">(韩)</font></td>    
      <td width="250" height="20">     
        <font size="2">     
        <input type="text" name="textfield9" size="25" maxlength="25" value="<%=var(10)%>">    
        </font>    
      </td>    
      <td width="119" height="20"><font size="2">&nbsp;</font></td>    
      <td width="24" height="20"><font size="2">&nbsp;</font></td>    
    </tr>    
    <tr>     
      <td width="12" align="right" height="5"><font size="2">&nbsp;</font></td>    
      <td colspan="4" height="5"><font size="2">&nbsp;</font></td>    
      <td width="24" height="5"><font size="2">&nbsp;</font></td>    
    </tr>    
    <tr>     
      <td colspan="6" height="20" align="center">     
        <font size="2">     
        <input type="hidden" name="code" value="<%=code%>">    
        <input type="hidden" name="code1" value="<%=code1%>">    
        <input type="submit" name="Submit" value="提交" class="buttonnew">    
        <input type="reset" name="Submit2" value="重置" class="buttonnew">     
        </font>     
      </td>     
    </tr>     
    <tr>      
      <td colspan="6" height="20" align="center">&nbsp;</td>     
    </tr>     
    <tr bgcolor="#000000">      
      <td colspan="6" align="right" height="1"></td>     
    </tr>     
  </form>     
</table>     
</body>     
</html>     
<%     
	set rst1=nothing     
	conn.close     
	set conn=nothing     
%>     

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -