/// <summary> /// Closes Edit_Delete and shows ReadBooking /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnCancel_Click(object sender, EventArgs e) { ReadBooking rb = new ReadBooking(); rb.Show(); this.Close(); }
/// <summary> /// If tbAmountOfPeople.Visible is false then it runs UpdateFirstClick(), LoadCBEmployee and LoadCBEscapeRoom() /// Then it checks if AmountOfPeople is larger than 0 the methode Update runs and it shows ReadBooking and closes itself /// If AmountOfPeople is not larger than 0 it shows errorelabel and sets the message in the label /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnUpdate_Click(object sender, EventArgs e) { if (tbAmountOfPeople.Visible == false) { UpdateFirstClick(); LoadCBEmployee(); LoadCBEscapeRoom(); } else { BookingCtr bc = new BookingCtr(); if (updatetBook.AmountOfPeople > 0) { bc.Update(updatetBook.Cus, updatetBook.Er, updatetBook.Date, updatetBook.Emp, updatetBook.AmountOfPeople, updatetBook.BookingTime, updatetBook.Id); ReadBooking rb = new ReadBooking(); rb.Show(); this.Close(); } else { lblErrorAmountOfPeople.Text = "må ikke være 0"; lblErrorAmountOfPeople.Show(); } } }
/// <summary> /// Shows ReadBooking and hides itself /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnReadBookings_Click(object sender, EventArgs e) { ReadBooking rb = new ReadBooking(); rb.Show(); this.Hide(); }
/// <summary> /// The Delete botton, deletes the booking then closes and shows ReadBooking, if lblAmountOFPeopleDelete.Visible == false then it runs DeleteFirstClick() /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnDelete_Click(object sender, EventArgs e) { if (lblAmountOfPeopleDelete.Visible == false) { DeleteFirstClick(); } else { BookingCtr bookctr = new BookingCtr(); bookctr.Delete(book.Cus, book.Er, book.Date, book.Emp, book.AmountOfPeople, book.BookingTime); ReadBooking rb = new ReadBooking(); rb.Show(); this.Close(); } }