Compare commits
2
Commits
05caa559b4
...
e725cac742
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e725cac742 | ||
|
|
15d1a26251 |
+1
-1
@@ -154,7 +154,7 @@
|
||||
<TextBlock TextWrapping="Wrap" FontSize="9" Text="Generiert Versandetiketten und Bundleitzettel" HorizontalAlignment="Stretch" TextAlignment="Left"></TextBlock>
|
||||
</StackPanel>
|
||||
</Button>
|
||||
<Button Width="250" IsEnabled="False"
|
||||
<Button Width="250" IsEnabled="False" Click="BtnRepair_OnClick"
|
||||
HorizontalContentAlignment="Center" x:Name="BtnRepair" VerticalAlignment="Stretch"
|
||||
Margin="0,0,0,10">
|
||||
<StackPanel Orientation="Vertical">
|
||||
|
||||
+33
-1
@@ -135,6 +135,26 @@ public partial class MainWindow : Window
|
||||
//await MessageBox.Show(_instance, $"{result.Count} Einträge fehlerhaft.", "Fertig");
|
||||
}
|
||||
|
||||
private async void StartAddressRepairer(KasAddressList set)
|
||||
{
|
||||
//var addresses = DataImport.ImportKasAddressList(path); // Ihr Code hier
|
||||
|
||||
var progressWindow = new ProgressWindow();
|
||||
|
||||
progressWindow.Show(_instance);
|
||||
|
||||
var processor = new AddressRepair(progressWindow);
|
||||
await processor.Perform(set);
|
||||
|
||||
// foreach (var item in result)
|
||||
// {
|
||||
// }
|
||||
|
||||
progressWindow.Close();
|
||||
Settings.Save();
|
||||
//await MessageBox.Show(_instance, $"{result.Count} Einträge fehlerhaft.", "Fertig");
|
||||
}
|
||||
|
||||
|
||||
private void MnuExit_OnClick(object? sender, RoutedEventArgs e)
|
||||
{
|
||||
@@ -704,7 +724,7 @@ public partial class MainWindow : Window
|
||||
if (pers.PersonError != null)
|
||||
{
|
||||
BtnShorten.IsEnabled = true;
|
||||
// BtnRepair.IsEnabled = true;
|
||||
BtnRepair.IsEnabled = true;
|
||||
break;
|
||||
}
|
||||
else
|
||||
@@ -1346,4 +1366,16 @@ public partial class MainWindow : Window
|
||||
{
|
||||
PopulateNavTree();
|
||||
}
|
||||
|
||||
private void BtnRepair_OnClick(object? sender, RoutedEventArgs e)
|
||||
{
|
||||
MakeCalcManVisible();
|
||||
if (LstCustomerAdressSets.SelectedIndex == -1)
|
||||
{
|
||||
MessageBox.Show(null, "Bitte zunächst ein Adress-Set auswählen", "Kein Adress-Set ausgewählt");
|
||||
return;
|
||||
}
|
||||
|
||||
StartAddressRepairer((KasAddressList)LstCustomerAdressSets.SelectedItem);
|
||||
}
|
||||
}
|
||||
|
||||
+15
-6
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Logof_Client;
|
||||
|
||||
@@ -7,20 +8,28 @@ public class AddressRepair(ProgressWindow progressWindow)
|
||||
{
|
||||
private readonly ProgressWindow _progress = progressWindow;
|
||||
|
||||
public KasAddressList Perform(KasAddressList all_addresses,
|
||||
List<(int, List<AddressCheck.ErrorTypes>)> failed_addresses)
|
||||
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 repair: {ex.Message}", Logger.LogType.Error);
|
||||
Logger.Log($"Error while performing address shortener: {ex.Message}", Logger.LogType.Error);
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user