コード例 #1
0
 /// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         var hashCode = 41;
         // Suitable nullity checks etc, of course :)
         if (InventoryNumber != null)
         {
             hashCode = hashCode * 59 + InventoryNumber.GetHashCode();
         }
         if (SerialNumber != null)
         {
             hashCode = hashCode * 59 + SerialNumber.GetHashCode();
         }
         if (Location != null)
         {
             hashCode = hashCode * 59 + Location.GetHashCode();
         }
         if (Room != null)
         {
             hashCode = hashCode * 59 + Room.GetHashCode();
         }
         if (Description != null)
         {
             hashCode = hashCode * 59 + Description.GetHashCode();
         }
         if (CostCenter != null)
         {
             hashCode = hashCode * 59 + CostCenter.GetHashCode();
         }
         if (CapitalisationDate != null)
         {
             hashCode = hashCode * 59 + CapitalisationDate.GetHashCode();
         }
         if (LastInventoryDate != null)
         {
             hashCode = hashCode * 59 + LastInventoryDate.GetHashCode();
         }
         if (AcquisitionValue != null)
         {
             hashCode = hashCode * 59 + AcquisitionValue.GetHashCode();
         }
         if (AssetSuperNumber != null)
         {
             hashCode = hashCode * 59 + AssetSuperNumber.GetHashCode();
         }
         if (Vendor != null)
         {
             hashCode = hashCode * 59 + Vendor.GetHashCode();
         }
         if (TypeName != null)
         {
             hashCode = hashCode * 59 + TypeName.GetHashCode();
         }
         if (Plant != null)
         {
             hashCode = hashCode * 59 + Plant.GetHashCode();
         }
         if (AssetClass != null)
         {
             hashCode = hashCode * 59 + AssetClass.GetHashCode();
         }
         if (Quantity != null)
         {
             hashCode = hashCode * 59 + Quantity.GetHashCode();
         }
         if (Unit != null)
         {
             hashCode = hashCode * 59 + Unit.GetHashCode();
         }
         if (DeactivatedOn != null)
         {
             hashCode = hashCode * 59 + DeactivatedOn.GetHashCode();
         }
         if (IsDeactivated != null)
         {
             hashCode = hashCode * 59 + IsDeactivated.GetHashCode();
         }
         if (CompanyCodeCurrency != null)
         {
             hashCode = hashCode * 59 + CompanyCodeCurrency.GetHashCode();
         }
         if (AssetNumber != null)
         {
             hashCode = hashCode * 59 + AssetNumber.GetHashCode();
         }
         if (SubNumber != null)
         {
             hashCode = hashCode * 59 + SubNumber.GetHashCode();
         }
         if (CompanyCode != null)
         {
             hashCode = hashCode * 59 + CompanyCode.GetHashCode();
         }
         return(hashCode);
     }
 }
コード例 #2
0
        /// <summary>
        /// Returns true if SapInventoryAsset instances are equal
        /// </summary>
        /// <param name="other">Instance of SapInventoryAsset to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(SapInventoryAsset other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     InventoryNumber == other.InventoryNumber ||
                     InventoryNumber != null &&
                     InventoryNumber.Equals(other.InventoryNumber)
                     ) &&
                 (
                     SerialNumber == other.SerialNumber ||
                     SerialNumber != null &&
                     SerialNumber.Equals(other.SerialNumber)
                 ) &&
                 (
                     Location == other.Location ||
                     Location != null &&
                     Location.Equals(other.Location)
                 ) &&
                 (
                     Room == other.Room ||
                     Room != null &&
                     Room.Equals(other.Room)
                 ) &&
                 (
                     Description == other.Description ||
                     Description != null &&
                     Description.Equals(other.Description)
                 ) &&
                 (
                     CostCenter == other.CostCenter ||
                     CostCenter != null &&
                     CostCenter.Equals(other.CostCenter)
                 ) &&
                 (
                     CapitalisationDate == other.CapitalisationDate ||
                     CapitalisationDate != null &&
                     CapitalisationDate.Equals(other.CapitalisationDate)
                 ) &&
                 (
                     LastInventoryDate == other.LastInventoryDate ||
                     LastInventoryDate != null &&
                     LastInventoryDate.Equals(other.LastInventoryDate)
                 ) &&
                 (
                     AcquisitionValue == other.AcquisitionValue ||
                     AcquisitionValue != null &&
                     AcquisitionValue.Equals(other.AcquisitionValue)
                 ) &&
                 (
                     AssetSuperNumber == other.AssetSuperNumber ||
                     AssetSuperNumber != null &&
                     AssetSuperNumber.Equals(other.AssetSuperNumber)
                 ) &&
                 (
                     Vendor == other.Vendor ||
                     Vendor != null &&
                     Vendor.Equals(other.Vendor)
                 ) &&
                 (
                     TypeName == other.TypeName ||
                     TypeName != null &&
                     TypeName.Equals(other.TypeName)
                 ) &&
                 (
                     Plant == other.Plant ||
                     Plant != null &&
                     Plant.Equals(other.Plant)
                 ) &&
                 (
                     AssetClass == other.AssetClass ||
                     AssetClass != null &&
                     AssetClass.Equals(other.AssetClass)
                 ) &&
                 (
                     Quantity == other.Quantity ||
                     Quantity != null &&
                     Quantity.Equals(other.Quantity)
                 ) &&
                 (
                     Unit == other.Unit ||
                     Unit != null &&
                     Unit.Equals(other.Unit)
                 ) &&
                 (
                     DeactivatedOn == other.DeactivatedOn ||
                     DeactivatedOn != null &&
                     DeactivatedOn.Equals(other.DeactivatedOn)
                 ) &&
                 (
                     IsDeactivated == other.IsDeactivated ||
                     IsDeactivated != null &&
                     IsDeactivated.Equals(other.IsDeactivated)
                 ) &&
                 (
                     CompanyCodeCurrency == other.CompanyCodeCurrency ||
                     CompanyCodeCurrency != null &&
                     CompanyCodeCurrency.Equals(other.CompanyCodeCurrency)
                 ) &&
                 (
                     AssetNumber == other.AssetNumber ||
                     AssetNumber != null &&
                     AssetNumber.Equals(other.AssetNumber)
                 ) &&
                 (
                     SubNumber == other.SubNumber ||
                     SubNumber != null &&
                     SubNumber.Equals(other.SubNumber)
                 ) &&
                 (
                     CompanyCode == other.CompanyCode ||
                     CompanyCode != null &&
                     CompanyCode.Equals(other.CompanyCode)
                 ));
        }