public Address(TypeReachEnum typeReach, string country, string neighborhood = null, string city = null, string state = null) { if (typeReach == TypeReachEnum.state && String.IsNullOrWhiteSpace(country)) { throw new ArgumentNullException("Preencha todos os campos listados: { estado, pais }"); } else if (typeReach == TypeReachEnum.city && (String.IsNullOrWhiteSpace(state) || String.IsNullOrWhiteSpace(city))) { throw new ArgumentNullException("Preencha todos os campos listados: { cidade | estado | pais }"); } else if (typeReach == TypeReachEnum.neighborhood && (String.IsNullOrWhiteSpace(state) || String.IsNullOrWhiteSpace(city) || String.IsNullOrWhiteSpace(neighborhood))) { throw new ArgumentNullException("Preencha todos os campos listados: { bairro | cidade | estado | pais }"); } Neighborhood = neighborhood; City = city; State = state; Country = country; TypeReach = new TypeReachVO(typeReach); }
public TypeReachVO(TypeReachEnum typeReachEnum) { Value = typeReachEnum.ToString(); }