云题海 - 专业文章范例文档资料分享平台

当前位置:首页 > 《HHL酒店管理系统》课程设计报告书V1.0 - 图文

《HHL酒店管理系统》课程设计报告书V1.0 - 图文

  • 62 次阅读
  • 3 次下载
  • 2025/5/7 18:28:04

6.2换房功能的实现

代码如下:

SqlConnection con = myCon.getCon();

if (textBox1.Text.Trim() == \ || textBox2.Text.Trim() == \) {

MessageBox.Show(\请输入客户名和房间号!\); } else {

con.Open();

string consql = \ + textBox1.Text.Trim() + \;

SqlCommand command = new SqlCommand(consql, con); int num = Convert.ToInt32(command.ExecuteScalar()); string Num = Convert.ToString(num); //MessageBox.Show(Num);

consql = \ + Num + \;

command = new SqlCommand(consql, con);

string state = (string)command.ExecuteScalar(); if (state != \已入住\) {

MessageBox.Show(\该客户已经退房,不能进行换房操作!\); } else {

consql = \ + textBox2.Text.Trim();

command = new SqlCommand(consql, con); state = (string)command.ExecuteScalar(); if (state != \空房\) {

MessageBox.Show(\该房间不能换!\); } else {

consql = \ + Num; command = new SqlCommand(consql, con);

string str = (string)command.ExecuteScalar(); ////MessageBox.Show(str);

consql = \ + str; command = new SqlCommand(consql, con); DateTime s1 =

- 21 -

Convert.ToDateTime(command.ExecuteScalar());

consql = \R_daoqitime from Room where R_ID=\ + str; command = new SqlCommand(consql, con); DateTime s2 =

Convert.ToDateTime(command.ExecuteScalar());

consql = \空房' where R_ID=\+str ;

command = new SqlCommand(consql, con); command.ExecuteNonQuery();

consql = \已入住', R_intime='\ + s1 + \ + s2 + \ + textBox2.Text.Trim(); command = new SqlCommand(consql, con); command.ExecuteNonQuery();

consql = \Customer set R_ID=\ + textBox2.Text.Trim() + \ + Num;

command = new SqlCommand(consql, con); command.ExecuteNonQuery();

StringBuilder sql = new StringBuilder();

sql.Append(\客户号 , C_name AS 客户名称, C_sex AS 性别, R_ID AS 房号, C_AllMoney AS 总费用, C_money AS 费用, C_Phone AS 联系电话, C_Cardid AS 身份证号, C_time AS 入住时间, C_daoqitime AS 退房时间, C_notes AS 备注 from Customer\);

SqlDataAdapter dapt = new SqlDataAdapter(sql.ToString(), con);

ds = new DataSet();

dapt.Fill(ds, \);

MessageBox.Show(\换房成功!\);

dataGridView1.DataSource = ds.Tables[0]; con.Close(); } }

- 22 -

运行结果: 换房前信息

由原来的202房换为108房

- 23 -

6.3续房功能的实现

代码如下:

SqlConnection con = myCon.getCon(); con.Open();

if (textBox1.Text.Trim() == \ || textBox2.Text.Trim() == \) {

MessageBox.Show(\请输入房间号和续房天数!\); } else {

string sql = \ + textBox1.Text.Trim(); try {

command = new SqlCommand(sql, con); //con.Open();

string state = (string)command.ExecuteScalar(); if (state == \已入住\) {

sql = \ + textBox1.Text.Trim();

command = new SqlCommand(sql, con); int day = (int)command.ExecuteScalar();

day = Convert.ToInt32(textBox2.Text.Trim()); //if(day>)

string d = Convert.ToString(day);

sql = \ + d + \ + textBox1.Text.Trim();

command = new SqlCommand(sql, con); command.ExecuteNonQuery(); MessageBox.Show(\续房成功!\);

sql = \房号,R_floor as 楼层,R_money as 房价,R_type as 房间类型,R_status as 房间状态,R_intime as 入住时间,R_daoqitime as 退房时间,R_notes as 备注 from Room\;

SqlDataAdapter dapt = new SqlDataAdapter(sql.ToString(), con);

ds = new DataSet(); dapt.Fill(ds, \);

- 24 -

  • 收藏
  • 违规举报
  • 版权认领
下载文档10.00 元 加入VIP免费下载
推荐下载
本文作者:...

共分享92篇相关文档

文档简介:

6.2换房功能的实现 代码如下: SqlConnection con = myCon.getCon(); if (textBox1.Text.Trim() == \ || textBox2.Text.Trim() == \) { MessageBox.Show(\请输入客户名和房间号!\); } else { con.Open(); string consql = \ + textBox1.Text.Trim() + \; SqlCommand

× 游客快捷下载通道(下载后可以自由复制和排版)
单篇付费下载
限时特价:10 元/份 原价:20元
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信:fanwen365 QQ:370150219
Copyright © 云题海 All Rights Reserved. 苏ICP备16052595号-3 网站地图 客服QQ:370150219 邮箱:370150219@qq.com