コード例 #1
0
        /// <summary>
        /// Adds the product.
        /// </summary>
        /// <param name="astrProductCode">The product code.</param>
        public virtual void AddProduct(string astrProductCode)
        {
            if (this.iboProductList != null)
            {
                //Get Product List Detail by the Product Code
                doProductList ldoProductList = this.iboProductList.iclcProductList.Where(x => string.Equals(x.code, astrProductCode)).FirstOrDefault();

                if (ldoProductList != null)
                {
                    //Create Product Object which will add to cart
                    boProduct lboProduct = new boProduct();

                    lboProduct.istrProductCode = ldoProductList.code;
                    lboProduct.istrProductName = ldoProductList.name;
                    lboProduct.istrProductType = ldoProductList.category_type;
                    lboProduct.idecBasePrice   = ldoProductList.base_price;
                    //Check if product is taxable from Product Type list
                    if (this.iboProductType.iclcProductType != null)
                    {
                        lboProduct.iblnIsTaxable = this.iboProductType.iclcProductType.Where(x => string.Equals(x.product_type, ldoProductList.category_type)).FirstOrDefault().is_taxable;
                    }
                    else
                    {
                        //If detail not available then we will set default to true
                        lboProduct.iblnIsTaxable = true;
                    }

                    lboProduct.iblnIsImported = ldoProductList.is_imported;

                    CalculateTaxAndAddToProductCart(lboProduct);
                }
            }
        }
コード例 #2
0
        /// <summary>
        /// Calculates the tax and add to product cart.
        /// </summary>
        /// <param name="aboProduct">The abo product.</param>
        public void CalculateTaxAndAddToProductCart(boProduct aboProduct)
        {
            aboProduct.idecProductTax = 0m;

            decimal ldecTax = TaxHelper.CalculateTax(aboProduct, idecCurrentTaxRate, idecImportedRate);

            aboProduct.idecProductTax += ldecTax;

            //Add All Product Taxes
            idecTotalTaxAmt += aboProduct.idecProductTax;

            //Add total amount and taxes
            idecTotalAmt += (aboProduct.idecBasePrice + ldecTax);

            //Add Product to Cart
            iclcCartProduct.Add(aboProduct);
        }