第一范文网 - 专业文章范例文档资料分享平台

基于WEB的酒店管理系统 - 图文

来源:用户分享 时间:2025/8/17 7:30:01 本文由loading 分享 下载这篇文档手机版
说明:文章内容仅供预览,部分内容可能不全,需要完整文档或者需要复制内容,请下载word后使用。下载word有问题请添加微信号:xxxxxxx或QQ:xxxxxx 处理(尽可能给您提供完整文档),感谢您的支持与谅解。

Response.Write(\入住成功!\\\);

5.4.2 大堂入住

大堂入住界面如下图所示:

关键代码

protected void Button1_Click(object sender, EventArgs e)//办理入住手续,将数据更新到数据库 {

if (txtzjh.Text==\) {

Response.Write(\证件号不能为空!\\\); }

else if (txtname.Text==\) {

Response.Write(\顾客姓名不能为空!\\\); }

else if (txtlivename.Text==\) {

Response.Write(\入住人不能为空!\\\); }

else if (Convert.ToInt32(lableft.Text)<=0) {

Response.Write(\所选房间已满请选择其他房间!\\\); } else {

string constr = ConfigurationManager.ConnectionStrings[\].ConnectionString; using (SqlConnection sqlcon = new SqlConnection(constr)) {

29

图 5-7 大堂入住界面

string comstr = \ + \(@rid,@zjh,@cname,@etime);\ +

\ + \

roomcategory

set

lamount=lamount-1

where

categoryid='\

+

into

liverecoder(roomid,cid,customername,entertime)

values

DropDownList1.SelectedValue + \ ;

using (SqlCommand sqlcom = new SqlCommand(comstr, sqlcon)) {

sqlcom.Parameters.AddWithValue(\, txtzjh.Text); sqlcom.Parameters.AddWithValue(\, zjlist.SelectedValue); sqlcom.Parameters.AddWithValue(\, txtname.Text); sqlcom.Parameters.AddWithValue(\, sexlist.SelectedValue); sqlcom.Parameters.AddWithValue(\, DropDownList2.SelectedValue); sqlcom.Parameters.AddWithValue(\, txtlivename.Text); sqlcom.Parameters.AddWithValue(\, DateTime.Now); sqlcon.Open();

using (SqlDataReader reader = sqlcom.ExecuteReader()) {

if (reader.HasRows) {

while (reader.Read()) {

labprice.Text = reader.GetValue(0).ToString() + \元/每天\; } } } } }

Response.Write(\入住成功!\\\); }

}

30

5.6 退房管理

顾客离开酒店时办理退房手续。退房管理界面如下图所示

图 5-8 退房管理界面

关键代码

protected void Button1_Click(object sender, EventArgs e)//查询客户住宿信息 {

Label2.Visible = false;

string constr = ConfigurationManager.ConnectionStrings[\].ConnectionString; using (SqlConnection sqlcon=new SqlConnection(constr)) { string price \

+\

+\liverecoder.roomid=@rid and liverecoder.roomid=roominfo.rid and rcategory=categoryid and liverecoder.cid=customerinfo.cid and liverecoder.livestatus='1'\;

using (SqlCommand sqlcom=new SqlCommand (comstr,sqlcon)) {

sqlcom.Parameters.AddWithValue(\, txtrid.Text); sqlcon.Open();

using (SqlDataReader reader=sqlcom.ExecuteReader()) {

if (reader.HasRows) {

31

comstr

=

\

recodeid,idcategory,liverecoder.cid,cname,csex,rid,categoryname,liverecoder.entertime,liverecoder.customername,

Panel1.Visible = true; while (reader.Read()) {

labid.Text = reader.GetValue(0).ToString(); labzj.Text = reader.GetValue(1).ToString(); labzjh.Text = reader.GetValue(2).ToString(); labname.Text = reader.GetValue(3).ToString(); labsex.Text = reader.GetValue(4).ToString(); labrid.Text = reader.GetValue(5).ToString(); labcate.Text = reader.GetValue(6).ToString(); labetime.Text = reader.GetValue(7).ToString(); lablivename.Text = reader.GetValue(8).ToString();

labprice.Text = reader.GetValue(9).ToString()+\元/每天\; TimeSpan ts = DateTime.Now - Convert.ToDateTime(reader.GetValue(7));//计算入住时间

int a = Convert.ToInt32(ts.Days);

if (a==0)//判断,入住天数为0时,按一天计算 {

labdays.Text = \;//中间变量,存储住宿天数 } else

labdays.Text = ts.Days.ToString();//获取入住时间的天数部分 int

money

=

Convert.ToInt32(labdays.Text)

*

Convert.ToInt32( reader.GetValue(9));//计算金额

labmoney.Text = money.ToString(); } } else {

Panel1.Visible = false; Label2.Visible = true; } } } } }

protected void Button2_Click(object sender, EventArgs e)//办理退宿手续,并将记录写入数据库 {

string constr = ConfigurationManager.ConnectionStrings[\].ConnectionString; using (SqlConnection sqlcon = new SqlConnection(constr)) {

string comstr = \recodeid='\ + labid.Text + \ +

\+labrid.Text+\

32

搜索更多关于: 基于WEB的酒店管理系统 - 图文 的文档
基于WEB的酒店管理系统 - 图文.doc 将本文的Word文档下载到电脑,方便复制、编辑、收藏和打印
本文链接:https://www.diyifanwen.net/c21j619fdl5423gj8fm4z_8.html(转载请注明文章来源)
热门推荐
Copyright © 2012-2023 第一范文网 版权所有 免责声明 | 联系我们
声明 :本网站尊重并保护知识产权,根据《信息网络传播权保护条例》,如果我们转载的作品侵犯了您的权利,请在一个月内通知我们,我们会及时删除。
客服QQ:xxxxxx 邮箱:xxxxxx@qq.com
渝ICP备2023013149号
Top