/// <summary> /// Pat Banks /// created: 2015/04/22 /// Need confirmation from guest before can officially submit the booking /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnConfirm_Click(object sender, EventArgs e) { Booking webBookingToAdd = new Booking((int)foundGuest.HotelGuestID, 100, selectedItemListing.ItemListID, ticketQty, DateTime.Now, selectedItemListing.Price, extendedPrice, discount, totalPrice); ResultsEdit addResult = myManager.AddBookingResult(webBookingToAdd); switch (addResult) { case ResultsEdit.Success: showError("Thank You, " + foundGuest.GetFullName + ". <br>You have successfully signed up for:\n" + selectedItemListing.EventName + "."); clearFields(); gvListings.DataBind(); confirmDetails.Style.Add("display", "none"); ticketRequest.Style.Add("display", "block"); break; case ResultsEdit.ListingFull: showError("Sorry, that event is full!"); break; case ResultsEdit.DatabaseError: showError("Sorry, there was a problem registering for this event.\nPlease contact the front desk."); break; } }
public void TestAddBookingResult() { //booking object created TestBookingConstructor(); ResultsEdit result = myBook.AddBookingResult(booking); ResultsEdit expected = ResultsEdit.Success; Assert.AreEqual(expected, result); }
/// <summary> /// Tony Noel /// Created: 2015/02/13 /// Handles the add Booking click event /// </summary> /// <remarks> /// Pat Banks /// Updated: 2015/03/19 /// Moved decision logic to Booking Manager /// </remarks> /// <param name="sender"></param> /// <param name="e"></param> private async void btnAddBookingAdd_Click(object sender, RoutedEventArgs e) { //validates data from form if (!Validate()) { return; } try { Booking bookingToAdd = GatherFormInformation(); //get results of adding booking ResultsEdit result = _bookingManager.AddBookingResult(bookingToAdd); switch (result) { case (ResultsEdit.QuantityZero): throw new WanderingTurtleException(this, "Quantity of tickets must be more than zero."); case (ResultsEdit.DatabaseError): throw new WanderingTurtleException(this, "Booking could not be added due to database malfunction."); case (ResultsEdit.Success): BtnAddBookingAdd.IsEnabled = false; await this.ShowMessageDialog("The booking has been successfully added."); DialogResult = true; Close(); break; } } catch (Exception ex) { throw new WanderingTurtleException(this, ex); } }
public void AddBookingResult() { ResultsEdit result = myBook.AddBookingResult(booking); }