예제 #1
0
        private void InitializePageContent()
        {
            if (CommonLogic.QueryStringNativeInt("errormsg") > 0)
            {
                ErrorMessage e = new ErrorMessage(CommonLogic.QueryStringNativeInt("errormsg"));
                lblErrorMessage.Text = string.Format("<div class='error-large'>{0}</div>", e.Message);
                pnlErrorMsg.Visible  = true;
            }

            if (Checkout && !ThisCustomer.IsRegistered)
            {
                ltSignin.Text = "<div class='page-row signin-row'>" + AppLogic.GetString("createaccount.aspx.3", SkinID, ThisCustomer.LocaleSetting) + " <a href=\"signin.aspx?checkout=" + CommonLogic.QueryStringBool("checkout").ToString().ToLowerInvariant() + "&returnURL=" + Server.UrlEncode(CommonLogic.IIF(Checkout, "shoppingcart.aspx?checkout=true", "account.aspx")) + "\">" + AppLogic.GetString("createaccount.aspx.4", SkinID, ThisCustomer.LocaleSetting) + "</a>.</div>";
            }

            //if the customer already has entered a password don't ask them for another one
            Password p = new Password("", ThisCustomer.SaltKey);

            ctrlAccount.ShowPassword = (ThisCustomer.Password == "" || ThisCustomer.Password == p.SaltedPassword);

            ctrlAccount.Over13            = ThisCustomer.IsOver13;
            ctrlAccount.VATRegistrationID = ThisCustomer.VATRegistrationID;

            //Account Info
            if (!SkipRegistration)
            {
                pnlAccountInfo.Visible = true;

                if (ViewState["custpwd"] == null)
                {
                    ctrlAccount.txtPassword.TextMode        = TextBoxMode.Password;
                    ctrlAccount.txtPasswordConfirm.TextMode = TextBoxMode.Password;
                }

                ShoppingCart cart = new ShoppingCart(ThisCustomer.SkinID, ThisCustomer, CartTypeEnum.ShoppingCart, 0, false);

                if (Checkout && !cart.HasRecurringComponents() && (AppLogic.AppConfigBool("PasswordIsOptionalDuringCheckout") || AppLogic.AppConfigBool("HidePasswordFieldDuringCheckout")))
                {
                    ctrlAccount.PasswordValidator.Visible = false;
                    ctrlAccount.PasswordValidator.Enabled = false;
                }
                ctrlAccount.ShowOver13 = AppLogic.AppConfigBool("RequireOver13Checked");
                if (!AppLogic.AppConfigBool("Vat.Enabled"))
                {
                    ctrlAccount.ShowVATRegistrationID = false;
                }

                if (!IsPostBack)
                {
                    ctrlAccount.FirstName = Server.HtmlEncode(CommonLogic.IIF(ThisCustomer.FirstName.Length != 0, ThisCustomer.FirstName, BillingAddress.FirstName));
                    ctrlAccount.LastName  = Server.HtmlEncode(CommonLogic.IIF(ThisCustomer.LastName.Length != 0, ThisCustomer.LastName, BillingAddress.LastName));

                    String emailx = ThisCustomer.EMail;

                    ctrlAccount.Email = Server.HtmlEncode(emailx).ToLowerInvariant().Trim();

                    ctrlAccount.Phone = Server.HtmlEncode(CommonLogic.IIF(ThisCustomer.Phone.Length != 0, ThisCustomer.Phone, BillingAddress.Phone));
                    // Create a phone validation error message

                    ctrlAccount.OKToEmailYes = (ThisCustomer.EMail.Length != 0);
                    ctrlAccount.OKToEmailNo  = !ctrlAccount.OKToEmailYes;
                }
            }
            else
            {
                valReqSkipRegEmail.Enabled = AppLogic.AppConfigBool("AnonCheckoutReqEmail");
                String emailx = ThisCustomer.EMail;
                txtSkipRegEmail.Text = Server.HtmlEncode(emailx).ToLowerInvariant().Trim();

                Literal2.Visible      = AppLogic.AppConfigBool("RequireOver13Checked");
                SkipRegOver13.Visible = AppLogic.AppConfigBool("RequireOver13Checked");

                SkipRegOver13.Checked        = ThisCustomer.IsOver13;
                pnlSkipReg.Visible           = true;
                createaccountaspx30.Visible  = false;
                BillingEqualsAccount.Visible = false;
                createaccountaspx31.Visible  = false;
            }

            if (!IsPostBack)
            {
                createaccountaspx31.Text = AppLogic.GetString("createaccount.aspx.31", SkinID, ThisCustomer.LocaleSetting);
                if (AllowShipToDifferentThanBillTo)
                {
                    createaccountaspx30.Text = AppLogic.GetString("createaccount.aspx.30", SkinID, ThisCustomer.LocaleSetting);
                }
                else
                {
                    createaccountaspx30.Text = AppLogic.GetString("createaccount.aspx.32", SkinID, ThisCustomer.LocaleSetting);
                }

                ctrlBillingAddress.NickName      = Server.HtmlEncode(ctrlBillingAddress.NickName);
                ctrlBillingAddress.FirstName     = Server.HtmlEncode(CommonLogic.IIF(ThisCustomer.FirstName.Length != 0, ThisCustomer.FirstName, BillingAddress.FirstName));
                ctrlBillingAddress.LastName      = Server.HtmlEncode(CommonLogic.IIF(ThisCustomer.LastName.Length != 0, ThisCustomer.LastName, BillingAddress.LastName));
                ctrlBillingAddress.PhoneNumber   = Server.HtmlEncode(BillingAddress.Phone);
                ctrlBillingAddress.Company       = Server.HtmlEncode(BillingAddress.Company);
                ctrlBillingAddress.ResidenceType = BillingAddress.ResidenceType.ToString();
                ctrlBillingAddress.Address1      = Server.HtmlEncode(BillingAddress.Address1);
                ctrlBillingAddress.Address2      = Server.HtmlEncode(BillingAddress.Address2);
                ctrlBillingAddress.Suite         = Server.HtmlEncode(BillingAddress.Suite);
                ctrlBillingAddress.State         = Server.HtmlEncode(BillingAddress.State);
                ctrlBillingAddress.City          = Server.HtmlEncode(BillingAddress.City);
                ctrlBillingAddress.ZipCode       = BillingAddress.Zip;
                ctrlBillingAddress.ShowZip       = AppLogic.GetCountryPostalCodeRequired(AppLogic.GetCountryID(ctrlBillingAddress.Country));

                //Shipping Info
                if (AllowShipToDifferentThanBillTo)
                {
                    pnlShippingInfo.Visible           = true;
                    ctrlShippingAddress.NickName      = Server.HtmlEncode(ShippingAddress.NickName);
                    ctrlShippingAddress.FirstName     = Server.HtmlEncode(CommonLogic.IIF(ThisCustomer.FirstName.Length != 0, ThisCustomer.FirstName, BillingAddress.FirstName));
                    ctrlShippingAddress.LastName      = Server.HtmlEncode(CommonLogic.IIF(ThisCustomer.LastName.Length != 0, ThisCustomer.LastName, BillingAddress.LastName));
                    ctrlShippingAddress.PhoneNumber   = Server.HtmlEncode(ShippingAddress.Phone);
                    ctrlShippingAddress.Company       = Server.HtmlEncode(ShippingAddress.Company);
                    ctrlShippingAddress.ResidenceType = ShippingAddress.ResidenceType.ToString();
                    ctrlShippingAddress.Address1      = Server.HtmlEncode(ShippingAddress.Address1);
                    ctrlShippingAddress.Address2      = Server.HtmlEncode(ShippingAddress.Address2);
                    ctrlShippingAddress.Suite         = Server.HtmlEncode(ShippingAddress.Suite);
                    ctrlShippingAddress.City          = Server.HtmlEncode(ShippingAddress.City);
                    ctrlShippingAddress.State         = Server.HtmlEncode(ShippingAddress.State);
                    ctrlShippingAddress.ZipCode       = ShippingAddress.Zip;
                    ctrlShippingAddress.ShowZip       = AppLogic.GetCountryPostalCodeRequired(AppLogic.GetCountryID(ctrlShippingAddress.Country));
                }

                //if (!Checkout)
                //{
                //    //hide billing and shipping inputs in case of Checkout
                //    pnlBillingInfo.Visible = false;
                //    pnlShippingInfo.Visible = false;
                //}

                // Hide billing and shipping inputs w.r.t mock-ups
                pnlBillingInfo.Visible  = false;
                pnlShippingInfo.Visible = false;
            }

            GatewayCheckoutByAmazon.CheckoutByAmazon checkoutByAmazon = new GatewayCheckoutByAmazon.CheckoutByAmazon();

            if (checkoutByAmazon.IsCheckingOut)
            {
                pnlAccountInfo.Visible = !ThisCustomer.IsRegistered && !SkipRegistration;

                pnlBillingInfo.Visible      =
                    pnlShippingInfo.Visible = false;

                pnlCBAAddressWidget.Visible = true;

                litCBAAddressWidget.Text            = checkoutByAmazon.RenderAddressWidget("CBAAddressWidgetContainer", false, String.Empty, new Guid(ThisCustomer.CustomerGUID), 300, 200);
                litCBAAddressWidgetInstruction.Text = "gw.checkoutbyamazon.display.4".StringResource();
            }

            if (!ThisCustomer.IsRegistered)
            {
                if (SkipRegistration)
                {
                    btnContinueCheckout.Text = CommonLogic.IIF(Checkout, AppLogic.GetString("createaccount.aspx.76", ThisCustomer.SkinID, ThisCustomer.LocaleSetting), AppLogic.GetString("createaccount.aspx.75", SkinID, ThisCustomer.LocaleSetting));
                }
                else
                {
                    btnContinueCheckout.Text = CommonLogic.IIF(Checkout, AppLogic.GetString("createaccount.aspx.74", ThisCustomer.SkinID, ThisCustomer.LocaleSetting), AppLogic.GetString("createaccount.aspx.75", SkinID, ThisCustomer.LocaleSetting));
                }
            }
            else
            {
                btnContinueCheckout.Text = AppLogic.GetString("account.aspx.60", ThisCustomer.SkinID, ThisCustomer.LocaleSetting);
            }

            GetJavaScriptFunctions();
            AppLogic.GetButtonDisable(this.btnContinueCheckout, this.btnContinueCheckout.ValidationGroup);
        }
        private void InitializePageContent()
        {
            if (Checkout)
            {
                pnlCheckoutImage.Visible = true;
                CheckoutImage.ImageUrl   = AppLogic.LocateImageURL("~/App_Themes/skin_" + SkinID.ToString() + "/images/step_2.gif");
            }

            if (CommonLogic.QueryStringNativeInt("errormsg") > 0)
            {
                ErrorMessage e = new ErrorMessage(CommonLogic.QueryStringNativeInt("errormsg"));
                pnlErrorMsg.Controls.Add(new LiteralControl(String.Format("<b style='color:red;'>{0}</b><br /><br />", e.Message)));
            }

            if (Checkout && !ThisCustomer.IsRegistered)
            {
                Signin.Text = "<p align=\"left\">" + AppLogic.GetString("createaccount.aspx.3", SkinID, ThisCustomer.LocaleSetting) + " <a href=\"signin.aspx?checkout=" + CommonLogic.QueryStringBool("checkout").ToString().ToLowerInvariant() + "&returnURL=" + Server.UrlEncode(CommonLogic.IIF(Checkout, "shoppingcart.aspx?checkout=true", "account.aspx")) + "\"><b>" + AppLogic.GetString("createaccount.aspx.4", SkinID, ThisCustomer.LocaleSetting) + "</b></a>.</p>";
            }

            //if the customer already has entered a password don't ask them for another one
            Password p = new Password("", ThisCustomer.SaltKey);

            ctrlAccount.ShowPassword = (ThisCustomer.Password == "" || ThisCustomer.Password == p.SaltedPassword);

            ctrlAccount.Over13            = ThisCustomer.IsOver13;
            ctrlAccount.VATRegistrationID = ThisCustomer.VATRegistrationID;

            //Account Info
            if (!SkipRegistration)
            {
                pnlAccountInfo.Visible   = true;
                accountinfo_gif.ImageUrl = AppLogic.LocateImageURL("~/App_Themes/Skin_" + SkinID.ToString() + "/images/accountinfo.gif");


                if (ViewState["custpwd"] == null)
                {
                    ctrlAccount.txtPassword.TextMode        = TextBoxMode.Password;
                    ctrlAccount.txtPasswordConfirm.TextMode = TextBoxMode.Password;
                }
                if (Checkout && (AppLogic.AppConfigBool("PasswordIsOptionalDuringCheckout") || AppLogic.AppConfigBool("HidePasswordFieldDuringCheckout")))
                {
                    ctrlAccount.PasswordValidator.Visible = false;
                    ctrlAccount.PasswordValidator.Enabled = false;
                }
                ctrlAccount.ShowOver13 = AppLogic.AppConfigBool("RequireOver13Checked");
                if (!AppLogic.AppConfigBool("Vat.Enabled") || AppLogic.ProductIsMLExpress() == true)
                {
                    ctrlAccount.ShowVATRegistrationID = false;
                }

                if (!IsPostBack)
                {
                    ctrlAccount.FirstName = Server.HtmlEncode(CommonLogic.IIF(ThisCustomer.FirstName.Length != 0, ThisCustomer.FirstName, BillingAddress.FirstName));
                    ctrlAccount.LastName  = Server.HtmlEncode(CommonLogic.IIF(ThisCustomer.LastName.Length != 0, ThisCustomer.LastName, BillingAddress.LastName));

                    String emailx = ThisCustomer.EMail;

                    ctrlAccount.Email = Server.HtmlEncode(emailx).ToLowerInvariant().Trim();

                    ctrlAccount.Phone = Server.HtmlEncode(CommonLogic.IIF(ThisCustomer.Phone.Length != 0, ThisCustomer.Phone, BillingAddress.Phone));
                    // Create a phone validation error message

                    ctrlAccount.OKToEmailYes = (ThisCustomer.EMail.Length != 0);
                    ctrlAccount.OKToEmailNo  = !ctrlAccount.OKToEmailYes;
                }
            }
            else
            {
                valReqSkipRegEmail.Enabled = AppLogic.ProductIsMLExpress() == false && AppLogic.AppConfigBool("AnonCheckoutReqEmail");
                String emailx = ThisCustomer.EMail;
                txtSkipRegEmail.Text = Server.HtmlEncode(emailx).ToLowerInvariant().Trim();

                Literal2.Visible      = AppLogic.AppConfigBool("RequireOver13Checked");
                SkipRegOver13.Visible = AppLogic.AppConfigBool("RequireOver13Checked");

                SkipRegOver13.Checked        = ThisCustomer.IsOver13;
                pnlSkipReg.Visible           = true;
                createaccountaspx30.Visible  = false;
                BillingEqualsAccount.Visible = false;
                createaccountaspx31.Visible  = false;
            }

            if (!IsPostBack)
            {
                //Billing Info
                tblBillingInfo.Attributes.Add("style", "border-style: solid; border-width: 0px; border-color: #" + AppLogic.AppConfig("HeaderBGColor"));
                tblBillingInfoBox.Attributes.Add("style", AppLogic.AppConfig("BoxFrameStyle"));

                if (AllowShipToDifferentThanBillTo)
                {
                    billinginfo_gif.ImageUrl = AppLogic.LocateImageURL("~/App_Themes/Skin_" + SkinID.ToString() + "/images/billinginfo.gif");
                }
                else
                {
                    billinginfo_gif.ImageUrl = AppLogic.LocateImageURL("~/App_Themes/Skin_" + SkinID.ToString() + "/images/shippingandbillinginfo.gif");
                }

                createaccountaspx31.Text = AppLogic.GetString("createaccount.aspx.31", SkinID, ThisCustomer.LocaleSetting);
                if (AllowShipToDifferentThanBillTo)
                {
                    createaccountaspx30.Text = AppLogic.GetString("createaccount.aspx.30", SkinID, ThisCustomer.LocaleSetting);
                }
                else
                {
                    createaccountaspx30.Text = AppLogic.GetString("createaccount.aspx.32", SkinID, ThisCustomer.LocaleSetting);
                }

                ctrlBillingAddress.NickName      = Server.HtmlEncode(ctrlBillingAddress.NickName);
                ctrlBillingAddress.FirstName     = Server.HtmlEncode(CommonLogic.IIF(ThisCustomer.FirstName.Length != 0, ThisCustomer.FirstName, BillingAddress.FirstName));
                ctrlBillingAddress.LastName      = Server.HtmlEncode(CommonLogic.IIF(ThisCustomer.LastName.Length != 0, ThisCustomer.LastName, BillingAddress.LastName));
                ctrlBillingAddress.PhoneNumber   = Server.HtmlEncode(BillingAddress.Phone);
                ctrlBillingAddress.Company       = Server.HtmlEncode(BillingAddress.Company);
                ctrlBillingAddress.ResidenceType = BillingAddress.ResidenceType.ToString();
                ctrlBillingAddress.Address1      = Server.HtmlEncode(BillingAddress.Address1);
                ctrlBillingAddress.Address2      = Server.HtmlEncode(BillingAddress.Address2);
                ctrlBillingAddress.Suite         = Server.HtmlEncode(BillingAddress.Suite);
                ctrlBillingAddress.State         = Server.HtmlEncode(BillingAddress.State);
                ctrlBillingAddress.City          = Server.HtmlEncode(BillingAddress.City);
                ctrlBillingAddress.ZipCode       = BillingAddress.Zip;
                ctrlBillingAddress.ShowZip       = AppLogic.GetCountryPostalCodeRequired(AppLogic.GetCountryID(ctrlBillingAddress.Country));

                //Shipping Info
                if (AllowShipToDifferentThanBillTo)
                {
                    pnlShippingInfo.Visible = true;
                    tblShippingInfo.Attributes.Add("style", "border-style: solid; border-width: 0px; border-color: #" + AppLogic.AppConfig("HeaderBGColor"));
                    tblShippingInfoBox.Attributes.Add("style", AppLogic.AppConfig("BoxFrameStyle"));
                    shippinginfo_gif.ImageUrl = AppLogic.LocateImageURL("~/App_Themes/Skin_" + SkinID.ToString() + "/images/shippinginfo.gif");

                    ctrlShippingAddress.NickName      = Server.HtmlEncode(ShippingAddress.NickName);
                    ctrlShippingAddress.FirstName     = Server.HtmlEncode(CommonLogic.IIF(ThisCustomer.FirstName.Length != 0, ThisCustomer.FirstName, BillingAddress.FirstName));
                    ctrlShippingAddress.LastName      = Server.HtmlEncode(CommonLogic.IIF(ThisCustomer.LastName.Length != 0, ThisCustomer.LastName, BillingAddress.LastName));
                    ctrlShippingAddress.PhoneNumber   = Server.HtmlEncode(ShippingAddress.Phone);
                    ctrlShippingAddress.Company       = Server.HtmlEncode(ShippingAddress.Company);
                    ctrlShippingAddress.ResidenceType = ShippingAddress.ResidenceType.ToString();
                    ctrlShippingAddress.Address1      = Server.HtmlEncode(ShippingAddress.Address1);
                    ctrlShippingAddress.Address2      = Server.HtmlEncode(ShippingAddress.Address2);
                    ctrlShippingAddress.Suite         = Server.HtmlEncode(ShippingAddress.Suite);
                    ctrlShippingAddress.City          = Server.HtmlEncode(ShippingAddress.City);
                    ctrlShippingAddress.State         = Server.HtmlEncode(ShippingAddress.State);
                    ctrlShippingAddress.ZipCode       = ShippingAddress.Zip;
                    ctrlShippingAddress.ShowZip       = AppLogic.GetCountryPostalCodeRequired(AppLogic.GetCountryID(ctrlShippingAddress.Country));
                }
            }

            GatewayCheckoutByAmazon.CheckoutByAmazon checkoutByAmazon = new GatewayCheckoutByAmazon.CheckoutByAmazon();

            if (checkoutByAmazon.IsCheckingOut)
            {
                pnlAccountInfo.Visible = !ThisCustomer.IsRegistered && !SkipRegistration;

                pnlBillingInfo.Visible      =
                    pnlShippingInfo.Visible = false;

                pnlCBAAddressWidget.Visible = true;

                litCBAAddressWidget.Text            = checkoutByAmazon.RenderAddressWidget("CBAAddressWidgetContainer", false, String.Empty, new Guid(ThisCustomer.CustomerGUID), 300, 200);
                litCBAAddressWidgetInstruction.Text = "gw.checkoutbyamazon.display.4".StringResource();
            }

            if (!ThisCustomer.IsRegistered)
            {
                if (SkipRegistration)
                {
                    btnContinueCheckout.Text = CommonLogic.IIF(Checkout, AppLogic.GetString("createaccount.aspx.76", ThisCustomer.SkinID, ThisCustomer.LocaleSetting), AppLogic.GetString("createaccount.aspx.75", SkinID, ThisCustomer.LocaleSetting));
                }
                else
                {
                    btnContinueCheckout.Text = CommonLogic.IIF(Checkout, AppLogic.GetString("createaccount.aspx.74", ThisCustomer.SkinID, ThisCustomer.LocaleSetting), AppLogic.GetString("createaccount.aspx.75", SkinID, ThisCustomer.LocaleSetting));
                }
            }
            else
            {
                btnContinueCheckout.Text = AppLogic.GetString("account.aspx.60", ThisCustomer.SkinID, ThisCustomer.LocaleSetting);
            }

            GetJavaScriptFunctions();
            AppLogic.GetButtonDisable(this.btnContinueCheckout, this.btnContinueCheckout.ValidationGroup);
        }