Пример #1
0
 /// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Returns HashCode</returns>
 public override int GetHashCode()
 {
     return(String.Format("{0}|{1}|{2}|{3}|{4}|{5}|{6}|{7}|",
                          PasswordProfile.GetHashCode(),
                          AccountEnabled.GetHashCode(),
                          DisplayName?.GetHashCode() ?? 0,
                          MailNickname?.GetHashCode() ?? 0,
                          PasswordPolicies?.GetHashCode() ?? 0,
                          UserPrincipalName?.GetHashCode() ?? 0,
                          ProfilePhoto?.GetHashCode() ?? 0,
                          Licenses.Aggregate(0, (acc, next) => acc += (next != null ? next.GetHashCode() : 0))
                          ).GetHashCode());
 }
        public override int GetHashCode()
        {
            if (!string.IsNullOrEmpty(UserPrincipalName))
            {
                return(UserPrincipalName.GetHashCode());
            }
            else if (!string.IsNullOrEmpty(Mail))
            {
                return(Mail.GetHashCode());
            }

            return(base.GetHashCode());
        }
        public override bool Equals(object obj)
        {
            if (obj is GraphUser)
            {
                if (!string.IsNullOrEmpty(UserPrincipalName))
                {
                    return(UserPrincipalName.Equals(((GraphUser)obj).UserPrincipalName));
                }
                else if (!string.IsNullOrEmpty(Mail))
                {
                    return(Mail.Equals(((GraphUser)obj).Mail));
                }
            }

            return(base.Equals(obj));
        }
Пример #4
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = (_userId != null ? _userId.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (EmailAddress != null ? EmailAddress.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Description != null ? Description.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (DisplayName != null ? DisplayName.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ Enabled.GetHashCode();
         hashCode = (hashCode * 397) ^ (GivenName != null ? GivenName.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Surname != null ? Surname.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ UserCannotChangePassword.GetHashCode();
         hashCode = (hashCode * 397) ^ (UserPrincipalName != null ? UserPrincipalName.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (VoiceTelephoneNumber != null ? VoiceTelephoneNumber.GetHashCode() : 0);
         return(hashCode);
     }
 }
        public CustomRider CreateRidePin()
        {
            var pin = new CustomRider()
            {
                Id          = string.IsNullOrEmpty(Id) ? UserPrincipalName : Id,
                Title       = GivenName,
                Description = GivenName
            };

            if (HasLocation())
            {
                pin.Longitude = Longitude.Value;
                pin.Latitude  = Latitude.Value;
            }

            pin.Color = ProfileColor;

            if (!string.IsNullOrEmpty(DisplayName))
            {
                var split = DisplayName.Split(' ');
                if (split.Any())
                {
                    pin.Acronym = string.Format("{0}{1}",
                                                split.First().Substring(0, 1),
                                                split.Last().Substring(0, 1));
                }
            }
            else
            {
                pin.Acronym = string.Format("{0}{1}",
                                            UserPrincipalName.Substring(0, 1),
                                            UserPrincipalName.Substring(1, 2));
            }


            return(pin);
        }