public static void EnQueue(int productId) { System.Collections.Generic.IList <int> list = BrowsedProductQueue.GetBrowedProductList(); int num = 0; foreach (int current in list) { if (productId == current) { list.RemoveAt(num); break; } num++; } if (list.Count <= 20) { list.Add(productId); } else { list.RemoveAt(0); list.Add(productId); } BrowsedProductQueue.SaveCookie(list); }
public static List <ProductYouLikeModel> GetProductYouLike(int productId, int storeId, List <int> likePids = null, bool showServiceProduct = true) { List <ProductYouLikeModel> list = new List <ProductYouLikeModel>(); RelatedProductsDao relatedProductsDao = new RelatedProductsDao(); list = relatedProductsDao.GetRelatedProducts(productId, storeId, showServiceProduct); if (list.Count == 0) { if (likePids != null && likePids.Count > 0) { likePids.Remove(productId); if (likePids.Count > 0) { list = relatedProductsDao.GetMyViewProducts(likePids, storeId, showServiceProduct); } } else { HttpCookie httpCookie = HiContext.Current.Context.Request.Cookies[BrowsedProductQueue.browedProductList]; if (httpCookie != null && !string.IsNullOrEmpty(httpCookie.Value)) { List <int> list2 = Serializer.ConvertToObject(HiContext.Current.Context.Server.UrlDecode(httpCookie.Value), typeof(List <int>)) as List <int>; list2.Remove(productId); if (list2.Count > 0) { list = relatedProductsDao.GetMyViewProducts(list2, storeId, showServiceProduct); } } } } BrowsedProductQueue.ProcessProductImg(list); return(list); }
public static void EnQueue(int productId) { IList <int> list = BrowsedProductQueue.GetBrowedProductList(); int num = 0; foreach (int item in list) { if (productId == item) { list.RemoveAt(num); break; } num++; } if (list.Count <= 20) { list.Add(productId); } else { list.RemoveAt(0); list.Add(productId); } BrowsedProductQueue.SaveCookie(list); }
public static System.Collections.Generic.IList <int> GetBrowedProductList(int maxNum) { System.Collections.Generic.IList <int> list = BrowsedProductQueue.GetBrowedProductList(); int count = list.Count; if (list.Count > maxNum) { for (int i = 0; i < count - maxNum; i++) { list.RemoveAt(0); } } return(list); }
public static void ClearQueue() { BrowsedProductQueue.SaveCookie(null); }