private void CreateAccount() { SetPasswordFields(); string AccountName = (ctrlAccount.FirstName.Trim() + " " + ctrlAccount.LastName.Trim()).Trim(); if (SkipRegistration) { Page.Validate("skipreg"); } else { if (ctrlAccount.Password.Contains('\xFF') || ctrlAccount.Password.Length == 0) { ctrlAccount.PasswordValidate = ViewState["custpwd"].ToString(); } else { ctrlAccount.PasswordValidate = ctrlAccount.Password; } if (ctrlAccount.PasswordConfirm.Contains('\xFF') || ctrlAccount.PasswordConfirm.Length == 0) { ctrlAccount.PasswordConfirmValidate = ViewState["custpwd2"].ToString(); } else { ctrlAccount.PasswordConfirmValidate = ctrlAccount.PasswordConfirm; } ctrlAccount.Over13 = ctrlAccount.Over13; if ((!ThisCustomer.IsRegistered) && (ctrlAccount.Password.Length == 0 || ctrlAccount.PasswordConfirm.Length == 0)) { ErrorMsgLabel.Text = "createaccount.aspx.6".StringResource(); ResetScrollPosition(); return; } Page.Validate("registration"); if (RequireSecurityCode) { if (Session["SecurityCode"] != null) { String sCode = Session["SecurityCode"].ToString(); String fCode = ctrlAccount.txtSecurityCode.Text; Boolean codeMatch = false; if (AppLogic.AppConfigBool("Captcha.CaseSensitive")) { if (fCode.Equals(sCode)) { codeMatch = true; } } else { if (fCode.Equals(sCode, StringComparison.InvariantCultureIgnoreCase)) { codeMatch = true; } } if (!codeMatch) { ErrorMsgLabel.Text = string.Format(AppLogic.GetString("lat_signin_process.aspx.5", SkinID, ThisCustomer.LocaleSetting), sCode, fCode); ctrlAccount.txtSecurityCode.Text = String.Empty; ctrlAccount.imgAccountSecurityImage.ImageUrl = "~/Captcha.ashx?id=1"; ResetScrollPosition(); return; } } else { ErrorMsgLabel.Text = string.Format(AppLogic.GetString("lat_signin_process.aspx.5", SkinID, ThisCustomer.LocaleSetting), "", ctrlAccount.txtSecurityCode.Text); ctrlAccount.txtSecurityCode.Text = String.Empty; ctrlAccount.imgAccountSecurityImage.ImageUrl = "~/Captcha.ashx?id=1"; ResetScrollPosition(); return; } } if (!Page.IsValid && RequireSecurityCode) { Session["SecurityCode"] = CommonLogic.GenerateRandomCode(6); } } //ctrlBillingAddress.CountryIDToValidateZipCode = AppLogic.GetCountryID(ctrlBillingAddress.Country); //ctrlShippingAddress.CountryIDToValidateZipCode = AppLogic.GetCountryID(ctrlBillingAddress.Country); Page.Validate("createacccount"); if (Page.IsValid && AccountName.Length > 0) { //String EMailField = CommonLogic.IIF(SkipRegistration, txtSkipRegEmail.Text.ToLowerInvariant().Trim(), ctrlAccount.Email.ToLowerInvariant().Trim()); String EMailField = ctrlAccount.Email.ToLowerInvariant().Trim(); bool NewEmailAllowed = Customer.NewEmailPassesDuplicationRules(EMailField, ThisCustomer.CustomerID, false); String PWD = ViewState["custpwd"].ToString(); Password p = new Password(PWD); String newpwd = p.SaltedPassword; System.Nullable <int> newsaltkey = p.Salt; Password blankpwd = new Password("", ThisCustomer.SaltKey); if (!(ThisCustomer.Password == "" || ThisCustomer.Password == blankpwd.SaltedPassword)) { // do NOT allow passwords to be changed on this page. this is only for creating an account. // if they want to change their password, they must use their account page newpwd = null; newsaltkey = null; } if (NewEmailAllowed) { AppLogic.eventHandler("CreateAccount").CallEvent("&CreateAccount=true"); ThisCustomer.UpdateCustomer( /*CustomerLevelID*/ null, /*EMail*/ EMailField, /*SaltedAndHashedPassword*/ newpwd, /*SaltKey*/ newsaltkey, /*DateOfBirth*/ null, /*Gender*/ null, /*FirstName*/ ctrlAccount.FirstName, /*LastName*/ ctrlAccount.LastName, /*Notes*/ null, /*SkinID*/ null, /*Phone*/ ctrlAccount.Phone, /*AffiliateID*/ null, /*Referrer*/ null, /*CouponCode*/ null, /*OkToEmail*/ CommonLogic.IIF(ctrlAccount.OKToEmailYes, 1, 0), /*IsAdmin*/ null, /*BillingEqualsShipping*/ CommonLogic.IIF(AppLogic.AppConfigBool("AllowShipToDifferentThanBillTo"), 0, 1), /*LastIPAddress*/ null, /*OrderNotes*/ null, /*SubscriptionExpiresOn*/ null, /*RTShipRequest*/ null, /*RTShipResponse*/ null, /*OrderOptions*/ null, /*LocaleSetting*/ null, /*MicroPayBalance*/ null, /*RecurringShippingMethodID*/ null, /*RecurringShippingMethod*/ null, /*BillingAddressID*/ null, /*ShippingAddressID*/ null, /*GiftRegistryGUID*/ null, /*GiftRegistryIsAnonymous*/ null, /*GiftRegistryAllowSearchByOthers*/ null, /*GiftRegistryNickName*/ null, /*GiftRegistryHideShippingAddresses*/ null, /*CODCompanyCheckAllowed*/ null, /*CODNet30Allowed*/ null, /*ExtensionData*/ null, /*FinalizationData*/ null, /*Deleted*/ null, /*Over13Checked*/ CommonLogic.IIF(ctrlAccount.Over13, 1, 0), /*CurrencySetting*/ null, /*VATSetting*/ null, /*VATRegistrationID*/ null, /*StoreCCInDB*/ CommonLogic.IIF(ctrlAccount.ShowSaveCC, ctrlAccount.SaveCC, true), /*IsRegistered*/ CommonLogic.IIF(SkipRegistration, 0, 1), /*LockedUntil*/ null, /*AdminCanViewCC*/ null, /*BadLogin*/ null, /*Active*/ null, /*PwdChangeRequired*/ null, /*RegisterDate*/ null, /*StoreId*/ AppLogic.StoreID() ); if (ctrlAccount.OKToEmailYes) { AddToNewsletterList(ctrlAccount.FirstName, ctrlAccount.LastName, EMailField); } if (AppLogic.AppConfigBool("Vat.Enabled") && ctrlAccount.VATRegistrationID.Length > 0) { String vtr = ctrlAccount.VATRegistrationID.Trim(); Exception vatServiceException = null; if (AppLogic.VATRegistrationIDIsValid("UK", vtr, out vatServiceException)) { ThisCustomer.SetVATRegistrationID(vtr); } else { vtr = String.Empty; if (vatServiceException != null && !String.IsNullOrEmpty(vatServiceException.Message)) { if (vatServiceException.Message.Length > 255) { ErrorMsgLabel.Text = Server.HtmlEncode(vatServiceException.Message.Substring(0, 255)); } else { ErrorMsgLabel.Text = Server.HtmlEncode(vatServiceException.Message); } } else { ErrorMsgLabel.Text = "account.aspx.91".StringResource(); } return; } } if (AppLogic.AppConfigBool("DynamicRelatedProducts.Enabled") || AppLogic.AppConfigBool("RecentlyViewedProducts.Enabled")) { ThisCustomer.ReplaceProductViewFromAnonymous(); } } if (Checkout) { if (!NewEmailAllowed) { ErrorMsgLabel.Text = AppLogic.GetString("createaccount_process.aspx.1", 1, Localization.GetDefaultLocale()); InitializePageContent(); } else { if (AppLogic.AppConfigBool("SendWelcomeEmail") && EMailField.IndexOf("@") != -1) { // don't let a simple welcome stop checkout! try { string body = AppLogic.RunXmlPackage(AppLogic.AppConfig("XmlPackage.WelcomeEmail"), null, ThisCustomer, this.SkinID, "", "fullname=" + ctrlAccount.FirstName.Trim() + " " + ctrlAccount.LastName.Trim(), false, false, this.EntityHelpers); AppLogic.SendMail(AppLogic.GetString("createaccount.aspx.79", ThisCustomer.SkinID, ThisCustomer.LocaleSetting), body, true, AppLogic.AppConfig("MailMe_FromAddress"), AppLogic.AppConfig("MailMe_FromName"), EMailField, ctrlAccount.FirstName.Trim() + " " + ctrlAccount.LastName.Trim(), "", AppLogic.MailServer()); } catch { } } Response.Redirect("mobilegetaddress.aspx?addresstype=billing&" + BuildRedirectQuerystring()); } } else { if (!NewEmailAllowed) { DB.ExecuteSQL("update customer set EMail='', IsRegistered = 0 where CustomerID=" + ThisCustomer.CustomerID); ErrorMsgLabel.Text = AppLogic.GetString("createaccount_process.aspx.1", 1, Localization.GetDefaultLocale()); InitializePageContent(); } else { if (AppLogic.AppConfigBool("SendWelcomeEmail") && EMailField.IndexOf("@") != -1) { // don't let a simple welcome stop checkout! try { string body = AppLogic.RunXmlPackage(AppLogic.AppConfig("XmlPackage.WelcomeEmail"), null, ThisCustomer, this.SkinID, "", "", false, false, this.EntityHelpers); AppLogic.SendMail(AppLogic.GetString("createaccount.aspx.79", ThisCustomer.SkinID, ThisCustomer.LocaleSetting), body, true, AppLogic.AppConfig("MailMe_FromAddress"), AppLogic.AppConfig("MailMe_FromName"), EMailField, ctrlAccount.FirstName.Trim() + " " + ctrlAccount.LastName.Trim(), "", AppLogic.MailServer()); } catch { } } if (VerifyAddressPrompt) { if (AllowShipToDifferentThanBillTo) { Response.Redirect("address.aspx?Checkout=False&AddressType=Shipping&AddressID=" + Customer.GetCustomerPrimaryShippingAddressID(ThisCustomer.CustomerID).ToString() + "&NewAccount=true&prompt=" + VerifyResult); } else { Response.Redirect("address.aspx?Checkout=False&AddressType=Billing&AddressID=" + Customer.GetCustomerPrimaryShippingAddressID(ThisCustomer.CustomerID).ToString() + "&NewAccount=true&prompt=" + VerifyResult); } } else { Response.Redirect("account.aspx?newaccount=true"); } } } } else { ErrorMsgLabel.Text += "" + AppLogic.GetString("createaccount.aspx.84", 1, Localization.GetDefaultLocale()) + ""; if (AccountName.Length == 0) { ErrorMsgLabel.Text += "• " + AppLogic.GetString("createaccount.aspx.5", 1, Localization.GetDefaultLocale()) + ""; } foreach (IValidator aValidator in this.Validators) { if (!aValidator.IsValid) { ErrorMsgLabel.Text += "• " + aValidator.ErrorMessage + ""; } } ErrorMsgLabel.Text += ""; ResetScrollPosition(); } pnlErrorMsg.Visible = (ErrorMsgLabel.Text.Length > 5); }
private void CreateAccount() { ThisCustomer.RequireCustomerRecord(); GatewayCheckoutByAmazon.CheckoutByAmazon checkoutByAmazon = new GatewayCheckoutByAmazon.CheckoutByAmazon(); if (checkoutByAmazon.IsEnabled && checkoutByAmazon.IsCheckingOut && checkoutByAmazon.GetDefaultShippingAddress() == null) { lblErrorMessage.Text = "gw.checkoutbyamazon.display.3".StringResource(); pnlErrorMsg.Visible = true; return; } if (checkoutByAmazon.IsEnabled && checkoutByAmazon.IsCheckingOut && ThisCustomer.IsRegistered) { checkoutByAmazon.BeginCheckout(new Guid(ThisCustomer.CustomerGUID), false, false); Response.Redirect("checkoutshipping.aspx"); } else if (checkoutByAmazon.IsEnabled && checkoutByAmazon.IsCheckingOut) { checkoutByAmazon.BeginCheckout(new Guid(ThisCustomer.CustomerGUID), false, false); } SetPasswordFields(); string AccountName = (ctrlAccount.FirstName.Trim() + " " + ctrlAccount.LastName.Trim()).Trim(); if (SkipRegistration) { AccountName = String.Format("{0} {1}", ctrlBillingAddress.FirstName.Trim(), ctrlBillingAddress.LastName.Trim()).Trim(); if (checkoutByAmazon.IsEnabled && checkoutByAmazon.IsCheckingOut) { AccountName = "Anonymous Amazon Customer"; } } if (SkipRegistration) { Page.Validate("skipreg"); } else { if (ctrlAccount.Password.Contains('\xFF') || ctrlAccount.Password.Length == 0) { ctrlAccount.PasswordValidate = ViewState["custpwd"].ToString(); } else { ctrlAccount.PasswordValidate = ctrlAccount.Password; } if (ctrlAccount.PasswordConfirm.Contains('\xFF') || ctrlAccount.PasswordConfirm.Length == 0) { ctrlAccount.PasswordConfirmValidate = ViewState["custpwd2"].ToString(); } else { ctrlAccount.PasswordConfirmValidate = ctrlAccount.PasswordConfirm; } ctrlAccount.Over13 = ctrlAccount.Over13; if ((!ThisCustomer.IsRegistered) && !checkoutByAmazon.IsCheckingOut && (ctrlAccount.Password.Length == 0 || ctrlAccount.PasswordConfirm.Length == 0)) { lblErrorMessage.Text = "createaccount.aspx.6".StringResource(); ResetScrollPosition(); pnlErrorMsg.Visible = true; return; } ctrlBillingAddress.CountryIDToValidateZipCode = AppLogic.GetCountryID(ctrlBillingAddress.Country); ctrlShippingAddress.CountryIDToValidateZipCode = AppLogic.GetCountryID(ctrlShippingAddress.Country); Page.Validate("registration"); if (RequireSecurityCode) { if (Session["SecurityCode"] != null) { String sCode = Session["SecurityCode"].ToString(); String fCode = ctrlAccount.txtSecurityCode.Text; Boolean codeMatch = false; if (AppLogic.AppConfigBool("Captcha.CaseSensitive")) { if (fCode.Equals(sCode)) { codeMatch = true; } } else { if (fCode.Equals(sCode, StringComparison.InvariantCultureIgnoreCase)) { codeMatch = true; } } if (!codeMatch) { lblErrorMessage.Text = string.Format(AppLogic.GetString("lat_signin_process.aspx.5", SkinID, ThisCustomer.LocaleSetting), sCode, fCode); ctrlAccount.txtSecurityCode.Text = String.Empty; ctrlAccount.imgAccountSecurityImage.ImageUrl = "~/Captcha.ashx?id=1"; ResetScrollPosition(); pnlErrorMsg.Visible = true; return; } } else { lblErrorMessage.Text = string.Format(AppLogic.GetString("lat_signin_process.aspx.5", SkinID, ThisCustomer.LocaleSetting), "", ctrlAccount.txtSecurityCode.Text); ctrlAccount.txtSecurityCode.Text = String.Empty; ctrlAccount.imgAccountSecurityImage.ImageUrl = "~/Captcha.ashx?id=1"; ResetScrollPosition(); pnlErrorMsg.Visible = true; return; } } if (!Page.IsValid && RequireSecurityCode) { Session["SecurityCode"] = CommonLogic.GenerateRandomCode(6); } } Page.Validate("createacccount"); if (Page.IsValid && AccountName.Length > 0) { String EMailField = CommonLogic.IIF(SkipRegistration, txtSkipRegEmail.Text.ToLowerInvariant().Trim(), ctrlAccount.Email.ToLowerInvariant().Trim()); bool NewEmailAllowed = Customer.NewEmailPassesDuplicationRules(EMailField, ThisCustomer.CustomerID, SkipRegistration); String PWD = ViewState["custpwd"].ToString(); Password p = new Password(PWD); String newpwd = p.SaltedPassword; System.Nullable <int> newsaltkey = p.Salt; Password blankpwd = new Password("", ThisCustomer.SaltKey); if (!(ThisCustomer.Password == "" || ThisCustomer.Password == blankpwd.SaltedPassword)) { // do NOT allow passwords to be changed on this page. this is only for creating an account. // if they want to change their password, they must use their account page newpwd = null; newsaltkey = null; } if (NewEmailAllowed) { AppLogic.eventHandler("CreateAccount").CallEvent("&CreateAccount=true"); string strDOB = null; if (AppLogic.AppConfigBool("Account.ShowBirthDateField")) { strDOB = ctrlAccount.DOBMonth + "/" + ctrlAccount.DOBDay + "/" + ctrlAccount.DOBYear; //DOB defaults to 0/0/0 when doing anonymous checkout and blows up dbo.aspdnsf_updCustomer, preventing checkout strDOB = (strDOB.Equals("0/0/0", StringComparison.Ordinal)) ? null : strDOB; } var defaultCustomerLevel_Public = (int)UserType.PUBLIC; ThisCustomer.UpdateCustomer( /*CustomerLevelID*/ defaultCustomerLevel_Public, /*EMail*/ EMailField, /*SaltedAndHashedPassword*/ newpwd, /*SaltKey*/ newsaltkey, /*DateOfBirth*/ strDOB, /*Gender*/ null, /*FirstName*/ ctrlAccount.FirstName, /*LastName*/ ctrlAccount.LastName, /*Notes*/ null, /*SkinID*/ null, /*Phone*/ ctrlAccount.Phone, /*AffiliateID*/ null, /*Referrer*/ null, /*CouponCode*/ null, /*OkToEmail*/ CommonLogic.IIF(ctrlAccount.OKToEmailYes, 1, 0), /*IsAdmin*/ null, /*BillingEqualsShipping*/ CommonLogic.IIF(AppLogic.AppConfigBool("AllowShipToDifferentThanBillTo"), 0, 1), /*LastIPAddress*/ null, /*OrderNotes*/ null, /*SubscriptionExpiresOn*/ null, /*RTShipRequest*/ null, /*RTShipResponse*/ null, /*OrderOptions*/ null, /*LocaleSetting*/ null, /*MicroPayBalance*/ null, /*RecurringShippingMethodID*/ null, /*RecurringShippingMethod*/ null, /*BillingAddressID*/ null, /*ShippingAddressID*/ null, /*GiftRegistryGUID*/ null, /*GiftRegistryIsAnonymous*/ null, /*GiftRegistryAllowSearchByOthers*/ null, /*GiftRegistryNickName*/ null, /*GiftRegistryHideShippingAddresses*/ null, /*CODCompanyCheckAllowed*/ null, /*CODNet30Allowed*/ null, /*ExtensionData*/ null, /*FinalizationData*/ null, /*Deleted*/ null, /*Over13Checked*/ 1, //CommonLogic.IIF(ctrlAccount.Over13 || SkipRegOver13.Checked, 1, 0), /*CurrencySetting*/ null, /*VATSetting*/ null, /*VATRegistrationID*/ null, /*StoreCCInDB*/ CommonLogic.IIF(ctrlAccount.ShowSaveCC, ctrlAccount.SaveCC, true), /*IsRegistered*/ CommonLogic.IIF(SkipRegistration, 0, 1), /*LockedUntil*/ null, /*AdminCanViewCC*/ null, /*BadLogin*/ null, /*Active*/ null, /*PwdChangeRequired*/ null, /*RegisterDate*/ null, /*StoreId*/ AppLogic.StoreID() ); if (ctrlAccount.OKToEmailYes) { AddToNewsletterList(ctrlAccount.FirstName, ctrlAccount.LastName, EMailField); } BillingAddress = ThisCustomer.PrimaryBillingAddress; if (BillingAddress.AddressID == 0 && !checkoutByAmazon.IsCheckingOut) { if (pnlBillingInfo.Visible) { BillingAddress.NickName = ctrlBillingAddress.NickName; BillingAddress.LastName = ctrlBillingAddress.LastName; BillingAddress.FirstName = ctrlBillingAddress.FirstName; BillingAddress.Phone = ctrlBillingAddress.PhoneNumber; BillingAddress.Company = ctrlBillingAddress.Company; BillingAddress.ResidenceType = (ResidenceTypes)Enum.Parse(typeof(ResidenceTypes), ctrlBillingAddress.ResidenceType); BillingAddress.Address1 = ctrlBillingAddress.Address1; BillingAddress.Address2 = ctrlBillingAddress.Address2; BillingAddress.Suite = ctrlBillingAddress.Suite; BillingAddress.City = ctrlBillingAddress.City; BillingAddress.State = ctrlBillingAddress.State; BillingAddress.Zip = ctrlBillingAddress.ZipCode; BillingAddress.Country = ctrlBillingAddress.Country; BillingAddress.InsertDB(ThisCustomer.CustomerID); BillingAddress.MakeCustomersPrimaryAddress(AddressTypes.Billing); } } else { BillingAddress.NickName = String.Format("{0} {1}", ctrlAccount.FirstName, ctrlAccount.LastName); BillingAddress.LastName = ctrlAccount.FirstName; BillingAddress.FirstName = ctrlAccount.LastName; BillingAddress.Phone = ctrlAccount.Phone; } ShippingAddress = ThisCustomer.PrimaryShippingAddress; if (ShippingAddress.AddressID == 0 && !checkoutByAmazon.IsCheckingOut) { if (AllowShipToDifferentThanBillTo) { if (ctrlShippingAddress.Visible) { ShippingAddress.NickName = ctrlBillingAddress.NickName; ShippingAddress.LastName = ctrlShippingAddress.LastName; ShippingAddress.FirstName = ctrlShippingAddress.FirstName; ShippingAddress.Phone = ctrlShippingAddress.PhoneNumber; ShippingAddress.Company = ctrlShippingAddress.Company; ShippingAddress.ResidenceType = (ResidenceTypes)Enum.Parse(typeof(ResidenceTypes), ctrlShippingAddress.ResidenceType); ShippingAddress.Address1 = ctrlShippingAddress.Address1; ShippingAddress.Address2 = ctrlShippingAddress.Address2; ShippingAddress.Suite = ctrlShippingAddress.Suite; ShippingAddress.City = ctrlShippingAddress.City; ShippingAddress.State = ctrlShippingAddress.State; ShippingAddress.Zip = ctrlShippingAddress.ZipCode; ShippingAddress.Country = ctrlShippingAddress.Country; ShippingAddress.InsertDB(ThisCustomer.CustomerID); if (!String.IsNullOrEmpty(VerifyAddressesProvider)) { VerifyResult = AddressValidation.RunValidate(ShippingAddress, out StandardizedAddress); VerifyAddressPrompt = (VerifyResult != AppLogic.ro_OK); if (VerifyAddressPrompt) { ShippingAddress = StandardizedAddress; ShippingAddress.UpdateDB(); } } ShippingAddress.MakeCustomersPrimaryAddress(AddressTypes.Shipping); } } else { if (!String.IsNullOrEmpty(VerifyAddressesProvider)) { VerifyResult = AddressValidation.RunValidate(BillingAddress, out StandardizedAddress); VerifyAddressPrompt = (VerifyResult != AppLogic.ro_OK); if (VerifyAddressPrompt) { BillingAddress = StandardizedAddress; BillingAddress.UpdateDB(); } } BillingAddress.MakeCustomersPrimaryAddress(AddressTypes.Shipping); } } else { ShippingAddress.NickName = String.Format("{0} {1}", ctrlAccount.FirstName, ctrlAccount.LastName); ShippingAddress.LastName = ctrlAccount.FirstName; ShippingAddress.FirstName = ctrlAccount.LastName; ShippingAddress.Phone = ctrlAccount.Phone; } if (AppLogic.AppConfigBool("Vat.Enabled") && ctrlAccount.VATRegistrationID.Length > 0) { String vtr = ctrlAccount.VATRegistrationID.Trim(); Exception vatServiceException = null; if (AppLogic.VATRegistrationIDIsValid(ctrlBillingAddress.Country, vtr, out vatServiceException)) { ThisCustomer.SetVATRegistrationID(vtr); } else { vtr = String.Empty; if (vatServiceException != null && !String.IsNullOrEmpty(vatServiceException.Message)) { if (vatServiceException.Message.Length > 255) { lblErrorMessage.Text = Server.HtmlEncode(vatServiceException.Message.Substring(0, 255)); } else { lblErrorMessage.Text = Server.HtmlEncode(vatServiceException.Message); } } else { lblErrorMessage.Text = "account.aspx.91".StringResource(); } pnlErrorMsg.Visible = true; return; } } if (AppLogic.AppConfigBool("DynamicRelatedProducts.Enabled") || AppLogic.AppConfigBool("RecentlyViewedProducts.Enabled")) { ThisCustomer.ReplaceProductViewFromAnonymous(); } } if (Checkout) { if (!NewEmailAllowed) { lblErrorMessage.Text = AppLogic.GetString("createaccount_process.aspx.1", 1, Localization.GetDefaultLocale()); InitializePageContent(); } else { if (AppLogic.AppConfigBool("SendWelcomeEmail") && EMailField.IndexOf("@") != -1 && ThisCustomer.IsRegistered == true) { // don't let a simple welcome stop checkout! try { string body = AppLogic.RunXmlPackage(AppLogic.AppConfig("XmlPackage.WelcomeEmail"), null, ThisCustomer, this.SkinID, "", "fullname=" + ctrlAccount.FirstName.Trim() + " " + ctrlAccount.LastName.Trim(), false, false, this.EntityHelpers); AppLogic.SendMail(AppLogic.GetString("createaccount.aspx.79", ThisCustomer.SkinID, ThisCustomer.LocaleSetting), body, true, AppLogic.AppConfig("MailMe_FromAddress"), AppLogic.AppConfig("MailMe_FromName"), EMailField, ctrlAccount.FirstName.Trim() + " " + ctrlAccount.LastName.Trim(), "", AppLogic.MailServer()); } catch { } } if (VerifyAddressPrompt) { if (AllowShipToDifferentThanBillTo) { Response.Redirect("address.aspx?Checkout=True&AddressType=Shipping&AddressID=" + Customer.GetCustomerPrimaryShippingAddressID(ThisCustomer.CustomerID).ToString() + "&NewAccount=true&prompt=" + VerifyResult + "&skipreg=" + SkipRegistration + "&returnURL=checkoutshipping.aspx?checkout=true"); } else { Response.Redirect("address.aspx?Checkout=True&AddressType=Billing&AddressID=" + Customer.GetCustomerPrimaryShippingAddressID(ThisCustomer.CustomerID).ToString() + "&NewAccount=true&prompt=" + VerifyResult + "&skipreg=" + SkipRegistration + "&returnURL=checkoutshipping.aspx?checkout=true"); } } else { if (checkouttype == "ppec" || checkouttype == "ppbml" || checkouttype == "gc") { Response.Redirect("shoppingcart.aspx"); } else { Response.Redirect("account.aspx?checkout=true");//checkoutshipping } } } } else { if (!NewEmailAllowed) { DB.ExecuteSQL("update customer set EMail='', IsRegistered = 0 where CustomerID=" + ThisCustomer.CustomerID); lblErrorMessage.Text = AppLogic.GetString("createaccount_process.aspx.1", 1, Localization.GetDefaultLocale()); InitializePageContent(); } else { if (AppLogic.AppConfigBool("SendWelcomeEmail") && EMailField.IndexOf("@") != -1 && ThisCustomer.IsRegistered == true) { // don't let a simple welcome stop checkout! try { string body = AppLogic.RunXmlPackage(AppLogic.AppConfig("XmlPackage.WelcomeEmail"), null, ThisCustomer, this.SkinID, "", "", false, false, this.EntityHelpers); AppLogic.SendMail(AppLogic.GetString("createaccount.aspx.79", ThisCustomer.SkinID, ThisCustomer.LocaleSetting), body, true, AppLogic.AppConfig("MailMe_FromAddress"), AppLogic.AppConfig("MailMe_FromName"), EMailField, ctrlAccount.FirstName.Trim() + " " + ctrlAccount.LastName.Trim(), "", AppLogic.MailServer()); } catch { } } if (VerifyAddressPrompt) { if (AllowShipToDifferentThanBillTo) { Response.Redirect("address.aspx?Checkout=False&AddressType=Shipping&AddressID=" + Customer.GetCustomerPrimaryShippingAddressID(ThisCustomer.CustomerID).ToString() + "&NewAccount=true&prompt=" + VerifyResult + "&skipreg=" + SkipRegistration); } else { Response.Redirect("address.aspx?Checkout=False&AddressType=Billing&AddressID=" + Customer.GetCustomerPrimaryShippingAddressID(ThisCustomer.CustomerID).ToString() + "&NewAccount=true&prompt=" + VerifyResult + "&skipreg=" + SkipRegistration); } } else { Response.Redirect("JWMyAccount.aspx"); } } } } else { foreach (IValidator aValidator in this.Validators) { if (!aValidator.IsValid) { lblErrorMessage.Text = aValidator.ErrorMessage; break; } } ResetScrollPosition(); } pnlErrorMsg.Visible = lblErrorMessage.Text.Length > 0; }