public virtual bool IsSatisfiedBy(long requestedQuantity)
        {
            var result = new ProductIsBuyableSpecification().IsSatisfiedBy(_product);

            if (result && _product.TrackInventory && _product.Inventory != null)
            {
                result = _product.Inventory.AllowPreorder == true ||
                         _product.Inventory.AllowBackorder == true ||
                         _product.AvailableQuantity >= requestedQuantity;
            }

            return(result);
        }
Exemplo n.º 2
0
        public virtual bool IsSatisfiedBy(long requestedQuantity)
        {
            var result = new ProductIsBuyableSpecification().IsSatisfiedBy(_product);

            if (result && _product.TrackInventory)
            {
                result = _product.Inventory != null &&
                         _product.AvailableQuantity +
                         (Convert.ToInt32(_product.Inventory.AllowPreorder) * Convert.ToInt32(_product.Inventory.PreorderQuantity)) +
                         (Convert.ToInt32(_product.Inventory.AllowBackorder) * Convert.ToInt32(_product.Inventory.BackorderQuantity))
                         >= requestedQuantity;
            }

            return(result);
        }