private void button1_Click(object sender, EventArgs e) { if (this.cb_rzfj.SelectedIndex == 0) { toolTip1.Show("请选择入住房间类型", this.cb_rzfj, 1000); cb_rzfj.Focus(); return; } if (string.IsNullOrEmpty(txt_lxdh.Text.Trim())) { toolTip1.Show("联系电话不能为空!", this.txt_lxdh, 1000); txt_lxdh.Focus(); return; } RoomRecord record = new RoomRecord(); record.lsh = LshCreate.GetLsh(); record.lxdh = this.txt_lxdh.Text.Trim(); record.fjbh = Bll_Room.GetFreeRoomIdWithFjlx(cb_rzfj.SelectedValue.ToString()).ToString(); record.rzzt = "4"; if (Bll_Guset.AddReserveRecord(record) > 0) { MessageBox.Show("预约成功!房间号:" + record.fjbh, "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private void btn_ok_Click(object sender, EventArgs e) { if (listView1.Items.Count == 0) { toolTip1.Show("客户信息不能为空!", this.listView1, 1000); listView1.Focus(); return; } if (string.IsNullOrEmpty(txt_rzts.Text.Trim())) { toolTip1.Show("入住天数不能为空!", this.txt_rzts, 1000); txt_rzts.Focus(); return; } if (string.IsNullOrEmpty(txt_lxdh.Text.Trim())) { toolTip1.Show("联系电话不能为空!", this.txt_lxdh, 1000); txt_lxdh.Focus(); return; } if (this.cb_rzfj.SelectedIndex == 0) { toolTip1.Show("请选择入住房间类型", this.cb_rzfj, 1000); cb_rzfj.Focus(); return; } RoomRecord record = new RoomRecord(); record.lsh = LshCreate.GetLsh(); record.lxdh = txt_lxdh.Text.Trim(); record.rzyj = txt_rzyj.Text.Trim(); record.fjbh = Bll_Room.GetFreeRoomIdWithFjlx(cb_rzfj.SelectedValue.ToString()).ToString(); record.rzrq = this.dtp_rzsj.Value; record.rzts = this.txt_rzts.Text.Trim(); record.tfrq = record.rzrq.AddDays(Convert.ToInt32(record.rzts)); record.rzzt = "1"; record.khxx = TempGuest.guests; try { if (Bll_Guset.AddCheckinRecord(record) > 0) { MessageBox.Show("入住办理成功!房间号:" + record.fjbh, "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } } catch (MySqlException ex) { MessageBox.Show("数据库异常:" + ex.Message); } catch (Exception ex) { MessageBox.Show("其它异常:" + ex.Message); } }