I am working on a custom validator that needs to fail if either an email address or username haven't changed. Essentially if one of the string comparisons are true then it will pass the validation. I know I'm overlooking something simple. Here is what I have so far:
bool emailChanged = Domain.Validation.ItemsHaveChanged(txtEmailAddress.Text, emailAddress);
bool userNameChanged = Domain.Validation.ItemsHaveChanged(txtUserName.Text, userName);
// make sure at least the email or username has changed.
if (!emailChanged || !userNameChanged)
{
args.IsValid = false;
cvAccountChange.ErrorMessage = "There haven't been any changes to the account.";
}
Here is the method ItemsHaveChanged
public static bool ItemsHaveChanged(string param1, string param2)
{
return string.Compare(param1.Trim(), param2.Trim()) != 0;
}