public override string ToString() { var type = ProductType == null ? string.Empty : $"{ProductType} "; if (!string.IsNullOrEmpty(DesignationSpecial)) { return($"{type}{DesignationSpecial}"); } if (!string.IsNullOrEmpty(Designation)) { return($"{type}{Designation}"); } return(ProductBlock.ToString()); }
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()); }
protected bool Equals(ProductBlock other) { return(other != null && this.Parameters.MembersAreSame(other.Parameters, new ParameterComparer())); }