// 新增预订 private void tsbReserve_Click(object sender, EventArgs e) { FrmReserve frmReserve = new FrmReserve(); frmReserve.ShowDialog(); frmReserve.Dispose(); }
// 选择列表右键菜单 private void cmsReserve_ItemClicked(object sender, ToolStripItemClickedEventArgs e) { ContextMenuStrip cms = (ContextMenuStrip)sender; if (e.ClickedItem == cms.Items[0]) // 新增预定 { FrmReserve frmReserve = new FrmReserve(); frmReserve.ShowDialog(); frmReserve.Dispose(); } }
// 单选框右键菜单 private void cmsRoom_ItemClicked(object sender, ToolStripItemClickedEventArgs e) { ContextMenuStrip cms = (ContextMenuStrip)sender; // 获取菜单 RadioButton rb = (RadioButton)cms.SourceControl; // 获取被右击的 RadioButton if (e.ClickedItem == cms.Items[0]) // 预订此房 { FrmReserve frmReserve = new FrmReserve(); frmReserve.lvSelectedRooms.Items.Clear(); ListViewItem item = new ListViewItem(); string[] strs = rb.Text.Split(new char[1] { '\n' }); // 分割房间信息 item.Text = strs[0]; // 房间编号 item.SubItems.Add(strs[1]); // 房间类型 if (strs[1].Equals("大床房")) { item.SubItems.Add("2"); item.SubItems.Add("140"); item.SubItems.Add(""); item.SubItems.Add("否"); } else if (strs[1].Equals("双床房")) { item.SubItems.Add("2"); item.SubItems.Add("180"); item.SubItems.Add(""); item.SubItems.Add("否"); } else if (strs[1].Equals("三床房")) { item.SubItems.Add("3"); item.SubItems.Add("220"); item.SubItems.Add(""); item.SubItems.Add("否"); } else { item.SubItems.Add("5"); item.SubItems.Add("260"); item.SubItems.Add(""); item.SubItems.Add("否"); } frmReserve.lvSelectedRooms.Items.Add(item); // 插入已选房间 frmReserve.ShowDialog(); frmReserve.Dispose(); } else if (e.ClickedItem == cms.Items[1]) // 登记入住 { FrmCheckIn frmCheckIn = new FrmCheckIn(); frmCheckIn.ShowDialog(); frmCheckIn.Dispose(); } else if (e.ClickedItem == cms.Items[2]) // 退房结账 { } else if (e.ClickedItem == cms.Items[4]) // 管理信息 { FrmRoom frmRoom = new FrmRoom(); frmRoom.ShowDialog(); frmRoom.Dispose(); } else { } }