private void tv_room_AfterSelect(object sender, TreeViewEventArgs e) { this.lv_room.Items.Clear(); if (this.tv_fjlx.SelectedNode.Level == 0) { //显示所有房间状态 List <Room> room = Bll_Room.GetRoomState(); Method(room); } try { if (this.tv_fjlx.SelectedNode.Tag.ToString() != "0") //显示当前类型房间状态 { List <Room> room = Bll_Room.GetRoomStateByType(this.tv_fjlx.SelectedNode.Tag.ToString()); Method(room); //统计当前类型房间信息 RoomCount(this.tv_fjlx.SelectedNode.Text, this.tv_fjlx.SelectedNode.Tag.ToString()); } else { RoomCount("全部", "0"); } } catch (MySqlException ex) { MessageBox.Show("数据库异常:" + ex.Message); } catch (Exception ex) { MessageBox.Show("其它异常:" + ex.Message); } }
/// <summary> /// 房间统计 /// </summary> /// <param name="name">类型名称</param> /// <param name="typeId">类型Id</param> private void RoomCount(string name, string typeId) { try { //类型 this.lb_fjlx.Text = name; //总数 string count = Bll_Room.GetRoomCount(typeId).ToString(); this.lb_sum.Text = count.ToString(); //入住 string comin = Bll_Room.GetRoomStateCount("1", typeId).ToString(); this.lb_yzfj.Text = comin.ToString(); //空闲 string free = Bll_Room.GetRoomStateCount("2", typeId).ToString(); this.lb_kxfj.Text = free.ToString(); //维修 string bad = Bll_Room.GetRoomStateCount("3", typeId).ToString(); this.lb_wxfj.Text = bad.ToString(); } catch (MySqlException ex) { MessageBox.Show("数据库异常:" + ex.Message); } catch (Exception ex) { MessageBox.Show("其它异常:" + ex.Message); } }
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 FrmCheckin_Load(object sender, EventArgs e) { //查询未入住房间 try { FreeRoomNum freeroom = new FreeRoomNum(); freeroom.lxbh = "0"; freeroom.fjlx = "请选择"; this.cb_rzfj.DisplayMember = "fjlx"; this.cb_rzfj.ValueMember = "lxbh"; List <FreeRoomNum> lst_room = Bll_Room.GetFreeRoom(); for (int i = 0; i < lst_room.Count; i++) { lst_room[i].fjlx = lst_room[i].fjlx + "(" + lst_room[i].sl + ")"; } lst_room.Insert(0, freeroom); this.cb_rzfj.DataSource = lst_room; } catch (MySqlException ex) { MessageBox.Show("数据库异常:" + ex.Message); } catch (Exception ex) { MessageBox.Show("其它异常:" + ex.Message); } }
/// <summary> /// 删除房间信息 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void tsbtn_del_Click(object sender, EventArgs e) { if (MessageBox.Show("是否删除?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.Cancel) { return; } try { bool flag = Bll_Room.DelRoomInfo(gv_fjxx.CurrentRow.Cells["fjbh"].Value.ToString()); if (flag) { MessageBox.Show("删除成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); //刷新 InitRoomInfo(""); } } catch (MySqlException ex) { MessageBox.Show("数据库异常:" + ex.Message); } catch (Exception ex) { MessageBox.Show("其它异常:" + ex.Message); } }
public FrmReserve() { InitializeComponent(); //查询未入住房间 try { FreeRoomNum freeroom = new FreeRoomNum(); freeroom.lxbh = "0"; freeroom.fjlx = "请选择"; this.cb_rzfj.DisplayMember = "fjlx"; this.cb_rzfj.ValueMember = "lxbh"; List <FreeRoomNum> lst_room = Bll_Room.GetFreeRoom(); for (int i = 0; i < lst_room.Count; i++) { lst_room[i].fjlx = lst_room[i].fjlx + "(" + lst_room[i].sl + ")"; } lst_room.Insert(0, freeroom); this.cb_rzfj.DataSource = lst_room; } catch (MySqlException ex) { MessageBox.Show("数据库异常:" + ex.Message); } catch (Exception ex) { MessageBox.Show("其它异常:" + ex.Message); } }
private void tsbtn_del_Click(object sender, EventArgs e) { if (MessageBox.Show("是否删除?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) { return; } try { bool flag = Bll_Room.DeleteRoomType(gv_fjlx.CurrentRow.Cells["lxbh"].Value.ToString()); if (flag) { MessageBox.Show("删除成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); //刷新 FrmRoomType_Load(null, null); } } catch (MySqlException ex) { MessageBox.Show("数据库异常:" + ex.Message);; } catch (Exception ex) { MessageBox.Show("未知异常:" + ex.Message); } }
/// <summary> /// 查询全部房间信息 /// </summary> private void InitRoomInfo(string roomId) { try { this.gv_fjxx.DataSource = Bll_Room.GetRoomInfo(roomId); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
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); } }
private void toolStripTextBox2_TextChanged(object sender, EventArgs e) { if (!string.IsNullOrEmpty(toolStripTextBox2.Text)) { this.lv_room.Items.Clear(); List <Room> room = Bll_Room.GetRoomByFjbh(toolStripTextBox2.Text); Method(room); } else { FrmMain_Load(null, null); } }
private void FrmRoomInfo_Load(object sender, EventArgs e) { InitRoomInfo(""); #region 绑定房间类型 this.cb_fjlx.DisplayMember = "lxmc"; this.cb_fjlx.ValueMember = "lxbh"; try { List <RoomType> r = Bll_Room.GetAllRoomTypeInfo(""); RoomType roomtype = new RoomType(); roomtype.lxbh = "0"; roomtype.lxmc = "请选择"; roomtype.rzdj = "0"; r.Insert(0, roomtype); this.cb_fjlx.DataSource = r; } catch (MySqlException ex) { MessageBox.Show("数据库异常:" + ex.Message); } catch (Exception ex) { MessageBox.Show("其它异常:" + ex.Message); } #endregion #region 绑定房间状态 this.cb_fjzt.DisplayMember = "ztmc"; this.cb_fjzt.ValueMember = "ztbh"; try { List <RoomState> roomState = Bll_Room.GetStateInfo(""); RoomState roomstate = new RoomState(); roomstate.ztbh = "-1"; roomstate.ztmc = "请选择"; roomState.Insert(0, roomstate); this.cb_fjzt.DataSource = roomState; } catch (MySqlException ex) { MessageBox.Show("数据库异常:" + ex.Message); } catch (Exception ex) { MessageBox.Show("其它异常:" + ex.Message); } #endregion }
private void FrmRoomType_Load(object sender, EventArgs e) { //绑定DataGridView数据 try { this.gv_fjlx.DataSource = Bll_Room.GetAllRoomTypeInfo(this.txt_lxmc.Text.Trim()); } catch (MySqlException ex) { MessageBox.Show("数据库异常:" + ex.Message);; } catch (Exception ex) { MessageBox.Show("未知异常:" + ex.Message); } }
private void FrmMain_Load(object sender, EventArgs e) { #region 暂未启用的功能做隐藏显示 tsbtn_cywh.Visible = false; tsbtn_srtj.Visible = false; tsbtn_gkcx.Visible = false; #endregion timer1.Start(); //设置工具栏信息 ts_time.Text = DateTime.Now.ToString(); ts_loginuser.Text = LoginInfo.ygxh; this.tv_fjlx.Nodes.Clear(); TreeNode root = new TreeNode("全部"); root.Tag = 0; try { List <RoomType> roomType = Bll_Room.GetAllRoomType(); if (roomType.Count > 0) { foreach (RoomType var in roomType) { TreeNode node = new TreeNode(); node.Text = var.lxmc; node.Tag = var.lxbh; root.Nodes.Add(node); } this.tv_fjlx.Nodes.Add(root); this.tv_fjlx.ExpandAll(); //显示所有房间状态 this.lv_room.Items.Clear(); List <Room> room = Bll_Room.GetRoomState(); Method(room); } } catch (MySqlException ex) { MessageBox.Show("数据库异常:" + ex.Message); } catch (Exception ex) { MessageBox.Show("其它异常:" + ex.Message); } RoomCount("全部", "0"); }
private void btn_ok_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(txt_khxm.Text.Trim())) { toolTip1.Show("客户姓名不能为空!", this.txt_khxm, 1000); txt_khxm.Focus(); return; } if (string.IsNullOrEmpty(txt_sfzmhm.Text.Trim())) { toolTip1.Show("身份证号不能为空!", this.txt_sfzmhm, 1000); txt_sfzmhm.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; } GuestRecord guest = new GuestRecord(); guest.lsh = lshCreate.GetLsh(); guest.khxm = this.txt_khxm.Text.Trim(); guest.sfzmhm = this.txt_sfzmhm.Text.Trim(); guest.lxdh = this.txt_lxdh.Text.Trim(); guest.xb = this.cb_khxb.Text; guest.rzyj = this.txt_rzyj.Text.Trim(); guest.fjbh = Bll_Room.GetFreeRoomIdWithFjlx(cb_rzfj.SelectedValue.ToString()).ToString(); guest.rzrq = this.dtp_rzsj.Value; guest.rzts = this.txt_rzts.Text.Trim(); guest.tfrq = guest.rzrq.AddDays(Convert.ToInt32(guest.rzts)); guest.rzzt = "1"; try { if (Bll_Guset.AddGuest(guest) > 0) { MessageBox.Show("入住办理成功!房间号:" + guest.fjbh, "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } } catch (MySqlException ex) { MessageBox.Show("数据库异常:" + ex.Message); } catch (Exception ex) { MessageBox.Show("其它异常:" + ex.Message); } }
/// <summary> /// 确认修改或添加 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btn_ok_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(txt_fjbh.Text.Trim())) { toolTip1.Show("请输入房间编号", this.txt_fjbh, 1000); txt_fjbh.Focus(); return; } else if (string.IsNullOrEmpty(txt_fjms.Text.Trim())) { toolTip1.Show("请输入房间编号", this.txt_fjms, 1000); txt_fjms.Focus(); return; } else if (cb_fjlx.SelectedIndex == 0) { toolTip1.Show("请选择房间类型", this.cb_fjlx, 1000); cb_fjlx.Focus(); return; } #region 新增 if (state == State.add) { int single = Convert.ToInt32(Bll_Room.CheckRoomId(txt_fjbh.Text.Trim())); if (single > 0) { MessageBox.Show("房间号已存在!"); txt_fjbh.Text = ""; txt_fjbh.Focus(); } else { Room room = new Room(); room.fjbh = txt_fjbh.Text.Trim(); room.bz = txt_fjms.Text.Trim(); room.fjlx = this.cb_fjlx.SelectedValue.ToString(); room.fjzt = this.cb_fjzt.SelectedValue.ToString(); try { bool flag = Bll_Room.AddRoomInfo(room); if (flag) { MessageBox.Show("添加成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); //刷新 InitRoomInfo(""); } } catch (MySqlException ex) { MessageBox.Show("数据库异常:" + ex.Message); } catch (Exception ex) { MessageBox.Show("其它异常:" + ex.Message); } } } #endregion #region 修改 if (state == State.update) { Room room = new Room(); room.bz = txt_fjms.Text.Trim(); room.fjlx = this.cb_fjlx.SelectedValue.ToString(); room.fjbh = gv_fjxx.CurrentRow.Cells["fjbh"].Value.ToString(); txt_fjbh.Text = room.fjbh; room.fjzt = this.cb_fjzt.SelectedValue.ToString(); try { bool flag = Bll_Room.UpdateRoomInfo(room); if (flag) { MessageBox.Show("更新成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); //刷新 InitRoomInfo(""); } } catch (MySqlException ex) { MessageBox.Show("数据库异常:" + ex.Message); } catch (Exception ex) { MessageBox.Show("其它异常:" + ex.Message); } } #endregion }
private void btn_ok_Click(object sender, EventArgs e) { //非空验证 if (string.IsNullOrEmpty(this.txt_lxbh.Text)) { toolTip1.Show("请输入房间类型编号!", this.txt_lxbh, 1000); this.txt_lxbh.Focus(); return; } else if (string.IsNullOrEmpty(this.txt_fjlx.Text)) { toolTip1.Show("请输入房间类型名称!", this.txt_fjlx, 1000); this.txt_fjlx.Focus(); return; } else if (string.IsNullOrEmpty(this.txt_rzdj.Text)) { toolTip1.Show("请输入入住单价!", this.txt_rzdj, 1000); this.txt_rzdj.Focus(); return; } #region 新增 if (state == State.add) { try { int single = Convert.ToInt32(Bll_Room.CheckRoomType(txt_lxbh.Text.Trim())); if (single > 0) { MessageBox.Show("房间类型编号已存在!"); txt_lxbh.Text = ""; txt_lxbh.Focus(); return; } else { RoomType roomtype = new RoomType(); roomtype.lxbh = txt_lxbh.Text.Trim(); roomtype.lxmc = txt_fjlx.Text.Trim(); roomtype.rzdj = txt_rzdj.Text.Trim(); bool flag = Bll_Room.AddRoomType(roomtype); if (flag) { txt_lxbh.Text = ""; txt_lxmc.Text = ""; txt_rzdj.Text = ""; MessageBox.Show("添加成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); //刷新数据 FrmRoomType_Load(null, null); } } } catch (MySqlException ex) { MessageBox.Show("数据库异常:" + ex.Message);; } catch (Exception ex) { MessageBox.Show("未知异常:" + ex.Message); } return; } #endregion #region 更新 if (state == State.update) { if (MessageBox.Show("是否修改?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) { return; } try { RoomType roomtype = new RoomType(); roomtype.lxbh = this.gv_fjlx.CurrentRow.Cells["lxbh"].Value.ToString(); roomtype.lxmc = txt_fjlx.Text.Trim(); roomtype.rzdj = txt_rzdj.Text.Trim(); bool flag = Bll_Room.UpdateRoomType(roomtype); if (flag) { MessageBox.Show("修改成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); this.tsbtn_add_Click(null, null); this.tsbtn_cancel.Enabled = false; this.txt_lxbh.Enabled = false; this.txt_fjlx.Enabled = false; this.txt_rzdj.Enabled = false; this.btn_ok.Enabled = false; //刷新数据 FrmRoomType_Load(null, null); } } catch (MySqlException ex) { MessageBox.Show("数据库异常:" + ex.Message);; } catch (Exception ex) { MessageBox.Show("未知异常:" + ex.Message); } return; } #endregion }