예제 #1
0
        internal orderInfo getOrderInfoByCheckoutProcess(checkoutProcess checkoutItem, orderSummary helperPage, DbWithControllerWithMaster helperController, BasketHtmlType htmlType, AddressHtmlType addressType, TransferHtmlType transferType, int langId)
        {
            var ads = new addressShared(db);
            var us = new userShared(db);
            var item = new ViewModel.Checkout.Summary.orderInfo();

            // Kayıtlı Üye
            if (checkoutItem.cartItem.isRegisteredUser)
            {

                //customerNameSurname
                item.customerNameSurname = checkoutItem.cartItem.nameSurname;

                //customerEmail
                var userId = checkoutItem.cartItem.userId;
                item.customerEmail = us.getUserById(userId).email;

                //customer Delivery Adress
                item.deliveryHtml = ads.getAddressHtml(checkoutItem.deliveryAddressId, addressType, helperController);

                //customerPhone
                item.customerPhone = ads.getAddresPhoneByAddressId(checkoutItem.deliveryAddressId);

                // customer Billing Addres
                item.billingHtml = ads.getAddressHtml(checkoutItem.billingAddressId, addressType, helperController);
            }
            else
            {
                //customerNameSurname
                item.customerNameSurname = checkoutItem.trackInfo.name + " " + checkoutItem.trackInfo.surname;

                //customerEmail
                item.customerEmail = checkoutItem.trackInfo.email;

                //customer Delivery Adress
                item.deliveryHtml = ads.getAddressHtml(checkoutItem.deliveryAddress, addressType, helperController);

                //customerPhone
                item.customerPhone = checkoutItem.deliveryAddress.phone;

                // customer Billing Addres
                item.billingHtml = ads.getAddressHtml(checkoutItem.billingAddress, addressType, helperController);
            }

            item.orderDate = DateTime.Now.ToString("dd.MM.yyyy");
            item.customerBasket = getBasketListWithPlainHtml(helperPage, helperController, htmlType);
            item.transferAccountHtml = getTransferInfoHtml(checkoutItem.transferInfo.selectedTransferId, langId, helperController, transferType);

            return item;
        }
예제 #2
0
        private string getBasketListWithPlainHtml(orderSummary helperPage, DbWithControllerWithMaster helperController, BasketHtmlType htmlType)
        {
            switch (htmlType)
            {
                case BasketHtmlType.agreement:
                    return helperController.RenderRazorViewToString("PlainBasket", helperPage);

                case BasketHtmlType.mail:

                    return helperController.RenderRazorViewToString("PlainBasketMail", helperPage);

                default:
                    return "";

            }
        }
예제 #3
0
        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
        }