public bool IsValid() { bool result = true; if (FirstName.Trim().Length < 1) { result = false; } if (LastName.Trim().Length < 1) { result = false; } if (Line1.Trim().Length < 1) { result = false; } if (CountryBvin.Trim().Length < 1) { result = false; } if (CountryName.Trim().Length < 1) { result = false; } if (CountryBvin == "bf7389a2-9b21-4d33-b276-23c9c18ea0c0") { if (RegionBvin.Trim().Length < 1) { if (RegionName.Trim().Length < 1) { result = false; } } } if (_PostalCode.Trim().Length < 1) { result = false; } return(result); }
public string ToHtmlString() { StringBuilder sb = new StringBuilder(); if (NickName.Trim().Length > 0) { sb.Append("<em>" + NickName + "</em><br />"); } if (LastName.Length > 0 || FirstName.Length > 0) { sb.Append(FirstName); if (MiddleInitial.Trim().Length > 0) { sb.Append(" " + MiddleInitial); } sb.Append(" " + LastName + "<br />"); if (Company.Trim().Length > 0) { sb.Append(Company + "<br />"); } } if (Line1.Length > 0) { sb.Append(Line1 + "<br />"); } if (Line2.Trim().Length > 0) { sb.Append(Line2 + "<br />"); } if (Line3.Trim().Length > 0) { sb.Append(Line3 + "<br />"); } MerchantTribe.Web.Geography.Country c = MerchantTribe.Web.Geography.Country.FindByBvin(CountryBvin); MerchantTribe.Web.Geography.Region r = c.Regions.Where(y => y.Abbreviation == RegionBvin).FirstOrDefault(); if (r != null) { sb.Append(City + ", " + r.Abbreviation + " " + _PostalCode + "<br />"); } else { if (RegionName.Trim().Length > 0) { sb.Append(City + ", " + RegionName + " " + _PostalCode + "<br />"); } else { sb.Append(City + ", " + _PostalCode + "<br />"); } } if (c != null) { sb.Append(c.DisplayName + "<br />"); } if (Phone.Trim().Length > 0) { sb.Append(Phone + "<br />"); } if (Fax.Trim().Length > 0) { sb.Append("Fax: " + Fax + "<br />"); } if (WebSiteUrl.Trim().Length > 0) { sb.Append(WebSiteUrl + "<br />"); } return(sb.ToString()); }