Example #1
0
        //------------------------------------------------------------------------------------------------------------------------------------------+
        protected void MyList_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
                {
                    TailspinSpyworks.Data_Access.ViewCart myCart = new Data_Access.ViewCart();
                    myCart = (TailspinSpyworks.Data_Access.ViewCart) e.Row.DataItem;
                    _CartTotal += myCart.UnitCost * myCart.Quantity;
                }
            else if (e.Row.RowType == DataControlRowType.Footer)
                {

                    if (_CartTotal > 0)
                    {
                        CheckOutHeader.InnerText = "Review and Submit Your Order";
                        LabelCartHeader.Text = "Please check all the information below to be sure it's correct.";
                        CheckoutBtn.Visible = true;
                        e.Row.Cells[5].Text = "Total: " + _CartTotal.ToString("C");
                    }
                }
        }
 /// <summary>
 /// Deprecated Method for adding a new object to the ViewCarts EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToViewCarts(ViewCart viewCart)
 {
     base.AddObject("ViewCarts", viewCart);
 }
 /// <summary>
 /// Create a new ViewCart object.
 /// </summary>
 /// <param name="productID">Initial value of the ProductID property.</param>
 /// <param name="unitCost">Initial value of the UnitCost property.</param>
 /// <param name="quantity">Initial value of the Quantity property.</param>
 public static ViewCart CreateViewCart(global::System.Int32 productID, global::System.Decimal unitCost, global::System.Int32 quantity)
 {
     ViewCart viewCart = new ViewCart();
     viewCart.ProductID = productID;
     viewCart.UnitCost = unitCost;
     viewCart.Quantity = quantity;
     return viewCart;
 }