当前位置:首页 > 《HHL酒店管理系统》课程设计报告书V1.0 - 图文
dataGridView1.DataSource = ds.Tables[0]; } else {
MessageBox.Show(\该房间不能续房!!!\); } }
catch (Exception ex) {
MessageBox.Show(ex.Message, \操作数据库出错!\, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); }
finally {
con.Close(); } } 运行结果:
108房原定的退房时间是2012-6-22,现在想把退房时间再推后两天,即是2012-6-24号。
- 25 -
6.4结账退房功能的实现
代码如下:
if (txtfindID.Text == \) {
MessageBox.Show(\没有输入查询数据\); } else {
//退房前需要对房间的费用进行结算 SqlConnection con = myCon.getCon(); SqlCommand command = null;
string sql = \ + txtfindID.Text.Trim(); try {
command = new SqlCommand(sql, con); con.Open();
sql = \where R_ID=\ + txtfindID.Text.Trim();
command = new SqlCommand(sql, con); int num = (int)command.ExecuteScalar();
sql = \ + txtfindID.Text.Trim();
- 26 -
command = new SqlCommand(sql, con);
double Money = Convert.ToDouble(command.ExecuteScalar()); double sum = 0; sum = Money * num;
string str = Convert.ToString(sum);
MessageBox.Show(\需要支付的总金额为:\ + str);
}
catch (Exception ex) {
MessageBox.Show(ex.Message, \操作数据库出错!\, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); }
finally {
con.Close(); }
if (txtfindID.Text == \) {
MessageBox.Show(\没有输入查询数据\); } else {
bool id =
BLL.CustomerBLL.BllUpdate(int.Parse(this.txtfindID.Text)); if (id) {
listView1.Items.Clear(); SqlDataReader dr =
BLL.CustomerBLL.BllSelectID(int.Parse(this.txtfindID.Text)); while (dr.Read()) {
ListViewItem lv = this.listView2.Items.Add(dr[0].ToString());
lv.SubItems.Add(dr[1].ToString()); lv.SubItems.Add(dr[2].ToString()); lv.SubItems.Add(dr[3].ToString()); lv.SubItems.Add(dr[4].ToString()); lv.SubItems.Add(dr[5].ToString()); lv.SubItems.Add(dr[6].ToString()); }
MessageBox.Show(\退房成功\); }
- 27 -
else {
MessageBox.Show(\退房失败\); } } } 运行结果:
查询要退房的信息,例如房号为108
- 28 -
共分享92篇相关文档