示例#1
0
        /// <summary>
        /// Determines whether the specified object has equal values to this object in all fields.
        /// </summary>
        /// <param name="obj">
        /// The object whose values to compare.
        /// </param>
        /// <returns>
        /// True if the two objects have the same values.
        /// </returns>
        /// <remarks>
        /// Rounding timestamps to the nearest second is sufficient and accounts for lower precision in SQL datetime.
        /// </remarks>
        public override bool Equals(object obj)
        {
            User user = (User)obj;

            return(Id == user.Id &&
                   GlobalId == user.GlobalId &&
                   AnalyticsEventId == user.AnalyticsEventId &&
                   PartnerUserInfoList.Except(user.PartnerUserInfoList).Any() == false &&
                   user.PartnerUserInfoList.Except(PartnerUserInfoList).Any() == false);
        }
示例#2
0
        /// <summary>
        /// Add paratner userId and if it already exist then updates it
        /// </summary>
        /// <param name="partner">the partner for filtering</param>
        /// <param name="partnerUserId">Partner user Id</param>
        /// <param name="assignedByPartner">Value that indicates whether the partner user ID was assigned by the partner.</param>
        public void AddOrUpdatePartnerUserId(Partner partner, string partnerUserId, bool assignedByPartner)
        {
            PartnerUserInfo info = PartnerUserInfoList.FirstOrDefault(_ => _.PartnerId == partner);

            if (info == null)
            {
                info = new PartnerUserInfo
                {
                    PartnerUserId     = partnerUserId,
                    PartnerId         = partner,
                    AssignedByPartner = assignedByPartner
                };

                PartnerUserInfoList.Add(info);
            }
            else
            {
                info.PartnerUserId     = partnerUserId;
                info.AssignedByPartner = assignedByPartner;
            }
        }
示例#3
0
        /// <summary>
        /// Gets partner user info list. Appends explicitly stored with derived values
        /// </summary>
        /// <param name="partner">
        /// the partner for filtering
        /// </param>
        /// <returns>
        /// partner user id
        /// </returns>
        public string GetPartnerUserId(Partner partner)
        {
            PartnerUserInfo info = PartnerUserInfoList.FirstOrDefault(_ => _.PartnerId == partner);

            return(info == null ? UserIdHexFormat : info.PartnerUserId);
        }