Inheritance: System.IComparable, System.ICloneable, INotifyPropertyChanged
Example #1
0
 ///<summary>
 /// Returns a value indicating whether this instance is equal to a specified object.
 ///</summary>
 ///<param name="toObject">An object to compare to this instance.</param>
 ///<returns>true if toObject is a <see cref="VIndividualCustomerBase"/> and has the same value as this instance; otherwise, false.</returns>
 public virtual bool Equals(VIndividualCustomerBase toObject)
 {
     if (toObject == null)
     {
         return(false);
     }
     return(Equals(this, toObject));
 }
		///<summary>
		/// Determines whether the specified <see cref="VIndividualCustomerBase"/> instances are considered equal.
		///</summary>
		///<param name="Object1">The first <see cref="VIndividualCustomerBase"/> to compare.</param>
		///<param name="Object2">The second <see cref="VIndividualCustomerBase"/> to compare. </param>
		///<returns>true if Object1 is the same instance as Object2 or if both are null references or if objA.Equals(objB) returns true; otherwise, false.</returns>
		public static bool Equals(VIndividualCustomerBase Object1, VIndividualCustomerBase Object2)
		{
			// both are null
			if (Object1 == null && Object2 == null)
				return true;

			// one or the other is null, but not both
			if (Object1 == null ^ Object2 == null)
				return false;

			bool equal = true;
			if (Object1.CustomerId != Object2.CustomerId)
				equal = false;
			if (Object1.Title != null && Object2.Title != null )
			{
				if (Object1.Title != Object2.Title)
					equal = false;
			}
			else if (Object1.Title == null ^ Object1.Title == null )
			{
				equal = false;
			}
			if (Object1.FirstName != Object2.FirstName)
				equal = false;
			if (Object1.MiddleName != null && Object2.MiddleName != null )
			{
				if (Object1.MiddleName != Object2.MiddleName)
					equal = false;
			}
			else if (Object1.MiddleName == null ^ Object1.MiddleName == null )
			{
				equal = false;
			}
			if (Object1.LastName != Object2.LastName)
				equal = false;
			if (Object1.Suffix != null && Object2.Suffix != null )
			{
				if (Object1.Suffix != Object2.Suffix)
					equal = false;
			}
			else if (Object1.Suffix == null ^ Object1.Suffix == null )
			{
				equal = false;
			}
			if (Object1.Phone != null && Object2.Phone != null )
			{
				if (Object1.Phone != Object2.Phone)
					equal = false;
			}
			else if (Object1.Phone == null ^ Object1.Phone == null )
			{
				equal = false;
			}
			if (Object1.EmailAddress != null && Object2.EmailAddress != null )
			{
				if (Object1.EmailAddress != Object2.EmailAddress)
					equal = false;
			}
			else if (Object1.EmailAddress == null ^ Object1.EmailAddress == null )
			{
				equal = false;
			}
			if (Object1.EmailPromotion != Object2.EmailPromotion)
				equal = false;
			if (Object1.AddressType != Object2.AddressType)
				equal = false;
			if (Object1.AddressLine1 != Object2.AddressLine1)
				equal = false;
			if (Object1.AddressLine2 != null && Object2.AddressLine2 != null )
			{
				if (Object1.AddressLine2 != Object2.AddressLine2)
					equal = false;
			}
			else if (Object1.AddressLine2 == null ^ Object1.AddressLine2 == null )
			{
				equal = false;
			}
			if (Object1.City != Object2.City)
				equal = false;
			if (Object1.StateProvinceName != Object2.StateProvinceName)
				equal = false;
			if (Object1.PostalCode != Object2.PostalCode)
				equal = false;
			if (Object1.CountryRegionName != Object2.CountryRegionName)
				equal = false;
			if (Object1.Demographics != null && Object2.Demographics != null )
			{
				if (Object1.Demographics != Object2.Demographics)
					equal = false;
			}
			else if (Object1.Demographics == null ^ Object1.Demographics == null )
			{
				equal = false;
			}
			return equal;
		}
		///<summary>
		/// Returns a value indicating whether this instance is equal to a specified object.
		///</summary>
		///<param name="toObject">An object to compare to this instance.</param>
		///<returns>true if toObject is a <see cref="VIndividualCustomerBase"/> and has the same value as this instance; otherwise, false.</returns>
		public virtual bool Equals(VIndividualCustomerBase toObject)
		{
			if (toObject == null)
				return false;
			return Equals(this, toObject);
		}
