Пример #1
0
        public ActionResult Billing(int pageId)
        {
            checkoutProcess checkoutItem = (checkoutProcess)Session["checkoutProcess"];
            checkoutItem.clearDataOnStepAndBindCurrentStep(checkoutStep.billing);

            // Validation
            var validation = checkoutItem.validationOnCurrentStep(db);
            if (!validation.Item1)
            {
                return redirectToValidation(validation, checkoutItem);
            }

            // Kayıtlı Üye
            if (checkoutItem.cartItem.isRegisteredUser)
            {
                addressShared ads = new addressShared(db);
                userShared us = new userShared(db);

                helperRegisterBilling helperPage = new helperRegisterBilling();
                sharedCheckoutItemLoad(pageId, helperPage, checkoutItem);
                helperPage.addressList = ads.getAddressListTemplate(checkoutItem.cartItem.userId).OrderByDescending(a => a.addressId).ToList();
                helperPage.selectedBillingAddressId = checkoutItem.billingAddressId;

                helperPage.userguid = checkoutItem.cartItem.userGuid;

                Session["checkoutProcess"] = checkoutItem;
                return View("BillingRegister", helperPage);
            }
            else // Üye olmadan Ödeme
            {
                helperUnRegisterBilling helperPage = new helperUnRegisterBilling();
                sharedCheckoutItemLoad(pageId, helperPage, checkoutItem);

                if (checkoutItem.billingAddress != null)
                {
                    helperPage.addressItem = checkoutItem.billingAddress;
                }
                else
                {
                    if (checkoutItem.isBillingSameAddress && checkoutItem.deliveryAddress != null)
                    {
                        helperPage.addressItem = checkoutItem.deliveryAddress;
                    }
                    else
                    {
                        helperPage.addressItem = new Models.tbl_address();
                    }
                }

                helperPage.addressItem.isPersonal = true;

                Session["checkoutProcess"] = checkoutItem;
                return View("BillingUnRegister", helperPage);

            }
        }
Пример #2
0
        public JsonResult BillingRegisterModal(int pageId, int addressId)
        {
            checkoutProcess checkoutItem = (checkoutProcess)Session["checkoutProcess"];

            // Kayıtlı Üye
            if (checkoutItem.cartItem.isRegisteredUser)
            {
                addressShared ads = new addressShared(db);
                userShared us = new userShared(db);

                helperRegisterBilling helperPage = new helperRegisterBilling();
                sharedCheckoutItemLoad(pageId, helperPage, checkoutItem);
                helperPage.addressList = ads.getAddressListTemplate(checkoutItem.cartItem.userId).OrderByDescending(a => a.addressId).ToList();
                helperPage.selectedBillingAddressId = addressId;
                helperPage.userguid = checkoutItem.cartItem.userGuid;

                string htmlText = RenderRazorViewToString("BillingRegisterModal", helperPage);

                return Json(new { html = htmlText }, JsonRequestBehavior.AllowGet);
            }
            else
            {
                return null;
            }
        }
Пример #3
0
        public JsonResult BillingRegister(helperRegisterBilling pageHelper)
        {
            string redirectPage = "";
            string isSuccess = "no";
            string html = "";

            if (ModelState.IsValid)
            {
                checkoutProcess checkoutItem = (checkoutProcess)Session["checkoutProcess"];
                checkoutItem.billingAddressId = pageHelper.selectedBillingAddressId;
                checkoutItem.lastSuccessStep = checkoutStep.billing;
                redirectPage = getSiteNameWithoutSlash(Request) + redirecToStepUrlRelative(checkoutStep.cargo, checkoutItem);

                isSuccess = "yes";
                Session["checkoutProcess"] = checkoutItem;
            }
            else
            {
                pageHelper.isMessageExist = true;
                pageHelper.message = getErrorMessage(getModelStateError(ModelState), "autoHide");
                html = RenderRazorViewToString("BillingRegisterModal", pageHelper);
            }

            return Json(new { redirectPage = redirectPage, isSuccess = isSuccess, html = html });
        }