private cardOptionItem getDefaultOption(decimal cargoAndProductPrice, CultureInfo priceStrFormat, string currency) { cardOptionItem defaultOption = new cardOptionItem(); defaultOption.bankPosOptionId = 0; defaultOption.monthStr = lang.checkoutCash; defaultOption.monthPrice = cargoAndProductPrice; defaultOption.totalPrice = cargoAndProductPrice; defaultOption.monthPriceStr = "-"; defaultOption.totalPriceStr = defaultOption.totalPrice.ToString("F2", priceStrFormat) + " " + currency; return defaultOption; }
private List<cardOptionItem> getCardOptionListByPosId(int posId, posType postype, int langId, decimal cargoAndProductPrice, CultureInfo priceStrFormat, string currency) { var posItem = getBankPosByType(postype, langId).Where(a => a.bankPosId == posId).FirstOrDefault(); // posItem is Valid if (posItem != null) { db.Entry(posItem).Collection(p => p.tbl_bankPosOption).Load(); var posOptionList = posItem.tbl_bankPosOption; List<cardOptionItem> helperList = new List<cardOptionItem>(); // Add Defult Option => Tek Çekim helperList.Add(getDefaultOption(cargoAndProductPrice, priceStrFormat, currency)); foreach (var item in posOptionList) { if (item.minBasketAmount <= cargoAndProductPrice) { cardOptionItem helper = new cardOptionItem(); helper.monthStr = item.paymentCount.ToString(); var calc = getInstallmentAmount(cargoAndProductPrice, item.paymentCount, item.additionalAmount); helper.totalPrice = calc.Item2; helper.monthPrice = calc.Item1; helper.bankPosOptionId = item.bankPosOptionId; helper.totalPriceStr = helper.totalPrice.ToString("F2", priceStrFormat) + " " + currency; helper.monthPriceStr = helper.monthPrice.ToString("F2", priceStrFormat) + " " + currency; helperList.Add(helper); } } return helperList; } else { return null; } }