public override string ToString()
        {
            StringBuilder str     = new StringBuilder();
            String        addrStr = base.ToString();

            if (!string.IsNullOrEmpty(addrStr))
            {
                str.AppendLine(addrStr);
            }
            if (!string.IsNullOrEmpty(InternalLocation.GetValueOrDefault()))
            {
                str.AppendLine(InternalLocation.GetValueOrDefault());
            }
            if (!string.IsNullOrEmpty(PostalBox.GetValueOrDefault()))
            {
                str.AppendLine(PostalBox.GetValueOrDefault());
            }
            if (!string.IsNullOrEmpty(Town.GetValueOrDefault()))
            {
                str.AppendLine(Town.GetValueOrDefault());
            }
            if (!string.IsNullOrEmpty(Region.GetValueOrDefault()))
            {
                str.AppendLine(Region.GetValueOrDefault());
            }
            if (!string.IsNullOrEmpty(PostalCode.GetValueOrDefault()))
            {
                str.AppendLine(PostalCode.GetValueOrDefault());
            }
            if (!string.IsNullOrEmpty(Country.GetValueOrDefault()))
            {
                str.AppendLine(Country.GetValueOrDefault());
            }
            return(str.ToString().Trim());
        }
        public override string WhereRule()
        {
            string baseErr = base.WhereRule();

            if (string.IsNullOrEmpty(InternalLocation.GetValueOrDefault()) &&
                (AddressLines == null || AddressLines.Count == 0) &&
                string.IsNullOrEmpty(Town.GetValueOrDefault()) &&
                string.IsNullOrEmpty(Region.GetValueOrDefault()) &&
                string.IsNullOrEmpty(Country.GetValueOrDefault()))
            {
                baseErr +=
                    "PostalAddress: At least one attribute of internal location, address lines, town, region or country must be asserted.";
            }
            return(baseErr);
        }
Beispiel #3
0
        public override string GetStepParameters()
        {
            var parameters = new List <string>();

            parameters.Add(Purpose.ToStepValue());
            parameters.Add(Description != null ? Description.ToStepValue() : "$");
            parameters.Add(UserDefinedPurpose != null ? UserDefinedPurpose.ToStepValue() : "$");
            parameters.Add(InternalLocation != null ? InternalLocation.ToStepValue() : "$");
            parameters.Add(AddressLines != null ? AddressLines.ToStepValue() : "$");
            parameters.Add(PostalBox != null ? PostalBox.ToStepValue() : "$");
            parameters.Add(Town != null ? Town.ToStepValue() : "$");
            parameters.Add(Region != null ? Region.ToStepValue() : "$");
            parameters.Add(PostalCode != null ? PostalCode.ToStepValue() : "$");
            parameters.Add(Country != null ? Country.ToStepValue() : "$");

            return(string.Join(", ", parameters.ToArray()));
        }