private string GetSettlementIdCommandHandler() { int settlementTypeId = int.Parse(GetCommandParameter("settlementTypeId", true)); int municipalityId = int.Parse(GetCommandParameter("municipalityId", true)); string name = GetCommandParameter("name", true); GeographicItemType settlementType = GeographicItemType.Parse(settlementTypeId); GeographicRegionItem municipality = GeographicRegionItem.Parse(municipalityId); GeographicRegionItem result = GeographicItemValidator.SearchSettlement(settlementType, municipality, name); if (result.Id != GeographicRegionItem.Empty.Id) { return result.Id.ToString(); } return String.Empty; }
private string SearchSettlementsCommandHandler() { int municipalityId = int.Parse(GetCommandParameter("municipalityId", true)); string name = GetCommandParameter("name", true); GeographicRegionItem municipality = GeographicRegionItem.Parse(municipalityId); ObjectList<GeographicRegionItem> list = GeographicItemValidator.SearchSettlements(municipality, name, 0.75m); string temp = String.Empty; foreach (GeographicRegionItem region in list) { string item = region.Id.ToString() + " " + region.Name + " " + region.ObjectTypeInfo.DisplayName; item += " (DL " + EmpiriaString.DamerauLevenshteinProximityFactor(region.Name, name).ToString("P2") + " - ME "; item += EmpiriaString.MongeElkanProximityFactor(EmpiriaString.DistanceAlgorithm.DamerauLevenshtein, region.Name, name).ToString("P2") + " - J "; item += EmpiriaString.JaroProximityFactor(region.Name, name).ToString("P2") + " - JW "; item += EmpiriaString.JaroWinklerProximityFactor(region.Name, name).ToString("P2") + ") "; temp += item + "|"; } return temp.Trim('|'); }