0
        #region Get Cart

        if (Session["MyCart"] != null)
        {
            if (Session["MyCart"].GetType().Name.StartsWith("List"))
            {
                cart = (List<Cart>)Session["MyCart"];
            }
        }


        city.ShippingCharges = Common.ConvertToDecimal(ordersAddress.ShippingCity);

        liCity = (from sc in liCity where sc.ShippingCharges.Equals(city.ShippingCharges)select sc).ToList();

        //liCity = (from sc in liCity where sc.Name.Equals(ordersAddress.ShippingCity) && sc.StateID.Equals(ordersAddress.ShippingStateID) select sc).ToList();

        int TotalItem = 0;
        foreach (Cart c in cart)
        {
            TotalItem = TotalItem + c.Quantity;
            c.ShippingCharges = (Single)(c.Quantity * (decimal)liCity[0].ShippingCharges);
            c.NetAmount = ((c.Amount - c.PromotionAmount) + c.TaxAmount1 + c.TaxAmount2 + (Single)(liCity[0].ShippingCharges) + c.HandlingCharges);
        }


        #endregion Get Cart

Edited by Dani: Formatting fixed

3
Contributors
2
Replies
3
Views
5 Years
Discussion Span
Last Post by mani-hellboy
0

Please first debug and add watch to see the result of each statement. Get the exception and if it still not understandable for you, give it to us with line number where the error is.

0

hye man which line you this error

1. if in this

if (Session["MyCart"] != null)
          {
             if (Session["MyCart"].GetType().Name.StartsWith("List"))
            {
               cart = (List<Cart>)Session["MyCart"];
            }
          }

means first you want to assign session value or use try catch

2.if in another part means fully check all objects having references created using "new" keyword

Edited by mani-hellboy: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.