/// <summary> /// Retrieves the ticket price for each ticket type from the database based on the eventID /// </summary> /// <param name="type">String storing the type of ticket - adult or child</param> /// <returns>String storing the price for either an adult ticket or child ticket</returns> /// Created by: Olivia Johnson 11-18-12 private String getTicketPrice(String type) { BusinessTier bt = new BusinessTier(); if (eventType == "Dinner") { if (type == "child") return bt.getDinnerDetails(Session["eventID"].ToString()).Tables[1].Rows[0][12].ToString(); else return bt.getDinnerDetails(Session["eventID"].ToString()).Tables[1].Rows[0][13].ToString(); } else { if (type == "child") return bt.getRunDetails(Session["eventID"].ToString()).Tables[1].Rows[0][12].ToString(); else return bt.getRunDetails(Session["eventID"].ToString()).Tables[1].Rows[0][13].ToString(); } }
/// <summary> /// Confirms the transaction in the database and displays the transaction info /// </summary> /// Creator: Olivia Johnson 11-28-12 private void dinnerConfirmation() { BusinessTier bt = new BusinessTier(); DataSet ds = new DataSet(); Decimal childCost = 0; Decimal adultCost = 0; int numOfAdults = 0; int numOfChildren = 0; try { ds = bt.confirmDinnerPayment(customerInfo); numOfChildren = Convert.ToInt16(ds.Tables[1].Rows[0][5].ToString()); numOfAdults = Convert.ToInt16(ds.Tables[1].Rows[0][6].ToString()); childCost = Convert.ToDecimal(bt.getDinnerDetails(eventID).Tables[1].Rows[0][12].ToString()); adultCost = Convert.ToDecimal(bt.getDinnerDetails(eventID).Tables[1].Rows[0][13].ToString()); lblticketType1.Text = "Child Dinner Ticket x" + numOfChildren; lblprice1.Text = (numOfChildren * childCost).ToString("C"); lblticketType2.Text = "Adult Dinner Ticket x" + numOfAdults; lblprice2.Text = (numOfAdults * adultCost).ToString("C"); lbltotalCost.Text = ((numOfAdults * adultCost) + (numOfChildren * childCost)).ToString("C"); sendConfirmationEmail("Dinner Event", ds.Tables[1].Rows[0][0].ToString(), ds.Tables[1].Rows[0][3].ToString()); } catch (Exception ex) { ErrorLog.logError(ex); Response.Redirect("Oops.aspx"); } }
/// <summary> /// This method runs as the page is loaded. The event information that is displayed is based on the /// query string "eventID". /// </summary> /// <param name="sender"></param> /// <param name="e"></param> /// Aaron Copeland - 11/19/2012 /// Tested by Aaron Copeland - 11/28/2012 protected void Page_Load(object sender, EventArgs e) { try { if (Request["eventID"] == null) // Go to events main page { Response.Redirect("Events.aspx", false); } else { String eventID = Request.QueryString["eventID"]; BusinessTier bt = new BusinessTier(); // get the details for the Dinner Event DataSet ds = bt.getDinnerDetails(eventID); // Calculates The Participants DataSet ds2 = bt.getMaxDinnerParticipants(eventID); DataSet ds3 = bt.getDinnerParticipants(eventID); // Prints out any errors String errorString = ""; checkDSErrorTable(ds, errorString); checkDSErrorTable(ds2, errorString); checkDSErrorTable(ds3, errorString); lblError.Text = errorString; // populate the information on the page populateDinnerDetails(ds); // calculates the number of participants calculateParticipants(ds2, ds3); GoogleMap.LoadAddress(ds.Tables[1].Rows[0][15].ToString() + " " + ds.Tables[1].Rows[0][16].ToString() + " " + ds.Tables[1].Rows[0][17].ToString() + " " + ds.Tables[1].Rows[0][18].ToString()); } } catch (Exception ex) { ErrorLog.logError(ex); Response.Redirect("Oops.aspx"); } }