Esempio n. 1
0
        public override int GetHashCode()
        {
            int result = 1;

            result = (result * 397) ^ (Comment != null ? Comment.GetHashCode() : 0);
            result = (result * 397) ^ (Email != null ? Email.GetHashCode() : 0);
            result = (result * 397) ^ (FailedPasswordAttemptsCount != null ? FailedPasswordAttemptsCount.GetHashCode() : 0);
            result = (result * 397) ^ (FailedPasswordAttemptWindowStart != null ? FailedPasswordAttemptWindowStart.GetHashCode() : 0);
            result = (result * 397) ^ Id.GetHashCode();
            result = (result * 397) ^ IsApproved.GetHashCode();
            result = (result * 397) ^ IsFirstTimeUser.GetHashCode();
            result = (result * 397) ^ IsLockedOut.GetHashCode();
            result = (result * 397) ^ (LastActivityDate != null ? LastActivityDate.GetHashCode() : 0);
            result = (result * 397) ^ (LastLoginDate != null ? LastLoginDate.GetHashCode() : 0);
            result = (result * 397) ^ (LastPasswordChangeDate != null ? LastPasswordChangeDate.GetHashCode() : 0);
            result = (result * 397) ^ (Password != null ? Password.GetHashCode() : 0);
            result = (result * 397) ^ (PasswordKey != null ? PasswordKey.GetHashCode() : 0);
            result = (result * 397) ^ (Username != null ? Username.GetHashCode() : 0);
            result = (result * 397) ^ UserType.GetHashCode();
            return(result);
        }
        /// <summary>
        /// Determines whether the specified Object is equal to the current Object.
        /// </summary>
        /// <param name="obj"></param>
        /// <returns></returns>
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }
            if (Object.ReferenceEquals(this, obj))
            {
                return(true);
            }
            if (this.GetType() != obj.GetType())
            {
                return(false);
            }


            var other = (VLCredential)obj;

            //reference types
            if (!Object.Equals(LogOnToken, other.LogOnToken))
            {
                return(false);
            }
            if (!Object.Equals(PswdToken, other.PswdToken))
            {
                return(false);
            }
            if (!Object.Equals(PswdSalt, other.PswdSalt))
            {
                return(false);
            }
            if (!Object.Equals(PswdQuestion, other.PswdQuestion))
            {
                return(false);
            }
            if (!Object.Equals(PswdAnswer, other.PswdAnswer))
            {
                return(false);
            }
            if (!Object.Equals(Comment, other.Comment))
            {
                return(false);
            }
            //value types
            if (!CredentialId.Equals(other.CredentialId))
            {
                return(false);
            }
            if (!Principal.Equals(other.Principal))
            {
                return(false);
            }
            if (!PrincipalType.Equals(other.PrincipalType))
            {
                return(false);
            }
            if (!PswdFormat.Equals(other.PswdFormat))
            {
                return(false);
            }
            if (!IsApproved.Equals(other.IsApproved))
            {
                return(false);
            }
            if (!IsLockedOut.Equals(other.IsLockedOut))
            {
                return(false);
            }
            if (!LastLoginDate.Equals(other.LastLoginDate))
            {
                return(false);
            }
            if (!LastPasswordChangedDate.Equals(other.LastPasswordChangedDate))
            {
                return(false);
            }
            if (!LastLockoutDate.Equals(other.LastLockoutDate))
            {
                return(false);
            }
            if (!FailedPasswordAttemptCount.Equals(other.FailedPasswordAttemptCount))
            {
                return(false);
            }
            if (!FailedPasswordAttemptWindowStart.Equals(other.FailedPasswordAttemptWindowStart))
            {
                return(false);
            }
            if (!FailedPasswordAnswerAttemptCount.Equals(other.FailedPasswordAnswerAttemptCount))
            {
                return(false);
            }
            if (!FailedPasswordAnswerAttemptWindowStart.Equals(other.FailedPasswordAnswerAttemptWindowStart))
            {
                return(false);
            }

            return(true);
        }