private void UpdateStraatnm(StreetNameExtractItem streetName, Language?language, string name) => UpdateRecord(streetName, record => { switch (language) { case Language.Dutch: streetName.NameDutch = name; break; case Language.French: streetName.NameFrench = name; break; case Language.German: streetName.NameGerman = name; break; case Language.English: streetName.NameEnglish = name; break; case null: streetName.NameUnknown = name; break; default: throw new ArgumentOutOfRangeException(nameof(language), language, null); } });
private void UpdateHomoniemtv(StreetNameExtractItem streetName, Language?language, string homonymAddition) => UpdateRecord(streetName, record => { switch (language) { case Language.Dutch: streetName.HomonymDutch = homonymAddition?.Substring(0, Math.Min(homonymAddition.Length, 5)); break; case Language.French: streetName.HomonymFrench = homonymAddition?.Substring(0, Math.Min(homonymAddition.Length, 5)); break; case Language.German: streetName.HomonymGerman = homonymAddition?.Substring(0, Math.Min(homonymAddition.Length, 5)); break; case Language.English: streetName.HomonymEnglish = homonymAddition?.Substring(0, Math.Min(homonymAddition.Length, 5)); break; case null: streetName.HomonymUnknown = homonymAddition?.Substring(0, Math.Min(homonymAddition.Length, 5)); break; default: throw new ArgumentOutOfRangeException(nameof(language), language, null); } });
private void UpdateRecord(StreetNameExtractItem municipality, Action <StreetNameDbaseRecord> updateFunc) { var record = new StreetNameDbaseRecord(); record.FromBytes(municipality.DbaseRecord, _encoding); updateFunc(record); municipality.DbaseRecord = record.ToBytes(_encoding); }
private void UpdateVersie(StreetNameExtractItem streetName, Instant timestamp) => UpdateRecord(streetName, record => record.versieid.SetValue(timestamp.ToBelgianDateTimeOffset()));
private void UpdateId(StreetNameExtractItem streetName, int id) => UpdateRecord(streetName, record => { record.id.Value = $"{_extractConfig.DataVlaanderenNamespace}/{id}"; record.straatnmid.Value = id; });
private void UpdateStatus(StreetNameExtractItem streetName, string status) => UpdateRecord(streetName, record => record.status.Value = status);