/// <summary> /// Confirms the transaction in the database and displays the transaction info /// </summary> /// Creator: Olivia Johnson 11-28-12 private void runConfirmation() { BusinessTier bt = new BusinessTier(); DataSet ds = new DataSet(); Decimal totalCost = 0; int numOfRunners = 0; Decimal childCost = 0; Decimal adultCost = 0; int numOfAdults = 0; int numOfChildren = 0; string childPrice = bt.getRunDetails(Session["eventID"].ToString()).Tables[1].Rows[0][12].ToString(); try { ds = bt.confirmRunPayment(customerInfo); foreach (DataRow dr in ds.Tables[1].Rows) { totalCost += Convert.ToDecimal(dr[12].ToString()); numOfRunners++; if (dr["cost"] == childPrice) //if participant is older than 12, count them as an adult. numOfChildren++; else numOfAdults++; //If participant is younger than 12, count them as a child if (dr[7].ToString() != "") //if there is a confirm email sendConfirmationEmail("5k Run Event", dr[1].ToString(), dr[7].ToString()); } lblticketType1.Text = "5k Child Ticket x" + numOfChildren; lblprice1.Text = (childCost * numOfChildren).ToString("C"); lblticketType2.Text = "5k Adult Ticket x" + numOfAdults; lblprice2.Text = (adultCost * numOfAdults).ToString("C"); lbltotalCost.Text = totalCost.ToString("C"); foreach (DataRow dr in ds.Tables[1].Rows) { if (dr[7].ToString() != "") //if there is a confirm email sendConfirmationEmail("5k Run Event", dr[1].ToString(), dr[7].ToString()); } } catch (Exception ex) { ErrorLog.logError(ex); Response.Redirect("Oops.aspx"); } }