房间页面的示意图,从图中可以看出在该页面显示了房间名称、房间类型、费用和预约操作。
图26查看房价
在查看房间页面room.asp中首先要打开房间信息表room来获取信息,然后通过循环来逐条列出房间信息,见程序清单24
见程序清单24显示房间信息核心代码room.asp
<%
setrs_room=server.CreateObject("adodb.recordset")
sql="select*fromroom"
rs_room.opensql,hotel_conn,3,2
rs_room.movefirst
while(notrs_room.eoforrs_room.bof)
%>
<%=rs_room("room_id")%>
<%=rs_room("name")%>
<%=rs_room("type")%>
<%=rs_room("cost")%>
">我要预约
<%
rs_room.movenext
wend
%>
4.查询房间模块
当房间信息过多的时候,用户为了快速获得满足自己要求的房间就比较麻烦。本系统设计了查询功能,方便用户输入条件获得需求房间。图27所示为了一个简单查询结果的页面。实现代码见程序清单25
图27查询房间
程序清单25查询功能实现代码search.asp
<%
set_room=request.Form("set_room")
set_cost=request.Form("set_cost")
%>
请给出查询条件:
查看所有费用上限
不作要求
的
所有
房间
<%
ifset_room=""andset_cost=""then
response.End()
else
%>
<%
setrs_search=server.CreateObject("adodb.recordset")
sql="select*fromroom"
'如果输入查询条件,构造where结构-----------
ifnot(set_cost="不作要求"andset_room="所有")then
sql=sql&"where"
endif
ifset_room<>"所有"then
sql=sql&"type='"&set_room&"'"
endif
ifset_cost<>"不作要求"andset_room<>"所有"then
sql=sql&"and"
endif
ifset_cost="50元"then
sql=sql&"cost<=50"
elseifset_cost="200元"then
sql=sql&"cost<=200"
elseifset_cost="400元"then
sql=sql&"cost<=400"
elseifset_cost="600元"then
sql=sql&"cost<=600"
elseifset_cost="600元以上"then
sql=sql&"cost>600"
endif
'response.Write(sql)
'打开房间数据库---------------
rs_search.opensql,hotel_conn,3,2
ifrs_search.eoforrs_search.bofthen
searchok=0
else
searchok=1
endif
%>
查询结果:
<%
ifsearchok=1then
response.Write("查看所有开放于"&set_time&"的"&set_room&"房间,费用上限"&set_cost)
endif
%>
<%Ifsearchok=0Then%>
●没有找到符合要求的房间
<%Else%>
房间名称
房间类型
费用(元/小时)
使用时间
<%
rs_search.movefirst
while(notrs_search.eof)
%>
<%urltext="preengage.asp?room_id="&rs_search("room_id")%>
"><%=rs_search("name")%>
<%=rs_search("type")%>
<%=rs_search("cost")%>
24小时
<%
rs_search.movenext
Wend
%>
5预约房间和取消预约模块
预约是本系统的核心所在,该模块接收用户提交的房间编号和预约时间,并判断房间在指定时间内是否空闲,最后给出用户预约结果,如果预约成功则要将信息写入数据库。
图28所示是预约房间界面,图29显示房间预约成功
图28预约房间
图29预约成功界面
由preengage.asp文件获取的表单信息给chkpre.asp文件处理。本系统要求用户提出预约时刻要比开始使用时间提前24小时,因此首先由chkpre.asp判断用户提交的时刻是否符合要求,然后查询数据库中该房间在这个时间是否空闲,最后给出预约成功的提示,并将预约信息写入数据库,代码见程序清单26
<%
dimroom_id,pyear,pmonth,pday,ptime,chkok,err
dimrs_preengage,rs_room,rs_save
room_id=request.Form("room_id")
pyear=request.Form("pyear")
pmonth=request.Form("pmonth")
pday=request.Form("pday")
ptime=request.Form("ptime")
%>
<%
ifnotisdate(pyear&"-"&pmonth&"-"&pday)then
err=1
endif
iferr=1then
%>
<%="出现错误!"%>
<%
setrs_preengage=server.CreateObject("adodb.recordset")
sql="select*frompreengagewhereroom_id="&room_id&"andbeginhour="&ptime
sql=sql&"andpyear="&pyear&"andpmonth="&pmonth&"andpday="&pday
rs_preengage.opensql,hotel_conn,3,2
ifrs_preengage.eoforrs_preengage.bofthen
chkok=1
else
chkok=0
endif
ifchkok=1then
setrs_save=server.CreateObject("adodb.recordset")
sql="select*frompreengage"
rs_save.opensql,hotel_conn,3,2
setrs_room=server.CreateObject("adodb.recordset")
sql="select*fromroomwhereroom_id="&room_id
rs_room.opensql,hotel_conn,3,2
rs_save.addnew
rs_save("user_name")=session("user_name")
rs_save("room_id")=room_id
rs_save("datetime")=now()
rs_save("cost")=rs_room("cost")
rs_save("pyear")=pyear
rs_save("pmonth")=pmonth
rs_save("pday")=pday
rs_save("beginhour")=ptime
rs_save.update
rs_save.movelast
%>
<%="预约成功"%>
<%="预约未被接受!"%>
取消预约模块的实现和管理端删除模块使用一个文件,这里就不再详细论述。
6.查看预约模块
用户在预约房间后会有查询预约情况的需求,查询页面主要由文件mine.asp实现,如图30所示。程序清单27是查看预约信息的核心代码。
图30查看预约
程序清单27查看预约的关键代码
<%
dimrs_preengage,rs_ground
dimtime_out
setrs_preengage=server.CreateObject("adodb.recordset")
sql="select*frompreengagewhereuser_name='"&session("user_name")&"'"
rs_preengage.opensql,hotel_conn,3,2
%>
我的预约信息
<%Ifrs_preengage.eoforrs_preengage.bofThen%>
您还没有进行任何预约!
<%Else%>
房间名称
房间类型
费用
预约日期
预约时间
状态
操作
<%
rs_preengage.movefirst
while(notrs_preengage.eof)
setrs_room=server.CreateObject("adodb.recordset")
sql="select*fromroomwhereroom_id="&rs_preengage("room_id")
rs_room.opensql,hotel_conn,3,2
%>
<%=rs_room("name")%>
<%=rs_room("type")%>
<%=rs_room("cost")%>
<%=rs_preengage("pyear")&"-"&rs_preengage("pmonth")&"-"&rs_preengage("pday")%>
<%=rs_preengage("beginhour")&":00-"&(rs_preengage("beginhour")+1)&":00"%>
<%
Ifrs_preengage("paid")=1Then
response.Write("已经付款")
else
response.Write("尚未付款")
endif
time_out=datediff("d",now,rs_preengage("pyear")&"-"&rs_preengage("pmonth")&"-"&rs_preengage("pday")&""&rs_preengage("beginhour")&":00:00")
iftime_out<0then
response.Write("已经过期")
else
response.Write("尚未到期")
endif
%>
<%ifrs_preengage("paid")=0andtime_out>0then%>
">取消预约
<%endif%>
<%
rs_preengage.movenext
wend
%>
<%EndIf%>
7.留言模块
留言模块是给用户发表意见和看法的场所。图31所示为发表留言界面。程序清单28是留言功能实现的代码主要部分。
图31发表留言界面
程序清单28留言功能实现部分代码lword.asp
<%
dimtitle,word,check,lword
title=request.Form("title")
word=request.Form("word")
iftitle=""andword=""then
lword=1
else
check=""
iftitle=""thencheck="●没有输入留言标题"
ifword=""thencheck=check&"●没有输入留言内容"
iflen(title)>50thencheck=check&"●标题超过50个字符"
iflen(word)>250thencheck=check&"●留言超过250个字符"
endif
%>
<%Iflword=1Then%>
站长留言
标题:
内容:
>
<%Else%>
<%Ifcheck<>""Then%>
留言错误!
<%=check%>
[返回留言页面]
<%Else%>
<%
setrs_word=server.CreateObject("adodb.recordset")
sql="select*fromwordwhereuser_name='"&session("user_name")&"'"
rs_word.opensql,hotel_conn,3,2
num=rs_word.recordcount
rs_word.close
sql="select*fromword"
rs_word.opensql,hotel_conn,3,2
rs_word.addnew
rs_word("user_name")=session("user_name")
rs_word("datetime")=now()
rs_word("title")=title
rs_word("word")=word
rs_word.update
rs_word.close
%>
留言成功
<%="您给站长的留言一共有"&(num+1)&"条"%>
[返回首页]
<%EndIf%>
<%EndIf%>
结束语
本设计在叶剑春老师的悉心指导和严格要求下业已完成,从课题选择、方案论证到具体设计和调试,无不凝聚着叶老师的心血和汗水,在三年的专科学习和生活期间,也始终感受着老师的精心指导和无私的关怀,我受益匪浅。在此向叶老师表示深深的感谢和崇高的敬意。
不积跬步何以至千里,本设计能够顺利的完成,也归功于各位任课老师的认真负责,使我能够很好的掌握和运用专业知识,并在设计中得以体现。正是有了他们的悉心帮助和支持,才使我的工作顺利完成,在此向山西工商学院,计算机系的全体老师表示由衷的谢意。感谢他们三年来的辛勤栽培。
致谢
在系统开发的两个月里,我受到了指导老师叶剑春老师的细心指导,叶老师严谨的指导态度与深厚的理论知识都让我受益非浅,从她身上我学到了很多的东西,无论是理论还是实践都使我的知识有很大的提高.借此我特提出感谢.
同时我还感谢母校的老师,谢谢他们为本系统提供的帮助.让我能够顺利地完成本系统的开
发.也感谢那些对我提供帮助的同学,没有他们就不会现在的系统.
参考文献
1.ASP数据库系统开发完全手册人民邮电出版社2006年3月
2.VisualBasic数据库系统开发完全手册人民邮电出版社2006年3月
3.ASP信息系统开发实例精选机械工业出版社王国辉、牛强、李南南等2006年7月
4.VisualBasic信息系统开发实例精选机械工业出版社宋坤、赵智勇、刘强等2005年7月
5.Access数据库开发实例解析机械工业出版社李俊民、高春燕等2006年1月
6.VisualBasic精彩编程200例机械工业出版社 赛奎春、高春艳等2002年1月
7.ASP数据库开发实例解析机械工业出版社李严、于亚芳、王国辉2004年12月
8.VisualBasic工程应用与项目实践机械工业出版社 高春艳、李俊民等2005年1月
9.ASP工程应用与项目实践机械工业出版社陈威、白伟明、李楠2005年2月
10.ASP工程应用与项目实践机械工业出版社王国辉、牛强、李南南2005年4月
11.VisualBasic信息系统开发实例精选机械工业出版社 高春艳、李俊民、张耀庭等
毕业设计排版要求
纸张大小:A4
大标题:小二号、黑体。包括目录、章、结束语、致谢、参考文献。
副标题:三号、黑体。包括节,如:6.1测试方法。
小标题:小四号、黑体。如5.2.1××模块详细设计、1.模块功能
正文:小四号、宋体
上一篇:ASP邮件(论文和程序)
下一篇:成本管理详细介绍