public override int GetHashCode()
        {
            int hash = 1;

            if (entityId_ != null)
            {
                hash ^= EntityId.GetHashCode();
            }
            if (UserId.Length != 0)
            {
                hash ^= UserId.GetHashCode();
            }
            if (Password.Length != 0)
            {
                hash ^= Password.GetHashCode();
            }
            if (DisplayName.Length != 0)
            {
                hash ^= DisplayName.GetHashCode();
            }
            if (EmergencyContactPhoneNumber.Length != 0)
            {
                hash ^= EmergencyContactPhoneNumber.GetHashCode();
            }
            if (IsPhoneDataDisplayable != false)
            {
                hash ^= IsPhoneDataDisplayable.GetHashCode();
            }
            if (dateHired_ != null)
            {
                hash ^= DateHired.GetHashCode();
            }
            if (IsActive != false)
            {
                hash ^= IsActive.GetHashCode();
            }
            if (department_ != null)
            {
                hash ^= Department.GetHashCode();
            }
            if (DepartmentName.Length != 0)
            {
                hash ^= DepartmentName.GetHashCode();
            }
            if (contactInfo_ != null)
            {
                hash ^= ContactInfo.GetHashCode();
            }
            if (IsIncluded != false)
            {
                hash ^= IsIncluded.GetHashCode();
            }
            return(hash);
        }
Exemplo n.º 2
0
        private Dictionary <string, List <ContactInfo> > GetContactListMap(IEnumerable <Contact> contacts)
        {
            int count      = 0;
            int duplicates = 0;
            Dictionary <string, List <ContactInfo> > contactListMap = null;

            if (contacts == null)
            {
                return(null);
            }
            contactListMap = new Dictionary <string, List <ContactInfo> >();
            foreach (Contact cn in contacts)
            {
                CompleteName cName = cn.CompleteName;

                foreach (ContactPhoneNumber ph in cn.PhoneNumbers)
                {
                    if (string.IsNullOrWhiteSpace(ph.PhoneNumber)) // if no phone number simply ignore the contact
                    {
                        count++;
                        continue;
                    }
                    ContactInfo cInfo = new ContactInfo(null, cn.DisplayName.Trim(), ph.PhoneNumber);
                    int         idd   = cInfo.GetHashCode();
                    cInfo.Id    = Convert.ToString(Math.Abs(idd));
                    contactInfo = cInfo;
                    if (contactListMap.ContainsKey(cInfo.Id))
                    {
                        if (!contactListMap[cInfo.Id].Contains(cInfo))
                        {
                            contactListMap[cInfo.Id].Add(cInfo);
                        }
                        else
                        {
                            duplicates++;
                            Debug.WriteLine("Duplicate Contact !! for Phone Number {0}", cInfo.PhoneNo);
                        }
                    }
                    else
                    {
                        List <ContactInfo> contactList = new List <ContactInfo>();
                        contactList.Add(cInfo);
                        contactListMap.Add(cInfo.Id, contactList);
                    }
                }
            }
            Debug.WriteLine("Total duplicate contacts : {0}", duplicates);
            Debug.WriteLine("Total contacts with no phone number : {0}", count);
            return(contactListMap);
        }
        public override int GetHashCode()
        {
            int hash = 1;

            if (entityId_ != null)
            {
                hash ^= EntityId.GetHashCode();
            }
            if (contactInfo_ != null)
            {
                hash ^= ContactInfo.GetHashCode();
            }
            if (IsBlacklisted != false)
            {
                hash ^= IsBlacklisted.GetHashCode();
            }
            return(hash);
        }
        public override int GetHashCode()
        {
            int hash = 1;

            if (entityId_ != null)
            {
                hash ^= EntityId.GetHashCode();
            }
            if (Name.Length != 0)
            {
                hash ^= Name.GetHashCode();
            }
            if (GroupType != 0)
            {
                hash ^= GroupType.GetHashCode();
            }
            if (GroupNumber.Length != 0)
            {
                hash ^= GroupNumber.GetHashCode();
            }
            if (creditLimit_ != null)
            {
                hash ^= CreditLimit.GetHashCode();
            }
            if (Active != false)
            {
                hash ^= Active.GetHashCode();
            }
            if (contactInfo_ != null)
            {
                hash ^= ContactInfo.GetHashCode();
            }
            if (property_ != null)
            {
                hash ^= Property.GetHashCode();
            }
            return(hash);
        }
