Advertisement
DevUModerator

Untitled

Apr 5th, 2018
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. // get the index for the PGS and PRpO and if they are selected then deduct $2
  2. var pepperoni = toppingsCheckBoxList.Items.FindByText("Pepperoni (+$1.50)");
  3. var greenPepper = toppingsCheckBoxList.Items.FindByText("Green Peppers (+$0.50)");
  4. var sausage = toppingsCheckBoxList.Items.FindByText("Sausage (+$1.00)");
  5. var redPepper = toppingsCheckBoxList.Items.FindByText("Red Peppers(+$0.75)");
  6. var onion = toppingsCheckBoxList.Items.FindByText("Onion (+$0.75)");
  7.  
  8. try
  9. {
  10. if ((pepperoni.Selected &&
  11. greenPepper.Selected &&
  12. sausage.Selected) ||
  13. (pepperoni.Selected &&
  14. redPepper.Selected &&
  15. onion.Selected))
  16. totalCost -= 2.00;
  17.  
  18. // return the total
  19. totalPrice = string.Format("Total: {0:C2}", totalCost);
  20. }
  21. catch(NullReferenceException nre)
  22. {
  23. totalPrice = string.Format("Error: {0}<br/>{1}", nre.Message, nre.InnerException);
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement