Example #1
0
    public static void SetDeliveryAddressId(long deliveryAddressId)
    {
        CBasketTotal basketTotal = GetBasketTotal();

        basketTotal.DeliveryAddressId = deliveryAddressId;
        if (deliveryAddressId > 0)
        {
            basketTotal.DeliveryCost = UltimaWebService.GetDeliveryCost(deliveryAddressId);
        }
        else
        {
            basketTotal.DeliveryCost = 0M;
        }

        basketTotal.GrandTotal = basketTotal.DeliveryCost + basketTotal.Total;
        SetBasketTotal(basketTotal);
    }
Example #2
0
    public static CBasketTotal GetBasketTotal()
    {
        CBasketTotal basketTotal = (CBasketTotal)HttpContext.Current.Session["BasketTotal"];

        if (basketTotal == null)
        {
            basketTotal                   = new CBasketTotal();
            basketTotal.Total             = 0M;
            basketTotal.GrandTotal        = 0M;
            basketTotal.ItemCount         = 0M;
            basketTotal.DeliveryAddressId = -1;
            basketTotal.DeliveryCost      = 0M;

            SetBasketTotal(basketTotal);
        }

        return(basketTotal);
    }
Example #3
0
    public static void RecalcBasket()
    {
        Dictionary <int, decimal> basket = GetBasket();
        CBasketTotal basketTotal         = GetBasketTotal();

        basketTotal.Total      = 0M;
        basketTotal.GrandTotal = 0M;
        basketTotal.ItemCount  = 0M;

        foreach (int key in basket.Keys)
        {
            if (key > 0)
            {
                decimal amount = basket[-key] * basket[key];
                basketTotal.Total     += amount;
                basketTotal.ItemCount += basket[key];
            }
        }

        basketTotal.GrandTotal = basketTotal.Total + basketTotal.DeliveryCost;

        SetBasketTotal(basketTotal);
    }
Example #4
0
 public static void SetBasketTotal(CBasketTotal basketTotal)
 {
     HttpContext.Current.Session["BasketTotal"] = basketTotal;
 }