Example #4
0
        ///<summary>
        /// Determines whether the specified <see cref="VIndividualCustomerBase"/> instances are considered equal.
        ///</summary>
        ///<param name="Object1">The first <see cref="VIndividualCustomerBase"/> to compare.</param>
        ///<param name="Object2">The second <see cref="VIndividualCustomerBase"/> to compare. </param>
        ///<returns>true if Object1 is the same instance as Object2 or if both are null references or if objA.Equals(objB) returns true; otherwise, false.</returns>
        public static bool Equals(VIndividualCustomerBase Object1, VIndividualCustomerBase Object2)
        {
            // both are null
            if (Object1 == null && Object2 == null)
            {
                return(true);
            }

            // one or the other is null, but not both
            if (Object1 == null ^ Object2 == null)
            {
                return(false);
            }

            bool equal = true;

            if (Object1.CustomerId != Object2.CustomerId)
            {
                equal = false;
            }
            if (Object1.Title != null && Object2.Title != null)
            {
                if (Object1.Title != Object2.Title)
                {
                    equal = false;
                }
            }
            else if (Object1.Title == null ^ Object1.Title == null)
            {
                equal = false;
            }
            if (Object1.FirstName != Object2.FirstName)
            {
                equal = false;
            }
            if (Object1.MiddleName != null && Object2.MiddleName != null)
            {
                if (Object1.MiddleName != Object2.MiddleName)
                {
                    equal = false;
                }
            }
            else if (Object1.MiddleName == null ^ Object1.MiddleName == null)
            {
                equal = false;
            }
            if (Object1.LastName != Object2.LastName)
            {
                equal = false;
            }
            if (Object1.Suffix != null && Object2.Suffix != null)
            {
                if (Object1.Suffix != Object2.Suffix)
                {
                    equal = false;
                }
            }
            else if (Object1.Suffix == null ^ Object1.Suffix == null)
            {
                equal = false;
            }
            if (Object1.Phone != null && Object2.Phone != null)
            {
                if (Object1.Phone != Object2.Phone)
                {
                    equal = false;
                }
            }
            else if (Object1.Phone == null ^ Object1.Phone == null)
            {
                equal = false;
            }
            if (Object1.EmailAddress != null && Object2.EmailAddress != null)
            {
                if (Object1.EmailAddress != Object2.EmailAddress)
                {
                    equal = false;
                }
            }
            else if (Object1.EmailAddress == null ^ Object1.EmailAddress == null)
            {
                equal = false;
            }
            if (Object1.EmailPromotion != Object2.EmailPromotion)
            {
                equal = false;
            }
            if (Object1.AddressType != Object2.AddressType)
            {
                equal = false;
            }
            if (Object1.AddressLine1 != Object2.AddressLine1)
            {
                equal = false;
            }
            if (Object1.AddressLine2 != null && Object2.AddressLine2 != null)
            {
                if (Object1.AddressLine2 != Object2.AddressLine2)
                {
                    equal = false;
                }
            }
            else if (Object1.AddressLine2 == null ^ Object1.AddressLine2 == null)
            {
                equal = false;
            }
            if (Object1.City != Object2.City)
            {
                equal = false;
            }
            if (Object1.StateProvinceName != Object2.StateProvinceName)
            {
                equal = false;
            }
            if (Object1.PostalCode != Object2.PostalCode)
            {
                equal = false;
            }
            if (Object1.CountryRegionName != Object2.CountryRegionName)
            {
                equal = false;
            }
            if (Object1.Demographics != null && Object2.Demographics != null)
            {
                if (Object1.Demographics != Object2.Demographics)
                {
                    equal = false;
                }
            }
            else if (Object1.Demographics == null ^ Object1.Demographics == null)
            {
                equal = false;
            }
            return(equal);
        }