private bool ValidateData() { ErrorOldEmail = string.IsNullOrEmpty(OldEmail) ? AppResources.MailRequired : string.Empty; ErrorNewEmail = string.IsNullOrEmpty(NewEmail) ? AppResources.MailRequired : string.Empty; ErrorConfirmEmail = string.IsNullOrEmpty(ConfirmEmail) ? AppResources.MailRequired : string.Empty; if (string.IsNullOrEmpty(ErrorOldEmail) && string.IsNullOrEmpty(ErrorNewEmail) && string.IsNullOrEmpty(ErrorConfirmEmail)) { ErrorOldEmail = ValidatorHelper.IsValidEmail(OldEmail) ? string.Empty : AppResources.WriteValidEmail; ErrorNewEmail = ValidatorHelper.IsValidEmail(NewEmail) ? string.Empty : AppResources.WriteValidEmail; ErrorConfirmEmail = ValidatorHelper.IsValidEmail(ConfirmEmail) ? string.Empty : AppResources.WriteValidEmail; if (string.IsNullOrEmpty(ErrorOldEmail)) { ErrorOldEmail = OldEmail.Equals(ServiceLocator.Current.GetInstance <ILoginViewModel>().User.UserName) ? string.Empty : AppResources.EmailCurrentError; } if (string.IsNullOrEmpty(ErrorNewEmail) && string.IsNullOrEmpty(ErrorConfirmEmail)) { ErrorConfirmEmail = ConfirmEmail.Equals(NewEmail) ? string.Empty : AppResources.EmailEqualError; } } else { return(false); } return(string.IsNullOrEmpty(ErrorOldEmail) && string.IsNullOrEmpty(ErrorNewEmail) && string.IsNullOrEmpty(ErrorConfirmEmail)); }
/// <summary> /// Gets the hash code /// </summary> /// <returns>Hash code</returns> public override int GetHashCode() { unchecked // Overflow is fine, just wrap { var hashCode = 41; // Suitable nullity checks etc, of course :) if (OldEmail != null) { hashCode = hashCode * 59 + OldEmail.GetHashCode(); } if (NewEmail != null) { hashCode = hashCode * 59 + NewEmail.GetHashCode(); } if (FirstName != null) { hashCode = hashCode * 59 + FirstName.GetHashCode(); } if (LastName != null) { hashCode = hashCode * 59 + LastName.GetHashCode(); } if (IsActive != null) { hashCode = hashCode * 59 + IsActive.GetHashCode(); } return(hashCode); } }
public ChangeEmailCommand(Customer customer, string newEmail) { if (OldEmail?.ToLower() == newEmail.ToLower()) { return; } OldEmail = customer.Email.ToLower(); NewEmail = newEmail.ToLower(); customer.Email = NewEmail; Success(); }
/// <summary> /// Returns true if UpdateInstructorRequest instances are equal /// </summary> /// <param name="other">Instance of UpdateInstructorRequest to be compared</param> /// <returns>Boolean</returns> public bool Equals(UpdateInstructorRequest other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( OldEmail == other.OldEmail || OldEmail != null && OldEmail.Equals(other.OldEmail) ) && ( NewEmail == other.NewEmail || NewEmail != null && NewEmail.Equals(other.NewEmail) ) && ( FirstName == other.FirstName || FirstName != null && FirstName.Equals(other.FirstName) ) && ( LastName == other.LastName || LastName != null && LastName.Equals(other.LastName) ) && ( IsActive == other.IsActive || IsActive != null && IsActive.Equals(other.IsActive) )); }