private void btnConfirm_Click(object sender, EventArgs e) { // deleting the reservation and resetting the ui Reservations cancel = new Reservations(); cancel.getRes_ID(); cancel.setRes_ID(Convert.ToInt32(txtResId.Text)); cancel.deleteReservation(); MessageBox.Show("A reservation has been successfully cancelled"); cboRes_ID.SelectedIndex = -1; grpDeleteRes.Visible = false; cboRes_ID.Items.Clear(); DataSet ds = new DataSet(); ds = Reservations.getValidReservationsForDeletion(ds); if (ds.Tables["ss"].Rows.Count == 0) { cboRes_ID.Focus(); MessageBox.Show("There are no reservations available to be cancelled", "Error Message", MessageBoxButtons.OK, MessageBoxIcon.Warning); cboRes_ID.TabStop = false; } else { for (int i = 0; i < ds.Tables["ss"].Rows.Count; i++) { cboRes_ID.Items.Add(String.Format("{0:000000}", ds.Tables[0].Rows[i][0]) + " " + ds.Tables[0].Rows[i][2].ToString()); } } }
private void CancelReservation_Load(object sender, EventArgs e) { DataSet ds = new DataSet(); ds = Reservations.getValidReservationsForDeletion(ds); if (ds.Tables["ss"].Rows.Count == 0) { cboRes_ID.Focus(); MessageBox.Show("There are no reservations available to be cancelled", "Error Message", MessageBoxButtons.OK, MessageBoxIcon.Warning); cboRes_ID.TabStop = false; } else { for (int i = 0; i < ds.Tables["ss"].Rows.Count; i++) { cboRes_ID.Items.Add(String.Format("{0:000000}", ds.Tables[0].Rows[i][0]) + " " + ds.Tables[0].Rows[i][2].ToString()); } } }