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); }
public Tuple<bool, orderSummary, RedirectResult> getOrderSummary(checkoutProcess checkoutItem, checkoutShared cs, basketShared bs) { orderSummary helperItem = new orderSummary(); #region Basket var basketContentItem = bs.getBasketHelperWithProductAndDiscount(checkoutItem.cartItem, langId, langCode, mainPath, false); if (basketContentItem.Item2 == basketActionResult.redirect) { return new Tuple<bool, orderSummary, RedirectResult>(false, null, returnBasketMainPage(null)); } helperItem.basketItem = basketContentItem.Item1; // Product Price var productPrice = helperItem.basketItem.totalPriceDec; #endregion #region Cargo // Cargo Price decimal cargoPrice = 0; var cargoList = cs.getCargoItemList(helperItem.basketItem.totalPriceDec, langId, "en-US"); var cargoItem = cargoList.Where(a => a.cargoId == checkoutItem.cargoId).FirstOrDefault(); if (cargoItem != null) { if (cargoItem.isCargoOnCustomer) { helperItem.cargoPriceStr = lang.checkoutCargoOnCustomer; helperItem.isCargoOnCustomer = true; } else { helperItem.cargoPriceStr = cargoItem.price.ToString("F2", helperItem.basketItem.priceStringFormat); cargoPrice = cargoItem.price; } } else { return new Tuple<bool, orderSummary, RedirectResult>(false, null, redirectToStep(checkoutStep.cargo, checkoutItem)); } #endregion #region Basket & Payment Option decimal allPriceTotal = 0; decimal additionalPrice = 0; helperItem.paymentOptionChoose = checkoutItem.paymentOptionChoose; // getPayment Type switch (checkoutItem.paymentOptionChoose) { case paymentOption.noAnswer: redirectToStep(checkoutStep.payment, checkoutItem); break; case paymentOption.transfer: helperItem.paymentOptionChooseStr = lang.checkoutTransfer; allPriceTotal = cargoPrice + productPrice; checkoutItem.transferInfo.transferDiscount = cs.getTransferInfo(langId); if (checkoutItem.transferInfo.transferDiscount.isDiscountExist) { helperItem.isTransferDiscountExist = true; helperItem.transferDiscount = checkoutItem.transferInfo.transferDiscount.calcDiscountAmount(allPriceTotal); helperItem.transferDiscountStr = helperItem.transferDiscount.ToString("F2", helperItem.basketItem.priceStringFormat) + " TL"; allPriceTotal = allPriceTotal - helperItem.transferDiscount; } break; case paymentOption.creditCard: helperItem.paymentOptionChooseStr = lang.checkoutCrediCard; var productAndCargoPrice = cargoPrice + productPrice; // Has Taksit if (checkoutItem.cardInfo.cardOption.creditOptionId != 0) { var optionItem = cs.getCardOptionList(langId, productAndCargoPrice, checkoutItem.cardInfo.creditCard, HelperSite.Pos.posType.standart, helperItem.basketItem.priceStringFormat, "TL").Where(a => a.bankPosOptionId == checkoutItem.cardInfo.cardOption.creditOptionId).FirstOrDefault(); if (optionItem != null) { allPriceTotal = optionItem.totalPrice; additionalPrice = allPriceTotal - (cargoPrice + productPrice); helperItem.paymentOptionChooseStr = helperItem.paymentOptionChooseStr + "(" + optionItem.monthStr + lang.checkoutInstallment + ")"; } else { return new Tuple<bool, orderSummary, RedirectResult>(false, null, redirectToStep(checkoutStep.payment, checkoutItem)); } } else // No Taksit { if (checkoutItem.cardInfo.cardOption.creditOptionId == -1) // Not Choose Return { return new Tuple<bool, orderSummary, RedirectResult>(false, null, redirectToStep(checkoutStep.payment, checkoutItem)); } else { helperItem.paymentOptionChooseStr = helperItem.paymentOptionChooseStr + "(" + lang.checkoutCash + ")"; allPriceTotal = cargoPrice + productPrice; } } break; default: return new Tuple<bool, orderSummary, RedirectResult>(false, null, redirectToStep(checkoutStep.payment, checkoutItem)); } helperItem.productPrice = productPrice; helperItem.productPriceStr = productPrice.ToString("F2", helperItem.basketItem.priceStringFormat) + " TL"; helperItem.cargoPrice = cargoPrice; helperItem.additionalPrice = additionalPrice; helperItem.allTotalPrice = allPriceTotal; helperItem.allTotalPriceStr = allPriceTotal.ToString("F2", helperItem.basketItem.priceStringFormat) + " TL"; helperItem.additionalPriceStr = additionalPrice.ToString("F2", helperItem.basketItem.priceStringFormat) + " TL"; return new Tuple<bool, orderSummary, RedirectResult>(true, helperItem, null); #endregion }