public string GenerateMergeKey() { var mergeKey = $"{StateTerritory}|{LocalityName}|{Postcode}|"; if (PostalDeliveryType.HasValue()) { if (PostalDeliveryNumber.HasValue()) { mergeKey += $"|||{PostalDeliveryType} {PostalDeliveryNumber}||||||"; } else { mergeKey += $"|||{PostalDeliveryType}||||||"; } } else { if (StreetNumber1.HasValue()) { mergeKey += $"{StreetName}|{StreetType}|{StreetSuffix}|{StreetNumber1}|"; } else { mergeKey += $"{StreetName}|{StreetType}|{StreetSuffix}|LOT {LotIdentifier}|"; } mergeKey += $"{StreetNumber2}|{SiteName}|{ComplexUnitType}|{ComplexUnitIdentifier}|{ComplexLevelType}|{ComplexLevelNumber}"; } return(mergeKey); }
private void number_part(StringBuilder builder) { // number_part = (unit_part level_part road_number_part / level_part sub_building_number road_number_part) // unit_part = unit_type SP unit_number_part SP // unit_number_part = ( / unit_prefix) ( / unit_number) ( / unit_suffix) // level_part = ( / level_type SP ( / level_number_part SP)) // level_number_part = ( / level_prefix) ( / level_number) ( / level_suffix) // sub_building_number = ( / unit_number_part "/") // road_number_part = (number_first_part ("-" number_last_part) SP / lot_number_part) // number_first_part = ( / number_first_prefix) number_first ( / number_first_suffix) // number_last_part = ( / number_last_prefix) number_last ( / number_last_suffix) // lot_number_part = ( / "LOT" SP ( / lot_number_prefix) ( / lot_number_first) ( / lot_number_suffix) SP) if (ComplexUnitType.HasValue()) { // unit_part level_part builder.Append(ComplexUnitType).Append(Sp); if (ComplexUnitIdentifier.HasValue()) { builder.Append(ComplexUnitIdentifier).Append(Sp); } level_part(builder); } else { // level_part sub_building_number level_part(builder); if (ComplexUnitIdentifier.HasValue()) { builder.Append(ComplexUnitIdentifier).Append('/'); } } // road_number_part if (StreetNumber1.HasValue()) { // number_first_part ("-" number_last_part) SP builder.Append(StreetNumber1); if (StreetNumber2.HasValue()) { builder.Append('-'); builder.Append(StreetNumber2); } } else { // lot_number_part builder.Append("LOT"); builder.Append(Sp); builder.Append(LotIdentifier); } builder.Append(Sp); }