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); }
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); }
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); }
public static void SetBasketTotal(CBasketTotal basketTotal) { HttpContext.Current.Session["BasketTotal"] = basketTotal; }