Skip to content

Instantly share code, notes, and snippets.

@codereflection
Created January 24, 2011 08:57
Show Gist options
  • Select an option

  • Save codereflection/792981 to your computer and use it in GitHub Desktop.

Select an option

Save codereflection/792981 to your computer and use it in GitHub Desktop.
This, kids, is a great example of "write your own shopping cart F A I L"
protected void GetPriceDetails()
{
var oc = new MiddleTier.BLL.OrderConfirmation();
oc = OrderConfirmationUtility.GetOrderConfirmation(Convert.ToInt32(this.OrderConfirmationID));
var Quantity = oc.Quantity;
var Paper = oc.Paper;
var DeliverySpeed = oc.DeliverySpeed;
switch (Quantity)
{
case "250 for $25.00":
this.QuantitiyValue = "25.00";
this.QuantityCount = "250";
break;
case "500 for $37.50":
this.QuantitiyValue = "37.50";
this.QuantityCount = "500";
break;
case "1000 for $25.00":
this.QuantitiyValue = "25.00";
this.QuantityCount = "250";
break;
case "1000 for $19.99":
this.QuantitiyValue = "19.99";
this.QuantityCount = "1000";
break;
case "1500 for $24.99":
this.QuantitiyValue = "24.99";
this.QuantityCount = "1500";
break;
case "2000 for $29.99":
this.QuantitiyValue = "29.99";
this.QuantityCount = "2000";
break;
case "2500 for $34.99":
this.QuantitiyValue = "34.99";
this.QuantityCount = "2500";
break;
case "5000 for $59.99":
this.QuantitiyValue = "59.99";
this.QuantityCount = "5000";
break;
case "500 for $99.00":
this.QuantitiyValue = "99.00";
this.QuantityCount = "500";
break;
}
if (Paper == "Glossy front - $9.99")
this.PaperValue = "9.99";
switch (DeliverySpeed)
{
case "Slow*: 21 Days":
this.DSpeedText = "Slow*: 21 Days";
this.DSpeedValue = "5.25";
break;
case "Standard*: 14 Days":
this.DSpeedText = "Standard*: 14 Days";
this.DSpeedValue = "8.95";
break;
case "Priority*: 7 Days":
this.DSpeedText = "Priority*: 7 Days";
this.DSpeedValue = "12.95";
break;
case "Rush+: 3 Business Days":
this.DSpeedText = "Rush+: 3 Business Days";
this.DSpeedValue = "24.99";
break;
}
if (oc.PaymentMethod == 1)
this.CustomizeCharge = "7.99";
double QValue = 0;
double PValue = 0;
double SpeedValue = 0;
double CustomValue = 0;
if (this.QuantitiyValue != "")
QValue = Convert.ToDouble(this.QuantitiyValue);
if (this.PaperValue != "")
PValue = Convert.ToDouble(this.PaperValue);
if (this.DSpeedValue != "")
SpeedValue = Convert.ToDouble(this.DSpeedValue);
if (this.CustomizeCharge != "")
CustomValue = Convert.ToDouble(this.CustomizeCharge);
this.SubTotal = Convert.ToString(QValue + PValue + CustomValue);
this.TotalValue = Convert.ToString(QValue + PValue + SpeedValue + CustomValue);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment