예제 #1
0
        public Tuple<bool, decimal, string> getProductPrice(topCart cartItem, int langId, string langCode, string mainPath, bool isDeletedInclude)
        {
            // get Basket Content => Price , Discount
            helperBasket helperBasket = new helperBasket();
            basketShared bs = new basketShared(db);
            var basketContent = bs.getBasketHelperWithProductAndDiscount(cartItem, langId, langCode, mainPath, isDeletedInclude);
            if (basketContent.Item2 == basketActionResult.redirect)
            {
                return new Tuple<bool, decimal, string>(false, 0, "basket");
            }

            helperBasket = basketContent.Item1;
            var basketTotal = helperBasket.totalPriceDec;

            return new Tuple<bool, decimal, string>(true, basketTotal, null);
        }
예제 #2
0
        public Tuple<helperBasket, basketActionResult> getBasketHelperWithProductAndDiscount(topCart cartItem, int langId, string langCode, string mainPath, bool isDeletedInclude)
        {
            discountShared ds = new discountShared(db);
            helperBasket helperPage = new helperBasket();

            var basketContentItem = getBasketContent(cartItem, langId, langCode, mainPath, isDeletedInclude);

            helperPage.basketList = basketContentItem.Item1;
            helperPage.actionMsg = basketContentItem.Item2;

            if (!helperPage.isBasketValid)
            {
                return new Tuple<helperBasket, basketActionResult>(null, basketActionResult.redirect);
            }

            // Discount Calculate
            var discountObject = ds.getDiscountSummary(basketContentItem.Item1, cartItem.userId);
            if (discountObject.Item2)
            {
                helperPage.discountList = discountObject.Item1;
                helperPage.isDiscountValid = discountObject.Item2;
            }

            if (!helperPage.isDiscountValid)
            {
                return new Tuple<helperBasket, basketActionResult>(null, basketActionResult.redirect);
            }

            helperPage.calculateSum();

            return new Tuple<helperBasket, basketActionResult>(helperPage, basketActionResult.success);
        }