public void btnUpdateAccount_Click(object sender, EventArgs e) { ctrlAccount.PasswordValidate = ctrlAccount.Password; ctrlAccount.PasswordConfirmValidate = ctrlAccount.PasswordConfirm; ctrlAccount.Over13 = ctrlAccount.Over13; lblErrorMessage.Text = String.Empty; pnlErrorMsg.Visible = false; Page.Validate("account"); if (Page.IsValid) { String EMailField = ctrlAccount.Email.ToLowerInvariant().Trim(); NewEmailAddressAllowed = Customer.NewEmailPassesDuplicationRules(EMailField, ThisCustomer.CustomerID, false); bool emailisvalid = new EmailAddressValidator().IsValidEmailAddress(EMailField); if (!emailisvalid) { lblAcctUpdateMsg.Text = AppLogic.GetString("createaccount.aspx.17", SkinID, ThisCustomer.LocaleSetting); } if (!NewEmailAddressAllowed || !emailisvalid) { EMailField = ThisCustomer.EMail; // preserve the old email but go ahead and update their account with other changes below } string pwd = null; object saltkey = null; if (ctrlAccount.Password.Trim().Length > 0) { Password p = new Password(ctrlAccount.Password); pwd = p.SaltedPassword; saltkey = p.Salt; } bool HasActiveRecurring = ThisCustomer.HasActiveRecurringOrders(true); ctrlAccount.ShowSaveCCNote = false; if (!ctrlAccount.SaveCC && (HasActiveRecurring && !AppLogic.AppConfigBool("Recurring.UseGatewayInternalBilling"))) { ctrlAccount.SaveCC = true; ctrlAccount.ShowSaveCCNote = true; } String vtr = ctrlAccount.VATRegistrationID; if (!AppLogic.AppConfigBool("VAT.Enabled")) { vtr = null; ctrlAccount.ShowVATRegistrationIDInvalid = false; ctrlAccount.VATRegistrationID = String.Empty; } else { Exception vatServiceException; Boolean vatIsValid = AppLogic.VATRegistrationIDIsValid(ThisCustomer, vtr, out vatServiceException); if (ctrlAccount.VATRegistrationID.Length == 0 || vatIsValid) { ctrlAccount.ShowVATRegistrationIDInvalid = false; } else { if (vatServiceException != null && vatServiceException.Message.Length > 0) { 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 = lblErrorMessage.Text.Length > 0; vtr = null; ctrlAccount.ShowVATRegistrationIDInvalid = true; ctrlAccount.VATRegistrationID = String.Empty; } } string strDOB = null; if (AppLogic.AppConfigBool("Account.ShowBirthDateField")) { strDOB = ctrlAccount.DOBMonth + "/" + ctrlAccount.DOBDay + "/" + ctrlAccount.DOBYear; } ThisCustomer.UpdateCustomer( /*CustomerLevelID*/ null, /*EMail*/ EMailField, /*SaltedAndHashedPassword*/ pwd, /*SaltKey*/ saltkey, /*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*/ null, /*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*/ vtr, /*StoreCCInDB*/ CommonLogic.IIF(ctrlAccount.SaveCC, 1, 0), /*IsRegistered*/ null, /*LockedUntil*/ null, /*AdminCanViewCC*/ null, /*BadLogin*/ null, /*Active*/ null, /*PwdChangeRequired*/ null, /*RegisterDate*/ null, /*StoreId*/ null ); AccountUpdated = true; } RefreshPage(); }