//添加客房 void AddRoom(object sender,System.EventArgs e) { if (MainForm.LoadedUser.Privilege == 0) { AddRoom newAddRoom = new AddRoom(); newAddRoom.Text = "添加客房"; if (newAddRoom.ShowDialog() == DialogResult.OK) { if (new RoomManager().CheckRoomData(NewRoom )) { if (MessageBox.Show("您确定要添加该客房吗?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) == DialogResult.OK) { if (new RoomManager().AddRoom(NewRoom)) { MessageBox.Show("添加成功!", "提示"); } else { MessageBox.Show("发生错误,没有添加成功!", "提示"); } } } else { MessageBox.Show("您填写的信息有误,请重新填写!", "提示"); } } } else { MessageBox.Show("您没有权限添加客房", "提示"); } }
//添加客房 void AddRoom(object sender, System.EventArgs e) { if (MainForm.LoadedUser.Privilege == 0) { AddRoom newAddRoom = new AddRoom(); newAddRoom.Text = "添加客房"; if (newAddRoom.ShowDialog() == DialogResult.OK) { if (new RoomManager().CheckRoomData(NewRoom)) { if (MessageBox.Show("您确定要添加该客房吗?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) == DialogResult.OK) { if (new RoomManager().AddRoom(NewRoom)) { MessageBox.Show("添加成功!", "提示"); } else { MessageBox.Show("发生错误,没有添加成功!", "提示"); } } } else { MessageBox.Show("您填写的信息有误,请重新填写!", "提示"); } } } else { MessageBox.Show("您没有权限添加客房", "提示"); } }
//修改客房信息 void UpdateRoom(object sender, System.EventArgs e) { if (MainForm.LoadedUser.Privilege == 0) { if (this.listView1.SelectedItems.Count == 0) { MessageBox.Show("为了保证您数据的安全与准确,请一次选择一个房间!", "提示"); } else { if (new RoomManager().GetRoomState(SelectedRoom) == 1) { MessageBox.Show("当前客房不是空客房,不能进行此操作!", "提示"); } else { AddRoom newAddRoom = new AddRoom(); newAddRoom.Text = "修改客房"; NewRoom = this.SelectedRoom; if (newAddRoom.ShowDialog() == DialogResult.OK) { if (new RoomManager().CheckRoomData(NewRoom)) { if (MessageBox.Show("您确定要修改该客房吗?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) == DialogResult.OK) { if (new RoomManager().UpdateRoom(NewRoom)) { MessageBox.Show("修改成功!", "提示"); } else { MessageBox.Show("没有成功修改,请重新修改!", "提示"); } } } else { MessageBox.Show("您填写的信息有误,请重新填写!", "提示"); } } } } } else { MessageBox.Show("您没有权限修改客房", "提示"); } }
//修改客房信息 void UpdateRoom(object sender, System.EventArgs e) { if (MainForm.LoadedUser.Privilege == 0) { if (this.listView1.SelectedItems.Count == 0) { MessageBox.Show("为了保证您数据的安全与准确,请一次选择一个房间!", "提示"); } else { if (new RoomManager().GetRoomState(SelectedRoom)==1) { MessageBox.Show("当前客房不是空客房,不能进行此操作!", "提示"); } else { AddRoom newAddRoom = new AddRoom(); newAddRoom.Text = "修改客房"; NewRoom = this.SelectedRoom; if (newAddRoom.ShowDialog()==DialogResult.OK ) { if (new RoomManager().CheckRoomData(NewRoom )) { if (MessageBox.Show("您确定要修改该客房吗?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) == DialogResult.OK) { if (new RoomManager().UpdateRoom(NewRoom )) { MessageBox.Show("修改成功!", "提示"); } else { MessageBox.Show("没有成功修改,请重新修改!", "提示"); } } } else { MessageBox.Show("您填写的信息有误,请重新填写!", "提示"); } } } } } else { MessageBox.Show("您没有权限修改客房", "提示"); } }