示例#1
0
        protected override void deserialize(PowerPlannerSending.BaseItem item, List <PropertyNames> changedProperties)
        {
            Teacher from = item as Teacher;

            if (changedProperties != null)
            {
                if (!EmailAddresses.SequenceEqual(from.EmailAddresses))
                {
                    changedProperties.Add(BaseItemWin.PropertyNames.EmailAddresses);
                }

                if (!OfficeLocations.SequenceEqual(from.OfficeLocations))
                {
                    changedProperties.Add(BaseItemWin.PropertyNames.OfficeLocations);
                }

                if (!PhoneNumbers.SequenceEqual(from.PhoneNumbers))
                {
                    changedProperties.Add(BaseItemWin.PropertyNames.PhoneNumbers);
                }

                if (!PostalAddresses.SequenceEqual(from.PostalAddresses))
                {
                    changedProperties.Add(BaseItemWin.PropertyNames.PostalAddresses);
                }
            }

            this.EmailAddresses  = from.EmailAddresses;
            this.OfficeLocations = from.OfficeLocations;
            this.PhoneNumbers    = from.PhoneNumbers;
            this.PostalAddresses = from.PostalAddresses;

            //guaranteed that upper temp and perm will be -1
            base.deserialize(from, changedProperties);
        }
        /// <summary>
        /// Returns true if CommonPersonDetail instances are equal
        /// </summary>
        /// <param name="other">Instance of CommonPersonDetail to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(CommonPersonDetail other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     PhoneNumbers == other.PhoneNumbers ||
                     PhoneNumbers != null &&
                     PhoneNumbers.SequenceEqual(other.PhoneNumbers)
                     ) &&
                 (
                     EmailAddresses == other.EmailAddresses ||
                     EmailAddresses != null &&
                     EmailAddresses.SequenceEqual(other.EmailAddresses)
                 ) &&
                 (
                     PhysicalAddresses == other.PhysicalAddresses ||
                     PhysicalAddresses != null &&
                     PhysicalAddresses.SequenceEqual(other.PhysicalAddresses)
                 ));
        }