Exemplo n.º 5
0
 /// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         int hashCode = 41;
         if (FileId != null)
         {
             hashCode = hashCode * 59 + FileId.GetHashCode();
         }
         if (CertificateData != null)
         {
             hashCode = hashCode * 59 + CertificateData.GetHashCode();
         }
         if (CertificatePassword != null)
         {
             hashCode = hashCode * 59 + CertificatePassword.GetHashCode();
         }
         hashCode = hashCode * 59 + SignatureMode.GetHashCode();
         hashCode = hashCode * 59 + SignatureCertificationLevel.GetHashCode();
         hashCode = hashCode * 59 + SignatureHashAlgorithm.GetHashCode();
         if (SignerName != null)
         {
             hashCode = hashCode * 59 + SignerName.GetHashCode();
         }
         if (Reason != null)
         {
             hashCode = hashCode * 59 + Reason.GetHashCode();
         }
         if (Location != null)
         {
             hashCode = hashCode * 59 + Location.GetHashCode();
         }
         if (ContactInfo != null)
         {
             hashCode = hashCode * 59 + ContactInfo.GetHashCode();
         }
         if (TimeStampURL != null)
         {
             hashCode = hashCode * 59 + TimeStampURL.GetHashCode();
         }
         if (TimeStampUserName != null)
         {
             hashCode = hashCode * 59 + TimeStampUserName.GetHashCode();
         }
         if (TimeStampPassword != null)
         {
             hashCode = hashCode * 59 + TimeStampPassword.GetHashCode();
         }
         hashCode = hashCode * 59 + Linearize.GetHashCode();
         hashCode = hashCode * 59 + DrawSignature.GetHashCode();
         hashCode = hashCode * 59 + PageNumber.GetHashCode();
         hashCode = hashCode * 59 + ShowValidationMark.GetHashCode();
         if (ImageData != null)
         {
             hashCode = hashCode * 59 + ImageData.GetHashCode();
         }
         if (SignatureLayout != null)
         {
             hashCode = hashCode * 59 + SignatureLayout.GetHashCode();
         }
         if (SignatureText != null)
         {
             hashCode = hashCode * 59 + SignatureText.GetHashCode();
         }
         return(hashCode);
     }
 }
Exemplo n.º 6
0
        public static Dictionary <string, List <ContactInfo> > getContactsListMap(IEnumerable <Contact> contacts)
        {
            int count      = 0;
            int duplicates = 0;
            Dictionary <string, List <ContactInfo> > contactListMap = null;

            if (contacts == null)
            {
                return(null);
            }
            contactListMap = new Dictionary <string, List <ContactInfo> >();

            foreach (Contact cn in contacts)
            {
                try
                {
                    foreach (ContactPhoneNumber ph in cn.PhoneNumbers)
                    {
                        try
                        {
                            if (string.IsNullOrWhiteSpace(ph.PhoneNumber)) // if no phone number simply ignore the contact
                            {
                                count++;
                                continue;
                            }
                            ContactInfo cInfo = new ContactInfo(null, cn.DisplayName.Trim(), ph.PhoneNumber);
                            int         idd   = cInfo.GetHashCode();
                            cInfo.Id = Convert.ToString(Math.Abs(idd));

                            if (contactListMap.ContainsKey(cInfo.Id))
                            {
                                if (!contactListMap[cInfo.Id].Contains(cInfo))
                                {
                                    contactListMap[cInfo.Id].Add(cInfo);
                                }
                                else
                                {
                                    duplicates++;
                                    Debug.WriteLine("Duplicate Contact !! for Phone Number {0}", cInfo.PhoneNo);
                                }
                            }
                            else
                            {
                                List <ContactInfo> contactList = new List <ContactInfo>();
                                contactList.Add(cInfo);
                                contactListMap.Add(cInfo.Id, contactList);
                            }
                        }
                        catch (Exception ex)
                        {
                            Debug.WriteLine("ContactUtils : getContactsListMap(Inner loop) : Exception : " + ex.StackTrace);
                        }
                    }
                }
                catch (Exception e)
                {
                    Debug.WriteLine("ContactUtils : getContactsListMap(Outer loop) : Exception : " + e.StackTrace);
                }
            }
            Debug.WriteLine("Total duplicate contacts : {0}", duplicates);
            Debug.WriteLine("Total contacts with no phone number : {0}", count);
            return(contactListMap);
        }