コード例 #1
0
        public JsonResult DeliveryUnRegister(helperUnRegisterDelivery pageHelper)
        {
            string redirectPage = "";
            string isSuccess = "no";
            string html = "";

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

                pageHelper.addressItem.isGuestUser = true;

                checkoutItem.deliveryAddress = pageHelper.addressItem;
                checkoutItem.trackInfo = pageHelper.trackInfoItem;

                checkoutItem.lastSuccessStep = checkoutStep.delivery;

                // Same Billing Address
                if (pageHelper.isSameBillingAddress)
                {
                    checkoutItem.isBillingSameAddress = true;
                    checkoutItem.billingAddress = pageHelper.addressItem;
                    redirectPage = getSiteNameWithoutSlash(Request) + redirecToStepUrlRelative(checkoutStep.cargo, checkoutItem);
                    checkoutItem.lastSuccessStep = checkoutStep.billing;
                }
                else
                {
                    redirectPage = getSiteNameWithoutSlash(Request) + redirecToStepUrlRelative(checkoutStep.billing, checkoutItem);
                }

                isSuccess = "yes";
                Session["checkoutProcess"] = checkoutItem;

            }
            else
            {
                pageHelper.isMessageExist = true;
                pageHelper.message = getErrorMessage(getModelStateError(ModelState), "autoHide");
                html = RenderRazorViewToString("DeliveryUnRegisterModal", pageHelper);
            }

            return Json(new { redirectPage = redirectPage, isSuccess = isSuccess, html = html });
        }
コード例 #2
0
        public ActionResult Delivery(int pageId)
        {
            checkoutProcess checkoutItem = (checkoutProcess)Session["checkoutProcess"];
            checkoutItem.clearDataOnStepAndBindCurrentStep(checkoutStep.delivery);

            // 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);

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

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

            }
            else // Üye olmadan Ödeme
            {
                helperUnRegisterDelivery helperPage = new helperUnRegisterDelivery();
                sharedCheckoutItemLoad(pageId, helperPage, checkoutItem);

                // Bind AddressItem
                if (checkoutItem.deliveryAddress != null)
                {
                    helperPage.addressItem = checkoutItem.deliveryAddress;
                }
                else
                {
                    helperPage.addressItem = new Models.tbl_address();
                }

                // Bind TrackInfo ( Name, Surname, Email )
                if (checkoutItem.trackInfo != null)
                {
                    helperPage.trackInfoItem = checkoutItem.trackInfo;
                }
                else
                {
                    helperPage.trackInfoItem = new deliveryTrackInfo();
                }

                helperPage.addressItem.isPersonal = true;

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