public static bool City_2(string token1, string token2, AddressEx acc) { if (Regex.IsMatch(token1, @"^\w+$") && Regex.IsMatch(token2, @"^\w+$")) { acc.city = token1 + " " + token2; return(true); } return(false); }
public static bool State_1(string token, AddressEx acc) { if (Regex.IsMatch(token, @"^\w\w$")) { acc.state = token; return(true); } return(false); }
public static bool Suffix_1(string token, AddressEx acc) { if (_abbr.AllStreetSuffixes.Contains(token.ToLower())) { acc.street_suffix = token; return(true); } return(false); }
public static bool City_1(string token, AddressEx acc) { if (Regex.IsMatch(token, @"^\w+$")) { acc.city = token; return(true); } return(false); }
public static bool StreetNumber_1(string token, AddressEx acc) { if (Regex.IsMatch(token, @"^\d+$")) { acc.street_no = token; return(true); } return(false); }
public static bool Street_2(string token1, string token2, AddressEx acc) { if (Regex.IsMatch(token1, @"^\w+$") && Regex.IsMatch(token2, @"^\w+$")) { acc.street = string.Format("{0} {1}", token1, token2); return(true); } return(false); }
public static bool UnitValue_1(string token, AddressEx acc) { if (!string.IsNullOrEmpty(token)) { acc.unitValue = token; return(true); } return(false); }
public static bool Predirectional_1(string token, AddressEx acc) { if (_abbr.AllDirectionals.Contains(token.ToLower())) { acc.street_direction = token; return(true); } return(false); }
public static bool Zip_1(string token, AddressEx acc) { if (Regex.IsMatch(token, @"^\d\d\d\d\d$")) { acc.zip = token; return(true); } return(false); }
public static bool UnitDesc_1(string token, AddressEx acc) { var cleansed = token.ToLower().Trim(new char[] { ':' }); if (_abbr.AllUnitDescriptors.Contains(cleansed)) { acc.unitDescriptor = token; return(true); } return(false); }
private static void AssertAddressAreEqual(Address expected, AddressEx result) { Assert.NotNull(result); Assert.AreEqual(expected.unit, result.unit, "unit"); Assert.AreEqual(expected.city, result.city, "city"); Assert.AreEqual(expected.state, result.state, "state"); Assert.AreEqual(expected.street, result.street, "street name"); Assert.AreEqual(expected.street_direction, result.street_direction, "street_direction"); Assert.AreEqual(expected.street_no, result.street_no, "street_no"); Assert.AreEqual(expected.street_post_direction, result.street_post_direction, "street_post_direction"); Assert.AreEqual(expected.street_suffix, result.street_suffix, "street_suffix"); Assert.AreEqual(expected.zip, result.zip, "zip"); }
public bool IsTokenMatch(string[] tokens, AddressEx acc, ref int i) { bool result = false; switch (Arity) { case 1: result = f1(tokens[i], acc); if (result) { i += 1; } break; case 2: result = f2(tokens[i], tokens[i + 1], acc); if (result) { i += 2; } break; case 3: result = f3(tokens[i], tokens[i + 1], tokens[i + 2], acc); if (result) { i += 3; } break; default: throw new Exception("no function available"); } return(result); }
/// <summary> /// Initializes a new instance of the <see cref="Company"/> class. /// </summary> public Company() { FiscalProfile = new FiscalProfile(); Preferences = new Preferences(); Address = new AddressEx(); }