Exemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="User" /> class.
        /// </summary>
        /// <param name="Id">A system-generated unique identifier for a User (required).</param>
        /// <param name="GivenName">Given name of the user. (required).</param>
        /// <param name="Surname">Surname of the user. (required).</param>
        /// <param name="Active">A flag indicating the User is active in the system. Set false to remove access to the system for the user. (required).</param>
        /// <param name="Initials">Initials of the user, to be presented where screen space is at a premium..</param>
        /// <param name="Email">The email address of the user in the system..</param>
        /// <param name="SmUserId">Security Manager User ID.</param>
        /// <param name="Guid">The GUID unique to the user as provided by the authentication system. In this case, authentication is done by Siteminder and the GUID uniquely identifies the user within the user directories managed by Siteminder - e.g. IDIR and BCeID. The GUID is equivalent to the IDIR Id, but is guaranteed unique to a person, while the IDIR ID is not - IDIR IDs can be recycled..</param>
        /// <param name="SmAuthorizationDirectory">The user directory service used by Siteminder to authenticate the user - usually IDIR or BCeID..</param>
        /// <param name="UserRoles">UserRoles.</param>
        /// <param name="GroupMemberships">GroupMemberships.</param>
        /// <param name="District">The District that the User belongs to.</param>
        public User(int Id, string GivenName, string Surname, bool Active, string Initials = null, string Email = null, string SmUserId = null, string Guid = null, string SmAuthorizationDirectory = null, List <UserRole> UserRoles = null, List <GroupMembership> GroupMemberships = null, District District = null)
        {
            this.Id        = Id;
            this.GivenName = GivenName;
            this.Surname   = Surname;
            this.Active    = Active;



            this.Initials = Initials;
            this.Email    = Email;
            this.SmUserId = SmUserId;
            this.Guid     = Guid;
            this.SmAuthorizationDirectory = SmAuthorizationDirectory;
            this.UserRoles        = UserRoles;
            this.GroupMemberships = GroupMemberships;
            this.District         = District;
        }
Exemplo n.º 2
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 + Id.GetHashCode();

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

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

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

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

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

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

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

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

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

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

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

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

                return(hash);
            }
        }
Exemplo 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 + Id.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 (Guid != null)
                {
                    hash = hash * 59 + Guid.GetHashCode();
                }

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

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

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

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

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

            return
                ((
                     Id == other.Id ||
                     Id.Equals(other.Id)
                     ) &&
                 (
                     District == other.District ||
                     District != null &&
                     District.Equals(other.District)
                 ) &&
                 (
                     Name == other.Name ||
                     Name != null &&
                     Name.Equals(other.Name)
                 ) &&
                 (
                     Status == other.Status ||
                     Status != null &&
                     Status.Equals(other.Status)
                 ) &&
                 (
                     ProvincialProjectNumber == other.ProvincialProjectNumber ||
                     ProvincialProjectNumber != null &&
                     ProvincialProjectNumber.Equals(other.ProvincialProjectNumber)
                 ) &&
                 (
                     Information == other.Information ||
                     Information != null &&
                     Information.Equals(other.Information)
                 ) &&
                 (
                     RentalRequests == other.RentalRequests ||
                     RentalRequests != null &&
                     RentalRequests.SequenceEqual(other.RentalRequests)
                 ) &&
                 (
                     RentalAgreements == other.RentalAgreements ||
                     RentalAgreements != null &&
                     RentalAgreements.SequenceEqual(other.RentalAgreements)
                 ) &&
                 (
                     PrimaryContact == other.PrimaryContact ||
                     PrimaryContact != null &&
                     PrimaryContact.Equals(other.PrimaryContact)
                 ) &&
                 (
                     Contacts == other.Contacts ||
                     Contacts != null &&
                     Contacts.SequenceEqual(other.Contacts)
                 ) &&
                 (
                     Notes == other.Notes ||
                     Notes != null &&
                     Notes.SequenceEqual(other.Notes)
                 ) &&
                 (
                     Attachments == other.Attachments ||
                     Attachments != null &&
                     Attachments.SequenceEqual(other.Attachments)
                 ) &&
                 (
                     History == other.History ||
                     History != null &&
                     History.SequenceEqual(other.History)
                 ));
        }
Exemplo n.º 5
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)
                 ) &&
                 (
                     GroupMemberships == other.GroupMemberships ||
                     GroupMemberships != null &&
                     GroupMemberships.SequenceEqual(other.GroupMemberships)
                 ) &&
                 (
                     District == other.District ||
                     District != null &&
                     District.Equals(other.District)
                 ));
        }