Example #1
0
        public override int GetHashCode()
        {
            int hashCode =
                IdVer.GetHashCode() +
                IdSubVer.GetHashCode() +
                Timestamp.GetHashCode() +
                (IdSupplier == null ? 0 : IdSupplier.GetHashCode()) +
                (SupplierName == null ? 0 : SupplierName.GetHashCode()) +
                Active.GetHashCode() +
                (VATNum == null ? 0 : VATNum.GetHashCode()) +
                (ShippingAddress == null ? 0 : ShippingAddress.GetHashCode()) +
                (ShippingAddressZh == null ? 0 : ShippingAddressZh.GetHashCode()) +
                (BillingAddress == null ? 0 : BillingAddress.GetHashCode()) +
                (BillingAddressZh == null ? 0 : BillingAddressZh.GetHashCode()) +
                (ContactName == null ? 0 : ContactName.GetHashCode()) +
                (ContactNameZh == null ? 0 : ContactNameZh.GetHashCode()) +
                (ContactPhone == null ? 0 : ContactPhone.GetHashCode()) +
                (Comments == null ? 0 : Comments.GetHashCode()) +
                (IdIncoterm == null ? 0 : IdIncoterm.GetHashCode()) +
                (IdPaymentTerms == null ? 0 : IdPaymentTerms.GetHashCode()) +
                (IdDefaultCurrency == null ? 0 : IdDefaultCurrency.GetHashCode()) +
                (User == null ? 0: User.GetHashCode());

            return(hashCode);
        }
        public static IEnumerable <ComplexType> CreateMultiple(int instances, int childrenPerInstance, int depth)
        {
            var idSupplier = new IdSupplier();

            for (var i = 0; i < instances; i++)
            {
                yield return(Create(idSupplier, childrenPerInstance, depth));
            }
        }
        private static ComplexType Create(IdSupplier idSupplier, int childrenPerInstance, int depth)
        {
            var instance = new ComplexType()
            {
                Id       = idSupplier.GetId(),
                Children = new List <ComplexType>()
            };

            if (depth == 0)
            {
                return(instance);
            }

            for (int i = 0; i < childrenPerInstance; i++)
            {
                instance.Children.Add(Create(idSupplier, childrenPerInstance, depth - 1));
            }

            return(instance);
        }
Example #4
0
        public override int GetHashCode()
        {
            int hashCode;

            hashCode = (
                IdVer.GetHashCode() +
                IdSubVer.GetHashCode() +
                Timestamp.GetHashCode() +
                (IdItemBcn == null ? 0 : IdItemBcn.GetHashCode()) +
                (IdSupplier == null ? 0 : IdSupplier.GetHashCode()) +
                Price.GetHashCode() +
                (Comments == null ? 0 : Comments.GetHashCode()) +
                (IdCurrency == null ? 0 : IdCurrency.GetHashCode()) +
                PriceBaseCurrency.GetHashCode() +
                ExchangeRateUsed.GetHashCode() +
                MinLot.GetHashCode() +
                IncrLot.GetHashCode() +
                LeadTime.GetHashCode()
                );

            return(hashCode);
        }
        public static ComplexType Create(int childrenPerInstance, int depth)
        {
            var idSupplier = new IdSupplier();

            return(Create(idSupplier, childrenPerInstance, depth));
        }