Ejemplo n.º 1
0
        protected bool Equals(Product other)
        {
            if (other == null)
            {
                return(false);
            }

            //если составные части не совпадают
            if (!this.ProductBlock.Equals(other.ProductBlock))
            {
                return(false);
            }

            //если зависимые продукты не совпадают / совпадают
            return(DependentProducts.MembersAreSame(other.DependentProducts, new ProductDependentComparer()));
        }
Ejemplo n.º 2
0
        public string GetFullDescription(int spaceCount = 0)
        {
            var sb = new StringBuilder();

            sb.Append($"{Designation} ");
            sb.Append($"{this} (параметры: {ProductBlock.ParametersToString().ToLower()})".AddSpacesBefore(spaceCount));
            if (DependentProducts.Any())
            {
                spaceCount++;
                sb.AppendLine("Составные части:".AddSpacesBefore(spaceCount));
                foreach (var dependentProduct in DependentProducts)
                {
                    sb.AppendLine($"{dependentProduct.Amount} шт. " + dependentProduct.Product.GetFullDescription(spaceCount).AddSpacesBefore(spaceCount));
                }
            }

            return(sb.ToString());
        }