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);
         }
     }
 }
Ejemplo n.º 2
0
        public ArrayImpl ToArray()
        {
            ArrayImpl inArray = new ArrayImpl();

            IValue[] val = _queue.ToArray();
            foreach (var itm in val)
            {
                inArray.Add(itm);
            }
            return(inArray);
        }
Ejemplo n.º 3
0
        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);
        }
Ejemplo n.º 4
0
 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);
         }
     }
 }