コード例 #1
0
    private bool IsEnoughStock(out string errMsg)
    {
        errMsg = String.Empty;
        ICartItem cartItem = StoreContext.ShoppingCart.FindCartItemByID(CartItemID);
        int       quantity = ConvertUtilities.ToInt32(uxQuantityText.Text);
        OptionItemValueCollection options = uxProductOptionGroupDetails.GetSelectedOptions();
        int productStock = cartItem.Product.GetStock(options.GetUseStockOptionItemIDs());
        int currentStock = productStock - quantity;

        if (currentStock != DataAccessContext.Configurations.GetIntValue("OutOfStockValue"))
        {
            if (CatalogUtilities.IsOutOfStock(currentStock, CheckUseInventory(cartItem.Product)))
            {
                errMsg += cartItem.Product.Name;
                if (DataAccessContext.Configurations.GetBoolValue("ShowQuantity"))
                {
                    int displayStock = productStock - DataAccessContext.Configurations.GetIntValue("OutOfStockValue");
                    if (displayStock < 0)
                    {
                        displayStock = 0;
                    }
                    errMsg += " ( available " + displayStock + " items )";
                }
            }
        }
        if (!String.IsNullOrEmpty(errMsg))
        {
            errMsg = "Stock Error : " + errMsg;
            return(false);
        }
        else
        {
            return(true);
        }
    }
コード例 #2
0
    private void CheckCannotBuyItem()
    {
        int rowIndex;

        for (rowIndex = 0; rowIndex < uxGrid.Rows.Count; rowIndex++)
        {
            GridViewRow row = uxGrid.Rows[rowIndex];
            if (row.RowType == DataControlRowType.DataRow)
            {
                string  productID    = uxGrid.DataKeys[rowIndex]["ProductID"].ToString();
                string  optionIDText = ((HiddenField)row.FindControl("uxOptionHidden")).Value.ToString();
                decimal stock        = GetStock(productID, optionIDText);

                int     wantQuantity = ConvertUtilities.ToInt32(((Label)row.FindControl("uxWantQuantityLabel")).Text.Trim());
                int     hasQuantity  = ConvertUtilities.ToInt32(((Label)row.FindControl("uxHasQuantityLabel")).Text.Trim());
                Product product      = DataAccessContext.ProductRepository.GetOne(StoreContext.Culture, productID, new StoreRetriever().GetCurrentStoreID());

                if (wantQuantity <= hasQuantity)
                {
                    ((Label)row.FindControl("uxCannotBuyLabel")).Text    = "Completed";
                    ((TextBox)row.FindControl("uxQuantityText")).Visible = false;
                }
                else if (CatalogUtilities.IsOutOfStock(stock, product.UseInventory))
                {
                    ((Label)row.FindControl("uxCannotBuyLabel")).Text    = "Out of stock";
                    ((TextBox)row.FindControl("uxQuantityText")).Visible = false;
                }
                else
                {
                    ((Label)row.FindControl("uxCannotBuyLabel")).Text    = "";
                    ((TextBox)row.FindControl("uxQuantityText")).Visible = true;
                }
            }
        }
    }
コード例 #3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        PopulatePaymentButtons();

        if (CatalogUtilities.IsCatalogMode())
        {
            //************ do something *****************
        }
    }
