예제 #1
0
        public JsonResult DeliveryRegister(helperRegisterDelivery pageHelper)
        {
            string redirectPage = "";
            string isSuccess = "no";
            string html = "";

            if (ModelState.IsValid)
            {
                checkoutProcess checkoutItem = (checkoutProcess)Session["checkoutProcess"];
                checkoutItem.deliveryAddressId = pageHelper.selectedDeliveryAddressId;
                checkoutItem.lastSuccessStep = checkoutStep.delivery;

                // Same Billing Address
                if (pageHelper.isSameBillingAddress)
                {
                    checkoutItem.isBillingSameAddress = true;
                    checkoutItem.billingAddressId = pageHelper.selectedDeliveryAddressId;
                    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("DeliveryRegisterModal", pageHelper);
            }

            return Json(new { redirectPage = redirectPage, isSuccess = isSuccess, html = html });
        }
예제 #2
0
        public JsonResult DeliveryRegisterModal(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);
                helperRegisterDelivery helperPage = new helperRegisterDelivery();

                sharedCheckoutItemLoad(pageId, helperPage, checkoutItem);

                helperPage.addressList = ads.getAddressListTemplate(checkoutItem.cartItem.userId).OrderByDescending(a => a.addressId).ToList();
                helperPage.userguid = checkoutItem.cartItem.userGuid;
                helperPage.selectedDeliveryAddressId = addressId;

                string htmlText = RenderRazorViewToString("DeliveryRegisterModal", helperPage);
                return Json(new { html = htmlText }, JsonRequestBehavior.AllowGet);
            }
            else
            {
                return null;
            }
        }
예제 #3
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);
            }
        }