protected List <cart_items> get_cart_list() { int group_id = 0; Rain.Model.users userInfo = this.GetUserInfo(); if (userInfo != null) { group_id = userInfo.group_id; } return(ShopCart.GetList(group_id) ?? new List <cart_items>()); }
private static List <cart_keys> GetCart() { List <cart_keys> cartKeysList = new List <cart_keys>(); string cookies = ShopCart.GetCookies(); if (!string.IsNullOrEmpty(cookies)) { return(JsonHelper.JSONToObject <List <cart_keys> >(cookies)); } return((List <cart_keys>)null); }
public static void Clear(int article_id, int goods_id) { if (article_id > 0) { List <cart_keys> cart = ShopCart.GetCart(); if (cart == null) { return; } cart_keys cartKeys = cart.Find((Predicate <cart_keys>)(p => p.article_id == article_id)); if (cartKeys != null) { cart.Remove(cartKeys); ShopCart.AddCookies(JsonHelper.ObjectToJSON((object)cart)); } } }
public static int GetQuantityCount() { string cookies = ShopCart.GetCookies(); int num = 0; if (!string.IsNullOrEmpty(cookies)) { List <cart_keys> cartKeysList = JsonHelper.JSONToObject <List <cart_keys> >(cookies); if (cartKeysList != null) { foreach (cart_keys cartKeys in cartKeysList) { num += cartKeys.quantity; } } } return(num); }
public static cart_keys Update(int article_id, int quantity) { if (quantity < 1) { return((cart_keys)null); } List <cart_keys> cart = ShopCart.GetCart(); if (cart != null) { cart_keys cartKeys = cart.Find((Predicate <cart_keys>)(p => p.article_id == article_id)); if (cartKeys != null) { int index = cart.FindIndex((Predicate <cart_keys>)(p => p.article_id == article_id)); cartKeys.quantity = quantity; cart[index] = cartKeys; ShopCart.AddCookies(JsonHelper.ObjectToJSON((object)cart)); return(cartKeys); } } return((cart_keys)null); }
protected int get_cart_quantity() { return(ShopCart.GetQuantityCount()); }
public static cart_total GetTotal(int group_id) { return(ShopCart.GetTotal(ShopCart.GetList(group_id))); }
public static List <cart_items> GetList(int group_id) { return(ShopCart.ToList(ShopCart.GetCart(), group_id)); }