Ejemplo n.º 1
0
    private void DeleteItem(string productID)
    {
        StoreContext.ProductIDsCompareList.Remove(productID);

        if (UserUtilities.GetCurrentCustomerID() != "0")
        {
            Customer  currentUser = DataAccessContext.CustomerRepository.GetOne(UserUtilities.GetCurrentCustomerID());
            ArrayList compareList = currentUser.GetProductIDsCompare();
            compareList.Remove(productID);
            currentUser.SetProductIDsCompare(compareList);
            DataAccessContext.CustomerRepository.Save(currentUser);
        }
    }
    private IList <Product> GetProductList()
    {
        ArrayList list = StoreContext.ProductIDsCompareList;

        if (UserUtilities.GetCurrentCustomerID() != "0")
        {
            Customer currentUser = DataAccessContext.CustomerRepository.GetOne(UserUtilities.GetCurrentCustomerID());
            list = currentUser.GetProductIDsCompare();
            if (StoreContext.ProductIDsCompareList.Count > 0)
            {
                ArrayList sessionList = StoreContext.ProductIDsCompareList;
                foreach (string id in sessionList)
                {
                    if (!list.Contains(id))
                    {
                        list.Add(id);
                    }
                }
            }


            currentUser.SetProductIDsCompare(list);
            DataAccessContext.CustomerRepository.Save(currentUser);
        }

        int             itemShow    = DataAccessContext.Configurations.GetIntValue("CompareProductShow");
        IList <Product> displayList = new List <Product>();

        displayList.Add(Product.Null);
        int itemCount = 0;

        foreach (string id in list)
        {
            Product product = DataAccessContext.ProductRepository.GetOne(
                StoreContext.Culture, id, new StoreRetriever().GetStore().StoreID);

            if (!product.IsNull && IsExitsInCurrentStore(product) && itemCount < itemShow)
            {
                displayList.Add(product);
                itemCount++;
            }
            else
            {
                return(displayList);
            }
        }


        return(displayList);
    }
Ejemplo n.º 3
0
    protected void uxDeleteAllButton_Click(object sender, EventArgs e)
    {
        StoreContext.ProductIDsCompareList.Clear();

        if (UserUtilities.GetCurrentCustomerID() != "0")
        {
            Customer  currentUser = DataAccessContext.CustomerRepository.GetOne(UserUtilities.GetCurrentCustomerID());
            ArrayList compareList = currentUser.GetProductIDsCompare();
            compareList.Clear();
            currentUser.SetProductIDsCompare(compareList);
            DataAccessContext.CustomerRepository.Save(currentUser);
        }

        PopulateControls();
    }
Ejemplo n.º 4
0
    protected void uxCompareListGrid_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        StoreContext.ProductIDsCompareList.Remove(uxCompareListGrid.DataKeys[e.RowIndex]["ProductID"].ToString());

        if (UserUtilities.GetCurrentCustomerID() != "0")
        {
            Customer  currentUser = DataAccessContext.CustomerRepository.GetOne(UserUtilities.GetCurrentCustomerID());
            ArrayList compareList = currentUser.GetProductIDsCompare();
            compareList.Remove(uxCompareListGrid.DataKeys[e.RowIndex]["ProductID"].ToString());
            currentUser.SetProductIDsCompare(compareList);
            DataAccessContext.CustomerRepository.Save(currentUser);
        }

        RefreshGrid();

        uxStatusHidden.Value = "Deleted";
    }
    private void AddToCompareList(string productID)
    {
        if (DataAccessContext.Configurations.GetIntValue("CompareProductShow") <= StoreContext.ProductIDsCompareList.Count)
        {
            Response.Redirect("~/ComparisonList.aspx?ErrorID=1");
        }

        if (!StoreContext.ProductIDsCompareList.Contains(productID))
        {
            StoreContext.ProductIDsCompareList.Add(productID);

            if (UserUtilities.GetCurrentCustomerID() != "0")
            {
                StoreContext.Customer.SetProductIDsCompare(StoreContext.ProductIDsCompareList);
                DataAccessContext.CustomerRepository.Save(StoreContext.Customer);
            }
        }
    }