public static void RecordProductViews(string bvin, MerchantTribeApplication app) { if (WebAppSettings.LastProductsViewedCookieName != string.Empty) { string SavedProductIDs = SessionManager.GetCookieString(WebAppSettings.LastProductsViewedCookieName, app.CurrentStore); if (SavedProductIDs != string.Empty) { string[] AllIDs = SavedProductIDs.Split(','); System.Collections.Generic.Queue<string> q = new System.Collections.Generic.Queue<string>(); q.Enqueue(bvin); foreach (string id in AllIDs) { if (q.Count < 10) { if (!q.Contains(id)) { q.Enqueue(id); } } } SessionManager.SetCookieString(WebAppSettings.LastProductsViewedCookieName, string.Join(",", q.ToArray()), app.CurrentStore); } else { SessionManager.SetCookieString(WebAppSettings.LastProductsViewedCookieName, bvin, app.CurrentStore); } } }
public ArrayImpl ToArray() { ArrayImpl inArray = new ArrayImpl(); IValue[] val = _queue.ToArray(); foreach (var itm in val) { inArray.Add(itm); } return(inArray); }
public T[] DequeueAll() { bool gotLock = false; T[] all; try { _Lock.Enter(ref gotLock); all = _Set.ToArray(); _Set.Clear(); } finally { if (gotLock) { _Lock.Exit(); } } return(all); }
public static void RecordProductViews(string bvin, MerchantTribeApplication app) { if (WebAppSettings.LastProductsViewedCookieName != string.Empty) { string SavedProductIDs = SessionManager.GetCookieString(WebAppSettings.LastProductsViewedCookieName, app.CurrentStore); if (SavedProductIDs != string.Empty) { string[] AllIDs = SavedProductIDs.Split(','); System.Collections.Generic.Queue <string> q = new System.Collections.Generic.Queue <string>(); q.Enqueue(bvin); foreach (string id in AllIDs) { if (q.Count < 10) { if (!q.Contains(id)) { q.Enqueue(id); } } } SessionManager.SetCookieString(WebAppSettings.LastProductsViewedCookieName, string.Join(",", q.ToArray()), app.CurrentStore); } else { SessionManager.SetCookieString(WebAppSettings.LastProductsViewedCookieName, bvin, app.CurrentStore); } } }