using System; using System.Data; using System.Configuration; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; public class Order { private DateTime _orderDate; private Customer _cust; private ShoppingCart _cart; public Order() { _cust = new Customer(); _cart = new ShoppingCart(); } public Order(DateTime orderDate, Customer Cust, ShoppingCart Cart) { this.OrderDate = orderDate; this.Cust = Cust; this.Cart = Cart; } public DateTime OrderDate { get { return _orderDate; } set { _orderDate = value; } } public Customer Cust { get { return _cust; } set { _cust = value; } } public ShoppingCart Cart { get { return _cart; } set { _cart = value; } } public decimal Subtotal { get { decimal subTotal = 0; foreach (CartItem item in _cart.GetItems()) { subTotal += item.Total; } } } public decimal SalesTax { get { if (this.Cust.State.Equals("CA")) { return this.Subtotal * 0.0775m; } else { return 0.0m; } } } public decimal Shipping { get { int count = 0; foreach (CartItem item in _cart.GetItems()) { count += item.Quantity; return count * 2.00m; } } } public decimal Total { get { return this.Subtotal + this.Shipping + this.SalesTax; } } }