Ejemplo n.º 1
0
        // /// <summary>
        // /// Returns the string presentation of the object
        // /// </summary>
        // /// <returns>String presentation of the object</returns>
        // public override string ToString()
        // {
        //  var sb = new StringBuilder();

        //  sb.Append("class User {\n");
        //  sb.Append("  Id: ").Append(ContactId).Append("\n");
        //  sb.Append("  GivenName: ").Append(GivenName).Append("\n");
        //  sb.Append("  Surname: ").Append(Surname).Append("\n");
        //  sb.Append("  Active: ").Append(Active).Append("\n");
        //  sb.Append("  Initials: ").Append(Initials).Append("\n");
        //  sb.Append("  Email: ").Append(Email).Append("\n");
        //  sb.Append("  SmUserId: ").Append(SmUserId).Append("\n");
        //  sb.Append("  Guid: ").Append(AccountId).Append("\n");
        //  sb.Append("  SmAuthorizationDirectory: ").Append(UserType).Append("\n");
        //  sb.Append("  UserRoles: ").Append(UserRoles).Append("\n");
        //  sb.Append("}\n");

        //  return sb.ToString();
        // }

        // /// <summary>
        // /// Returns the JSON string presentation of the object
        // /// </summary>
        // /// <returns>JSON string presentation of the object</returns>
        // public string ToJson()
        // {
        //  return JsonConvert.SerializeObject(this, Formatting.Indented);
        // }

        // /// <summary>
        // /// Returns true if objects are equal
        // /// </summary>
        // /// <param name="obj">Object to be compared</param>
        // /// <returns>Boolean</returns>
        // public override bool Equals(object obj)
        // {
        //  if (obj is null) { return false; }
        //  if (ReferenceEquals(this, obj)) { return true; }
        //  return obj.GetType() == GetType() && Equals((User)obj);
        // }

        /// <summary>
        /// Returns true if User instances are equal
        /// </summary>
        /// <param name="other">Instance of User to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(User other)
        {
            if (other is null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return((
                       ContactId == other.ContactId ||
                       ContactId.Equals(other.ContactId)
                       ) &&
                   (
                       GivenName == other.GivenName ||
                       GivenName != null &&
                       GivenName.Equals(other.GivenName)
                   ) &&
                   (
                       Surname == other.Surname ||
                       Surname != null &&
                       Surname.Equals(other.Surname)
                   ) &&
                   (
                       Active == other.Active ||
                       Active.Equals(other.Active)
                   ) &&
                   (
                       Initials == other.Initials ||
                       Initials != null &&
                       Initials.Equals(other.Initials)
                   ) &&
                   (
                       Email == other.Email ||
                       Email != null &&
                       Email.Equals(other.Email)
                   ) &&
                   (
                       SmUserId == other.SmUserId ||
                       SmUserId != null &&
                       SmUserId.Equals(other.SmUserId)
                   ) &&
                   (
                       AccountId == other.AccountId ||
                       AccountId != null &&
                       AccountId.Equals(other.AccountId)
                   ) &&
                   (
                       UserType == other.UserType ||
                       UserType != null &&
                       UserType.Equals(other.UserType)
                   ) &&
                   (
                       UserRoles == other.UserRoles ||
                       UserRoles != null &&
                       UserRoles.SequenceEqual(other.UserRoles)
                   ));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Returns true if CurrentUserViewModel instances are equal
        /// </summary>
        /// <param name="other">Instance of CurrentUserViewModel to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(CurrentUserViewModel other)
        {
            if (other is null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Id == other.Id ||
                     Id != null &&
                     Id.Equals(other.Id)
                     ) &&
                 (
                     GivenName == other.GivenName ||
                     GivenName != null &&
                     GivenName.Equals(other.GivenName)
                 ) &&
                 (
                     Surname == other.Surname ||
                     Surname != null &&
                     Surname.Equals(other.Surname)
                 ) &&
                 (
                     Email == other.Email ||
                     Email != null &&
                     Email.Equals(other.Email)
                 ) &&
                 (
                     Active == other.Active ||
                     Active != null &&
                     Active.Equals(other.Active)
                 ) &&
                 (
                     SmUserId == other.SmUserId ||
                     SmUserId != null &&
                     SmUserId.Equals(other.SmUserId)
                 ) &&
                 (
                     SmAuthorizationDirectory == other.SmAuthorizationDirectory ||
                     SmAuthorizationDirectory != null &&
                     SmAuthorizationDirectory.Equals(other.SmAuthorizationDirectory)
                 ) &&
                 (
                     UserRoles == other.UserRoles ||
                     UserRoles != null &&
                     UserRoles.SequenceEqual(other.UserRoles)
                 ) &&
                 (
                     District == other.District ||
                     District != null &&
                     District.Equals(other.District)
                 ));
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Gets the hash code
        /// </summary>
        /// <returns>Hash code</returns>
        public override int GetHashCode()
        {
            // credit: http://stackoverflow.com/a/263416/677735
            unchecked             // Overflow is fine, just wrap
            {
                int hash = 41;

                // Suitable nullity checks
                hash = hash * 59 + ContactId.GetHashCode();

                if (GivenName != null)
                {
                    hash = hash * 59 + GivenName.GetHashCode();
                }

                if (Surname != null)
                {
                    hash = hash * 59 + Surname.GetHashCode();
                }

                hash = hash * 59 + Active.GetHashCode();

                if (Initials != null)
                {
                    hash = hash * 59 + Initials.GetHashCode();
                }

                if (Email != null)
                {
                    hash = hash * 59 + Email.GetHashCode();
                }

                if (SmUserId != null)
                {
                    hash = hash * 59 + SmUserId.GetHashCode();
                }

                if (AccountId != null)
                {
                    hash = hash * 59 + AccountId.GetHashCode();
                }

                if (UserType != null)
                {
                    hash = hash * 59 + UserType.GetHashCode();
                }

                if (UserRoles != null)
                {
                    hash = hash * 59 + UserRoles.GetHashCode();
                }


                return(hash);
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Gets the hash code
        /// </summary>
        /// <returns>Hash code</returns>
        public override int GetHashCode()
        {
            // credit: http://stackoverflow.com/a/263416/677735
            unchecked // Overflow is fine, just wrap
            {
                int hash = 41;

                // Suitable nullity checks
                if (Id != null)
                {
                    hash = hash * 59 + Id.GetHashCode();
                }

                if (GivenName != null)
                {
                    hash = hash * 59 + GivenName.GetHashCode();
                }

                if (Surname != null)
                {
                    hash = hash * 59 + Surname.GetHashCode();
                }

                if (Email != null)
                {
                    hash = hash * 59 + Email.GetHashCode();
                }

                if (Active != null)
                {
                    hash = hash * 59 + Active.GetHashCode();
                }

                if (SmUserId != null)
                {
                    hash = hash * 59 + SmUserId.GetHashCode();
                }

                if (SmAuthorizationDirectory != null)
                {
                    hash = hash * 59 + SmAuthorizationDirectory.GetHashCode();
                }

                if (UserRoles != null)
                {
                    hash = hash * 59 + UserRoles.GetHashCode();
                }

                if (District != null)
                {
                    hash = hash * 59 + District.GetHashCode();
                }

                return(hash);
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Returns true if UserViewModel instances are equal
        /// </summary>
        /// <param name="other">Instance of UserViewModel to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(UserViewModel other)
        {
            if (other is null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Id == other.Id ||
                     Id.Equals(other.Id)
                     ) &&
                 (
                     Active == other.Active ||
                     Active.Equals(other.Active)
                 ) &&
                 (
                     GivenName == other.GivenName ||
                     GivenName != null &&
                     GivenName.Equals(other.GivenName)
                 ) &&
                 (
                     Surname == other.Surname ||
                     Surname != null &&
                     Surname.Equals(other.Surname)
                 ) &&
                 (
                     Email == other.Email ||
                     Email != null &&
                     Email.Equals(other.Email)
                 ) &&
                 (
                     SmUserId == other.SmUserId ||
                     SmUserId != null &&
                     SmUserId.Equals(other.SmUserId)
                 ) &&
                 (
                     UserRoles == other.UserRoles ||
                     UserRoles != null &&
                     UserRoles.SequenceEqual(other.UserRoles)
                 ) &&
                 (
                     GroupMemberships == other.GroupMemberships ||
                     GroupMemberships != null &&
                     GroupMemberships.SequenceEqual(other.GroupMemberships)
                 ) &&
                 (
                     District == other.District ||
                     District != null &&
                     District.Equals(other.District)
                 ));
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Returns true if User instances are equal
        /// </summary>
        /// <param name="other">Instance of User to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(User other)
        {
            if (other is null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Id == other.Id ||
                     Id.Equals(other.Id)
                     ) &&
                 (
                     GivenName == other.GivenName ||
                     GivenName != null &&
                     GivenName.Equals(other.GivenName)
                 ) &&
                 (
                     Surname == other.Surname ||
                     Surname != null &&
                     Surname.Equals(other.Surname)
                 ) &&
                 (
                     Active == other.Active ||
                     Active.Equals(other.Active)
                 ) &&
                 (
                     Initials == other.Initials ||
                     Initials != null &&
                     Initials.Equals(other.Initials)
                 ) &&
                 (
                     Email == other.Email ||
                     Email != null &&
                     Email.Equals(other.Email)
                 ) &&
                 (
                     SmUserId == other.SmUserId ||
                     SmUserId != null &&
                     SmUserId.Equals(other.SmUserId)
                 ) &&
                 (
                     Guid == other.Guid ||
                     Guid != null &&
                     Guid.Equals(other.Guid)
                 ) &&
                 (
                     SmAuthorizationDirectory == other.SmAuthorizationDirectory ||
                     SmAuthorizationDirectory != null &&
                     SmAuthorizationDirectory.Equals(other.SmAuthorizationDirectory)
                 ) &&
                 (
                     UserRoles == other.UserRoles ||
                     UserRoles != null &&
                     UserRoles.SequenceEqual(other.UserRoles)
                 ));
        }