Esempio n. 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="InvoicesBase"/> and has the same value as this instance; otherwise, false.</returns>
 public virtual bool Equals(InvoicesBase toObject)
 {
     if (toObject == null)
         return false;
     return Equals(this, toObject);
 }
Esempio n. 2
0
        ///<summary>
        /// Determines whether the specified <see cref="InvoicesBase"/> instances are considered equal.
        ///</summary>
        ///<param name="Object1">The first <see cref="InvoicesBase"/> to compare.</param>
        ///<param name="Object2">The second <see cref="InvoicesBase"/> 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(InvoicesBase Object1, InvoicesBase 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.ShipName != null && Object2.ShipName != null )
            {
                if (Object1.ShipName != Object2.ShipName)
                    equal = false;
            }
            else if (Object1.ShipName == null ^ Object1.ShipName == null )
            {
                equal = false;
            }
            if (Object1.ShipAddress != null && Object2.ShipAddress != null )
            {
                if (Object1.ShipAddress != Object2.ShipAddress)
                    equal = false;
            }
            else if (Object1.ShipAddress == null ^ Object1.ShipAddress == null )
            {
                equal = false;
            }
            if (Object1.ShipCity != null && Object2.ShipCity != null )
            {
                if (Object1.ShipCity != Object2.ShipCity)
                    equal = false;
            }
            else if (Object1.ShipCity == null ^ Object1.ShipCity == null )
            {
                equal = false;
            }
            if (Object1.ShipRegion != null && Object2.ShipRegion != null )
            {
                if (Object1.ShipRegion != Object2.ShipRegion)
                    equal = false;
            }
            else if (Object1.ShipRegion == null ^ Object1.ShipRegion == null )
            {
                equal = false;
            }
            if (Object1.ShipPostalCode != null && Object2.ShipPostalCode != null )
            {
                if (Object1.ShipPostalCode != Object2.ShipPostalCode)
                    equal = false;
            }
            else if (Object1.ShipPostalCode == null ^ Object1.ShipPostalCode == null )
            {
                equal = false;
            }
            if (Object1.ShipCountry != null && Object2.ShipCountry != null )
            {
                if (Object1.ShipCountry != Object2.ShipCountry)
                    equal = false;
            }
            else if (Object1.ShipCountry == null ^ Object1.ShipCountry == null )
            {
                equal = false;
            }
            if (Object1.CustomerId != null && Object2.CustomerId != null )
            {
                if (Object1.CustomerId != Object2.CustomerId)
                    equal = false;
            }
            else if (Object1.CustomerId == null ^ Object1.CustomerId == null )
            {
                equal = false;
            }
            if (Object1.CustomerName != Object2.CustomerName)
                equal = false;
            if (Object1.Address != null && Object2.Address != null )
            {
                if (Object1.Address != Object2.Address)
                    equal = false;
            }
            else if (Object1.Address == null ^ Object1.Address == null )
            {
                equal = false;
            }
            if (Object1.City != null && Object2.City != null )
            {
                if (Object1.City != Object2.City)
                    equal = false;
            }
            else if (Object1.City == null ^ Object1.City == null )
            {
                equal = false;
            }
            if (Object1.Region != null && Object2.Region != null )
            {
                if (Object1.Region != Object2.Region)
                    equal = false;
            }
            else if (Object1.Region == null ^ Object1.Region == null )
            {
                equal = false;
            }
            if (Object1.PostalCode != null && Object2.PostalCode != null )
            {
                if (Object1.PostalCode != Object2.PostalCode)
                    equal = false;
            }
            else if (Object1.PostalCode == null ^ Object1.PostalCode == null )
            {
                equal = false;
            }
            if (Object1.Country != null && Object2.Country != null )
            {
                if (Object1.Country != Object2.Country)
                    equal = false;
            }
            else if (Object1.Country == null ^ Object1.Country == null )
            {
                equal = false;
            }
            if (Object1.Salesperson != Object2.Salesperson)
                equal = false;
            if (Object1.OrderId != Object2.OrderId)
                equal = false;
            if (Object1.OrderDate != null && Object2.OrderDate != null )
            {
                if (Object1.OrderDate != Object2.OrderDate)
                    equal = false;
            }
            else if (Object1.OrderDate == null ^ Object1.OrderDate == null )
            {
                equal = false;
            }
            if (Object1.RequiredDate != null && Object2.RequiredDate != null )
            {
                if (Object1.RequiredDate != Object2.RequiredDate)
                    equal = false;
            }
            else if (Object1.RequiredDate == null ^ Object1.RequiredDate == null )
            {
                equal = false;
            }
            if (Object1.ShippedDate != null && Object2.ShippedDate != null )
            {
                if (Object1.ShippedDate != Object2.ShippedDate)
                    equal = false;
            }
            else if (Object1.ShippedDate == null ^ Object1.ShippedDate == null )
            {
                equal = false;
            }
            if (Object1.ShipperName != Object2.ShipperName)
                equal = false;
            if (Object1.ProductId != Object2.ProductId)
                equal = false;
            if (Object1.ProductName != Object2.ProductName)
                equal = false;
            if (Object1.UnitPrice != Object2.UnitPrice)
                equal = false;
            if (Object1.Quantity != Object2.Quantity)
                equal = false;
            if (Object1.Discount != Object2.Discount)
                equal = false;
            if (Object1.ExtendedPrice != null && Object2.ExtendedPrice != null )
            {
                if (Object1.ExtendedPrice != Object2.ExtendedPrice)
                    equal = false;
            }
            else if (Object1.ExtendedPrice == null ^ Object1.ExtendedPrice == null )
            {
                equal = false;
            }
            if (Object1.Freight != null && Object2.Freight != null )
            {
                if (Object1.Freight != Object2.Freight)
                    equal = false;
            }
            else if (Object1.Freight == null ^ Object1.Freight == null )
            {
                equal = false;
            }
            return equal;
        }