35 lines
909 B
C#
35 lines
909 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace Logof_Client;
|
|
|
|
public class AddressRepair(ProgressWindow progressWindow)
|
|
{
|
|
private readonly ProgressWindow _progress = progressWindow;
|
|
|
|
public async Task Perform(KasAddressList list)
|
|
{
|
|
try
|
|
{
|
|
foreach (var person in list.KasPersons)
|
|
{
|
|
|
|
// German PLZ too short (e.g. Dresden)
|
|
if (person.IsGermany() && person.plz.Length <= 4)
|
|
{
|
|
while (person.plz.Length <= 4)
|
|
{
|
|
person.plz = "0" + person.plz;
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
Logger.Log($"Error while performing address shortener: {ex.Message}", Logger.LogType.Error);
|
|
}
|
|
|
|
}
|
|
} |