/// <summary> /// Updates user data. /// </summary> /// <param name="sender">Source of this event.</param> /// <param name="e">Arguments of this event.</param> protected void UpdateButton_Click(object sender, EventArgs e) { ISecurityProvider provider = null; try { provider = SecurityProviderCache.CurrentProvider; if (provider.CanUpdateData) { provider.UserData.FirstName = AccountUserFirstName.Text; provider.UserData.LastName = AccountUserLastName.Text; provider.UserData.EmailAddress = AccountUserEmailAddress.Text; provider.UserData.PhoneNumber = AccountUserPhoneNumber.Text; provider.UserData.SecurityAnswer = AccountUserSecurityAnswer.Text; provider.UpdateData(); ShowMessage("Information has been updated successfully!", false); } else { ShowMessage("Account does not support updating of information.", true); } } catch (SecurityException ex) { // Show security related error messages. ShowMessage(ex.Message.EnsureEnd('.'), true); } catch (Exception ex) { // Show ambiguous message for other errors. ShowMessage("Update failed due to an unexpected error.", true); System.Diagnostics.Trace.WriteLine(string.Format("Update information error: \r\n {0}", ex)); } finally { ShowUserData(provider); } }