private void tsbtnUpdate_Click(object sender, EventArgs e) // Updates the database with the info entered in the text boxes { DatabaseCalls.UpdateGuests(txtName.Text, txtEmail.Text, Convert.ToInt32(lblGuestID.Text)); DatabaseCalls.UpdateBookings(txtRoom.Text, txtGuests.Text, txtBookingFrom.Text, txtBookingTo.Text, Convert.ToInt32(lblBookingID.Text)); ShowGuestsandBooking(); Cleartxtboxes(); }
private void toolStripButtonDelete_Click(object sender, EventArgs e) // deletes seleted guest & booking from the Database8 { DatabaseCalls.DeleteGuest(txtName.Text); DatabaseCalls.DeleteBooking(Convert.ToInt32(lblBookingID.Text)); ShowGuestsandBooking(); Cleartxtboxes(); }
private void CurrentBookings() // displays the the bookings not yet checked in into the first DGV { dgvPending.DataSource = DatabaseCalls.CurrentNotCheckedIn(); dgvPending.Columns[2].Visible = false; // makes it so i can use booking ID to help with checkin but not be visable dgvCheckouts.DataSource = DatabaseCalls.CurrentCheckedIn(); dgvCheckouts.Columns[0].Visible = false; // makes the Guest ID not visable but helps with the checking out process dateTimePickerCheckIn.MinDate = DateTime.Today; dateTimePickerCheckOut.MinDate = DateTime.Today.AddDays(+1); }
private void tsbtnDelete_Click(object sender, EventArgs e)//deltes a guest and booking that is selected { if (lblBookingID.Text == "BookingID" || lblName.Text == "Name") { MessageBox.Show("Please select a guest to Delete"); } else { DatabaseCalls.DeleteGuest(lblName.Text); DatabaseCalls.DeleteBooking(Convert.ToInt16(lblBookingID.Text)); } }
private void tsbtnAdd_Click(object sender, EventArgs e)//add a new room from the data entered in the text boxes { try { DatabaseCalls.AddRoom(txtRoomID.Text, txtSingleBeds.Text, txtDoubleBeds.Text, txtTarrif1Person.Text, txtTarrif2People.Text, txtTarrifExtraPerson.Text); } catch (Exception) { MessageBox.Show("Could not Add room, make sure all text boxes have data in them"); } RoomsStartup(); }
private void tsbtnDelete_Click(object sender, EventArgs e)//deletes the selected room on click { if (lblRoomID.Text == "RoomID") { MessageBox.Show("Please Select the room you want to delete"); } else { DatabaseCalls.DeleteRoom(txtRoomID.Text); } RoomsStartup(); }
private void tsbtnUpdate_Click(object sender, EventArgs e)//updates the selected room with the data from the text boxes { try { DatabaseCalls.UpdateRoom(txtRoomID.Text, txtSingleBeds.Text, txtDoubleBeds.Text, txtTarrif1Person.Text, txtTarrif2People.Text, txtTarrifExtraPerson.Text); } catch (Exception) { MessageBox.Show("Could not update make sure all text boxes have data in them"); } RoomsStartup(); }
private void btnCreateBooking_Click(object sender, EventArgs e) // creates a booking if all details are filled in { if (Convert.ToInt32(lblRoomCost.Text) >= 30 && Convert.ToInt32(lblRoomNumber.Text) >= 0) { int BookingID = DatabaseCalls.InsertBookings(lblBookingDate.Text, lblBookFrom.Text, lblBookTo.Text, lblRoomNumber.Text, lblGuestsNumber.Text, lblRoomCost.Text); DatabaseCalls.InsertGuest(txtFN.Text, txtLN.Text, txtEmail.Text, BookingID); this.Close(); } else { MessageBox.Show("Please Select a room that the guest wants to book"); } }
private void ShowCheckOuts()// displays the guests that are currently checked in in a Datadridview { dgvBilling.DataSource = DatabaseCalls.CurrentCheckedIn(); }
private void ShowHistory()//displays the history of all guests checked out in the DGV { dgvHistory.DataSource = DatabaseCalls.GuestandBookingHistory(); }
public void ShowGuestsandBooking() // displays the guests and booking details in the DGV { dgvGuestsandBooking.DataSource = DatabaseCalls.BookingandGuests(); dgvGuestsandBooking.Columns[0].Visible = false; // makes GuestID not visible but it can still be used to Update dgvGuestsandBooking.Columns[3].Visible = false; // makes BookingID not visible but it can still be used to Update }
private void RoomsStartup()// displays the rooms in the dgv { dgvAllRooms.DataSource = DatabaseCalls.Rooms(); }