Ejemplo n.º 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);
                }
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Adds the product list.
        /// </summary>
        /// <param name="aintProductId">The product identifier.</param>
        /// <param name="astrProductCode">The product code.</param>
        /// <param name="astrName">Name of the product</param>
        /// <param name="astrCategoryType">Type of the category.</param>
        /// <param name="adecBasePrice">The base price.</param>
        /// <param name="ablnImproted">if set to <c>true</c> [improted].</param>
        /// <returns></returns>
        private doProductList AddProductList(int aintProductId, string astrProductCode,
                                             string astrName, string astrCategoryType, decimal adecBasePrice,
                                             bool ablnImproted = false)
        {
            doProductList ldoProductList = new doProductList();

            ldoProductList.product_id    = aintProductId;
            ldoProductList.code          = astrProductCode;
            ldoProductList.name          = astrName;
            ldoProductList.category_type = astrCategoryType;
            ldoProductList.base_price    = adecBasePrice;
            ldoProductList.is_imported   = ablnImproted;

            return(ldoProductList);
        }
        /// <summary>
        /// Gets the product list.
        /// </summary>
        /// <returns></returns>
        public void LoadDetailsFromFile()
        {
            //Get the Product list from the file
            List <string[]> llstProductList = ProductInventoryHelper.LoadFileData(ProductInventoryHelper.PRODUCT_LIST_FILE_NAME);

            if (llstProductList != null)
            {
                foreach (string[] larrProduct in llstProductList)
                {
                    //Create and fill Data object of Product List
                    doProductList ldoProductList = new doProductList();
                    ldoProductList.code          = larrProduct[1];
                    ldoProductList.name          = larrProduct[2];
                    ldoProductList.category_type = larrProduct[3];
                    ldoProductList.base_price    = Convert.ToDecimal(larrProduct[4]);
                    ldoProductList.is_imported   = Convert.ToBoolean(larrProduct[5]);

                    //Add to Product List collection in order to get all the Product list in collection
                    iclcProductList.Add(ldoProductList);
                }
            }
        }