Example #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>
        public override bool Equals(object obj)
        {
            ReferralType referralType = (ReferralType)obj;

            return(Id == referralType.Id &&
                   ReferrerId == referralType.ReferrerId &&
                   ReferrerType == referralType.ReferrerType &&
                   ReferralVector == referralType.ReferralVector &&
                   RewardRecipient == referralType.RewardRecipient &&
                   Code == referralType.Code &&
                   ReferralEventRewards.Except(referralType.ReferralEventRewards).Any() == false &&
                   referralType.ReferralEventRewards.Except(ReferralEventRewards).Any() == false);
        }
Example #2
0
        /// <summary>
        /// Initializes a new instance of the ReferralType class, using the fields from the specified other ReferralType.
        /// </summary>
        /// <param name="referralType">
        /// The other ReferralType whose fields to copy.
        /// </param>
        /// <exception cref="ArgumentNullException">
        /// Parameter deal cannot be null.
        /// </exception>
        public ReferralType(ReferralType referralType)
        {
            if (referralType == null)
            {
                throw new ArgumentNullException("referralType", "Parameter referralType cannot be null.");
            }

            Id                   = referralType.Id;
            ReferrerId           = referralType.ReferrerId;
            ReferrerType         = referralType.ReferrerType;
            ReferralVector       = referralType.ReferralVector;
            RewardRecipient      = referralType.RewardRecipient;
            Code                 = referralType.Code;
            ReferralEventRewards = new Collection <ReferralEventReward>();
            foreach (ReferralEventReward referralEventReward in referralType.ReferralEventRewards)
            {
                ReferralEventRewards.Add(new ReferralEventReward(referralEventReward));
            }
        }