Exemplo n.º 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);

            }
        }
Exemplo n.º 2
0
        public JsonResult BillingUnRegister(helperUnRegisterBilling pageHelper)
        {
            string redirectPage = "";
            string isSuccess = "no";
            string html = "";

            if (ModelState.IsValid)
            {
                checkoutProcess checkoutItem = (checkoutProcess)Session["checkoutProcess"];

                pageHelper.addressItem.isGuestUser = true;
                checkoutItem.billingAddress = pageHelper.addressItem;
                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("BillingUnRegisterModal", pageHelper);
            }

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