コード例 #4
0
ファイル: ExportUtility.cs プロジェクト: holmes2136/ShopCart
 public bool IncludeOutOfStock(bool includeOutOfStock, object stock, object useInventory)
 {
     if (includeOutOfStock || (!CatalogUtilities.IsOutOfStock(stock, useInventory)))
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
コード例 #5
0
ファイル: ExportUtility.cs プロジェクト: holmes2136/ShopCart
        public bool GetStockAvailable(object stock, object productID, string storeID)
        {
            Product product = DataAccessContext.ProductRepository.GetOne(StoreContext.Culture, Convert.ToString(productID), storeID);

            if (CatalogUtilities.IsOutOfStock(stock, product.UseInventory))
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #6
0
    protected bool IsBuyButtonVisible(object productID)
    {
        Product product = DataAccessContext.ProductRepository.GetOne(
            StoreContext.Culture, (string)productID, new StoreRetriever().GetCurrentStoreID());

        if (!CatalogUtilities.IsCatalogMode() &&
            !Vevo.CatalogUtilities.IsOutOfStock(product.SumStock, product.UseInventory) &&
            IsAuthorizedToViewPrice(product.IsCallForPrice))
        {
            return(true);
        }

        return(false);
    }
コード例 #7
0
    protected bool VisibleQuantity(int sumStock, bool useInventory)
    {
        if (!IsAuthorizedToViewPrice())
        {
            return(false);
        }

        if (!CatalogUtilities.IsCatalogMode() && CatalogUtilities.IsOutOfStock(sumStock, useInventory))
        {
            return(false);
        }
        else
        {
            return(true);
        }
    }
コード例 #8
0
        public void Seed(CldpDbContext context)
        {
            var companyUtilities   = new CompanyUtilities(context);
            var emailUtilities     = new EmailTemplatesUtilities(context);
            var catalogUtilities   = new CatalogUtilities(context);
            var office365Utilities = new Office365Utilities(context);

            companyUtilities.SeedCompanies();
            emailUtilities.SeedEmailTemplates();

            catalogUtilities.SeedCategoriesProductsAndProductItems();
            catalogUtilities.SeedCatalogs();

            office365Utilities.SeedOffice365Roles();
            office365Utilities.SeedOffice365Offers();
        }
コード例 #9
0
    private bool IsEnoughStock(out string message)
    {
        message = String.Empty;

        foreach (ICartItem item in StoreContext.ShoppingCart.GetCartItems())
        {
            int productStock = item.Product.GetStock(item.Options.GetUseStockOptionItemIDs());
            int currentStock = productStock - item.Quantity;

            if (currentStock != DataAccessContext.Configurations.GetIntValue("OutOfStockValue"))
            {
                if (CatalogUtilities.IsOutOfStock(currentStock, CheckUseInventory(item.ProductID)))
                {
                    message += "<li>" + item.GetName(StoreContext.Culture, CurrenntCurrency);
                    if (DataAccessContext.Configurations.GetBoolValue("ShowQuantity"))
                    {
                        int displayStock = productStock - DataAccessContext.Configurations.GetIntValue("OutOfStockValue");
                        if (displayStock < 0)
                        {
                            displayStock = 0;
                        }

                        message += " ( available " + displayStock + " items )";
                    }
                    else
                    {
                        message += "</li>";
                    }
                }
            }
        }

        if (!String.IsNullOrEmpty(message))
        {
            message =
                "<p class=\"ErrorHeader\">Stock Error</p>" +
                "<ul class=\"ErrorBody\">" + message + "</ul>";

            return(false);
        }
        else
        {
            return(true);
        }
    }
コード例 #10
0
    private void SetupGiftDetail()
    {
        Product product = DataAccessContext.ProductRepository.GetOne(StoreContext.Culture, ProductID, new StoreRetriever().GetCurrentStoreID());

        if (!product.IsGiftCertificate ||
            IsElectronicOnlyGiftCertificate(product) ||
            CatalogUtilities.IsCatalogMode())
        {
            uxNeedPhysicalGCP.Visible = false;
            uxRecipientTR.Visible     = false;
            uxPersonalNoteTR.Visible  = false;
        }
        else
        {
            uxGiftCertificateComponentsPanel.Visible = true;
            uxNeedPhysicalGCP.Visible = true;
            if (uxNeedPhysicalGCCheck.Checked)
            {
                uxRecipientTR.Visible    = true;
                uxPersonalNoteTR.Visible = true;
            }
            else
            {
                uxRecipientTR.Visible    = false;
                uxPersonalNoteTR.Visible = false;
            }
        }

        if (product.IsFixedPrice)
        {
            uxGiftAmountTR.Visible = false;
            if (!uxNeedPhysicalGCP.Visible && !uxRecipientTR.Visible && !uxPersonalNoteTR.Visible && !uxGiftAmountTR.Visible)
            {
                uxGiftCertificateComponentsPanel.Visible = false;
            }
        }
        else
        {
            uxGiftAmountTR.Visible = true;
            uxGiftCertificateComponentsPanel.Visible = true;
        }
    }
コード例 #11
0
    protected string CheckValidStock(object useInventory, object stock)
    {
        string stockValue = GetLanguageText("InStock");
        bool   isOutStock = CatalogUtilities.IsOutOfStock(Convert.ToInt32(stock), (bool)useInventory);

        if (ShowRemainingQuantity(useInventory))
        {
            if ((bool)useInventory)
            {
                stockValue = stockValue + "(" + RemainingStock(stock) + ")";
            }
        }
        else
        {
            stockValue = "-";
        }
        if (isOutStock)
        {
            stockValue = GetLanguageText("OutStock");
        }

        return(stockValue);
    }
コード例 #12
0
    protected string CheckValidStock()
    {
        int numberItemInSession = StoreContext.ShoppingCart.GetNumberOfItems(ProductID) +
                                  PromotionSelectedItem.FindSubProductAmountInPromotion(StoreContext.ShoppingCart, ProductID);
        int currentStock = 0;

        currentStock = CurrentProduct.GetStockForQuickReview() - numberItemInSession;

        bool isOutStock = CatalogUtilities.IsOutOfStock(Convert.ToInt32(currentStock), CurrentProduct.UseInventory);

        if (CurrentProduct.isProductOptionStock())
        {
            return("");
        }

        if (isOutStock)
        {
            return(GetLanguageText("OutStock"));
        }
        else
        {
            return(GetLanguageText("InStock") + " (" + RemainingStock(currentStock) + ")");
        }
    }
コード例 #13
0
 protected bool QuantityDiscountVisible(object productDiscountGroupID, object categoryIDList)
 {
     return(CatalogUtilities.GetQuantityDiscountByProductID(productDiscountGroupID, categoryIDList));
 }
コード例 #14
0
 public bool IsShowRecurringPeriod()
 {
     return(ConvertUtilities.ToBoolean(CurrentProduct.IsRecurring) &&
            !CatalogUtilities.IsOutOfStock(CurrentProduct.SumStock, CurrentProduct.UseInventory));
 }
コード例 #15
0
    private bool IsEnoughStock(out string message)
    {
        message = String.Empty;

        foreach (ICartItem item in StoreContext.ShoppingCart.GetCartItems())
        {
            if (!item.IsPromotion)
            {
                int productStock = item.Product.GetStock(item.Options.GetUseStockOptionItemIDs());
                int currentStock = productStock - item.Quantity;

                if (currentStock != DataAccessContext.Configurations.GetIntValue("OutOfStockValue"))
                {
                    if (CatalogUtilities.IsOutOfStock(currentStock, CheckUseInventory(item.ProductID)))
                    {
                        message += "<li>" + item.GetName(StoreContext.Culture, StoreContext.Currency);
                        if (DataAccessContext.Configurations.GetBoolValue("ShowQuantity"))
                        {
                            int displayStock = productStock - DataAccessContext.Configurations.GetIntValue("OutOfStockValue");
                            if (displayStock < 0)
                            {
                                displayStock = 0;
                            }

                            message += " ( available " + displayStock + " items )";
                        }
                        else
                        {
                            message += "</li>";
                        }
                    }
                }
            }
            else
            {
                CartItemPromotion cartItemPromotion = (CartItemPromotion)item;
                PromotionSelected promotionSelected = cartItemPromotion.PromotionSelected;
                foreach (PromotionSelectedItem selectedItem in promotionSelected.PromotionSelectedItems)
                {
                    Product  product         = selectedItem.Product;
                    string[] optionsUseStock = selectedItem.GetUseStockOptionItems().ToArray(typeof(string)) as string[];
                    int      productStock    = product.GetStock(optionsUseStock);
                    int      currentStock    = productStock - item.Quantity;
                    if (currentStock != DataAccessContext.Configurations.GetIntValue("OutOfStockValue"))
                    {
                        if (CatalogUtilities.IsOutOfStock(currentStock, CheckUseInventory(product.ProductID)))
                        {
                            message += "<li>" + item.GetName(StoreContext.Culture, StoreContext.Currency);
                            message += "</li>";
                        }
                    }
                }
            }
        }

        if (!String.IsNullOrEmpty(message))
        {
            message =
                "<p class=\"ErrorHeader\">[$StockError]</p>" +
                "<ul class=\"ErrorBody\">" + message + "</ul>";

            return(false);
        }
        else
        {
            return(true);
        }
    }
コード例 #16
0
    private bool IsEnoughStock(out string message)
    {
        message = String.Empty;

        int rowIndex;

        for (rowIndex = 0; rowIndex < uxGrid.Rows.Count; rowIndex++)
        {
            GridViewRow row = uxGrid.Rows[rowIndex];
            if (row.RowType == DataControlRowType.DataRow)
            {
                ICartItem cartItem    = (ICartItem)StoreContext.ShoppingCart.FindCartItemByID((string)uxGrid.DataKeys[rowIndex]["CartItemID"]);
                bool      isPromotion = (bool)uxGrid.DataKeys[rowIndex]["IsPromotion"];
                string    productID   = uxGrid.DataKeys[rowIndex]["ProductID"].ToString();
                string    productName = ((Label)row.FindControl("uxNameLabel")).Text;
                int       quantity    = ConvertUtilities.ToInt32(((TextBox)row.FindControl("uxQuantityText")).Text);
                if (!isPromotion)
                {
                    Product product = DataAccessContext.ProductRepository.GetOne(StoreContext.Culture, productID, new StoreRetriever().GetCurrentStoreID());

                    OptionItemValueCollection options = (OptionItemValueCollection)uxGrid.DataKeys[rowIndex]["Options"];
                    int productStock = product.GetStock(options.GetUseStockOptionItemIDs());
                    int currentStock = productStock - quantity;
                    if (currentStock != DataAccessContext.Configurations.GetIntValue("OutOfStockValue"))
                    {
                        if (CatalogUtilities.IsOutOfStock(currentStock, CheckUseInventory(productID)))
                        {
                            message += "<li>" + productName;
                            if (DataAccessContext.Configurations.GetBoolValue("ShowQuantity"))
                            {
                                int displayStock = productStock - DataAccessContext.Configurations.GetIntValue("OutOfStockValue");
                                if (displayStock < 0)
                                {
                                    displayStock = 0;
                                }
                                message += " ( available " + displayStock + " items )";
                            }
                            else
                            {
                                message += "</li>";
                            }
                        }
                    }
                }
                else
                {
                    CartItemPromotion cartItemPromotion = (CartItemPromotion)cartItem;
                    PromotionSelected promotionSelected = cartItemPromotion.PromotionSelected;
                    foreach (PromotionSelectedItem item in promotionSelected.PromotionSelectedItems)
                    {
                        Product  product         = item.Product;
                        string[] optionsUseStock = item.GetUseStockOptionItems().ToArray(typeof(string)) as string[];
                        int      productStock    = product.GetStock(optionsUseStock);
                        int      currentStock    = productStock - quantity;
                        if (currentStock != DataAccessContext.Configurations.GetIntValue("OutOfStockValue"))
                        {
                            if (CatalogUtilities.IsOutOfStock(currentStock, CheckUseInventory(product.ProductID)))
                            {
                                message += "<li>" + productName;
                                message += "</li>";
                            }
                        }
                    }
                }
            }
        }

        if (!String.IsNullOrEmpty(message))
        {
            message =
                "<p class=\"ErrorHeader\">[$StockError]</p>" +
                "<ul class=\"ErrorBody\">" + message + "</ul>";

            return(false);
        }
        else
        {
            return(true);
        }
    }
コード例 #17
0
    private void PopulateControls()
    {
        GiftRegistry giftRegistry = DataAccessContextDeluxe.GiftRegistryRepository.GetOne(GiftRegistryID);

        uxEventNameLable.Text = giftRegistry.EventName;
        uxEventDateLabel.Text = giftRegistry.EventDate.ToShortDateString();

        if ((DataAccessContext.Configurations.GetBoolValue("PriceRequireLogin") && !Page.User.Identity.IsAuthenticated) || (CatalogUtilities.IsCatalogMode()))
        {
            uxGrid.Visible = false;
            uxAddToCartImageButton.Visible = false;
        }

        uxGrid.DataSource = DataAccessContextDeluxe.GiftRegistryItemRepository.GetAllByGiftRegistryID(GiftRegistryID);
        uxGrid.DataBind();

        CheckCannotBuyItem();
    }