Compare commits
7
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
522970f341 | ||
|
|
74208a4f04 | ||
|
|
9cd6500da9 | ||
|
|
c223ca222d | ||
|
|
c966604b07 | ||
|
|
c0d7053847 | ||
|
|
612a55a070 |
@@ -71,4 +71,11 @@
|
||||
|
||||
<Folder Include="assets\fonts\" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Update="PreviewWindow.axaml.cs">
|
||||
<DependentUpon>PreviewWindow.axaml</DependentUpon>
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
||||
@@ -98,6 +98,8 @@ public partial class MainWindow : Window
|
||||
progressWindow.Close();
|
||||
new ResultWindow(result, addresSetID).Show();
|
||||
Settings.Save();
|
||||
|
||||
RefreshAddressSetListItems((LstCustomers.SelectedItem as Customer).ID);
|
||||
}
|
||||
|
||||
private async void StartAddressShortener(KasAddressList set)
|
||||
@@ -110,6 +112,8 @@ public partial class MainWindow : Window
|
||||
|
||||
progressWindow.Close();
|
||||
Settings.Save();
|
||||
|
||||
RefreshAddressSetListItems((LstCustomers.SelectedItem as Customer).ID);
|
||||
}
|
||||
|
||||
private async void StartAddressRepairer(KasAddressList set)
|
||||
@@ -122,6 +126,8 @@ public partial class MainWindow : Window
|
||||
|
||||
progressWindow.Close();
|
||||
Settings.Save();
|
||||
|
||||
RefreshAddressSetListItems((LstCustomers.SelectedItem as Customer).ID);
|
||||
}
|
||||
|
||||
|
||||
@@ -858,6 +864,8 @@ public partial class MainWindow : Window
|
||||
|
||||
Logger.Log("PDF seems OK");
|
||||
}
|
||||
|
||||
RefreshAddressSetListItems((LstCustomers.SelectedItem as Customer).ID);
|
||||
}
|
||||
|
||||
catch (Exception ex)
|
||||
|
||||
@@ -0,0 +1,103 @@
|
||||
<Window xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" Icon="assets/icon.ico"
|
||||
xmlns:local="using:Logof_Client"
|
||||
x:Class="Logof_Client.PreviewWindow"
|
||||
Title="Datensätze bearbeiten" x:DataType="local:PreviewWindow">
|
||||
<Grid Grid.ColumnDefinitions="*">
|
||||
<ScrollViewer Grid.Column="0" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto">
|
||||
<DataGrid x:Name="AddressGrid"
|
||||
ItemsSource="{Binding Addresses}"
|
||||
AutoGenerateColumns="False"
|
||||
IsReadOnly="False"
|
||||
SelectionMode="Extended"
|
||||
GridLinesVisibility="All">
|
||||
|
||||
<DataGrid.Columns>
|
||||
|
||||
<DataGridTextColumn Header="ID"
|
||||
Binding="{Binding id}"
|
||||
IsReadOnly="True" />
|
||||
|
||||
<DataGridTextColumn Header="RefSID"
|
||||
Binding="{Binding refsid}" />
|
||||
|
||||
<DataGridTextColumn Header="Anrede"
|
||||
Binding="{Binding anrede}" />
|
||||
|
||||
<DataGridTextColumn Header="Titel"
|
||||
Binding="{Binding titel}" />
|
||||
|
||||
<DataGridTextColumn Header="Vorname"
|
||||
Binding="{Binding vorname}" />
|
||||
|
||||
<DataGridTextColumn Header="Adel"
|
||||
Binding="{Binding adel}" />
|
||||
|
||||
<DataGridTextColumn Header="Name"
|
||||
Binding="{Binding name}" />
|
||||
|
||||
<DataGridTextColumn Header="Namenszusatz"
|
||||
Binding="{Binding namezus}" />
|
||||
|
||||
<DataGridTextColumn Header="Anredzusatz"
|
||||
Binding="{Binding anredzus}" />
|
||||
|
||||
<DataGridTextColumn Header="Straße"
|
||||
Binding="{Binding strasse}" />
|
||||
|
||||
<DataGridTextColumn Header="Straße 2"
|
||||
Binding="{Binding strasse2}" />
|
||||
|
||||
<DataGridTextColumn Header="PLZ"
|
||||
Binding="{Binding plz}" />
|
||||
|
||||
<DataGridTextColumn Header="Ort"
|
||||
Binding="{Binding ort}" />
|
||||
|
||||
<DataGridTextColumn Header="Land"
|
||||
Binding="{Binding land}" />
|
||||
|
||||
<DataGridTextColumn Header="PPLZ"
|
||||
Binding="{Binding pplz}" />
|
||||
|
||||
<DataGridTextColumn Header="Postfach"
|
||||
Binding="{Binding postfach}" />
|
||||
|
||||
<DataGridTextColumn Header="Name 1"
|
||||
Binding="{Binding name1}" />
|
||||
|
||||
<DataGridTextColumn Header="Name 2"
|
||||
Binding="{Binding name2}" />
|
||||
|
||||
<DataGridTextColumn Header="Name 3"
|
||||
Binding="{Binding name3}" />
|
||||
|
||||
<DataGridTextColumn Header="Name 4"
|
||||
Binding="{Binding name4}" />
|
||||
|
||||
<DataGridTextColumn Header="Name 5"
|
||||
Binding="{Binding name5}" />
|
||||
|
||||
<DataGridTextColumn Header="Funktion"
|
||||
Binding="{Binding funktion}" />
|
||||
|
||||
<DataGridTextColumn Header="Funktion 2"
|
||||
Binding="{Binding funktion2}" />
|
||||
|
||||
<DataGridTextColumn Header="Abteilung"
|
||||
Binding="{Binding abteilung}" />
|
||||
|
||||
<DataGridTextColumn Header="Funktion AD"
|
||||
Binding="{Binding funktionad}" />
|
||||
|
||||
</DataGrid.Columns>
|
||||
|
||||
</DataGrid>
|
||||
<!-- <StackPanel x:Name="StkResults" Orientation="Vertical" Margin="10" /> -->
|
||||
</ScrollViewer>
|
||||
|
||||
</Grid>
|
||||
</Window>
|
||||
@@ -0,0 +1,33 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Interactivity;
|
||||
using Avalonia.Layout;
|
||||
using Avalonia.Media;
|
||||
|
||||
namespace Logof_Client;
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
public partial class PreviewWindow : Window, INotifyPropertyChanged
|
||||
{
|
||||
|
||||
public PreviewWindow(IEnumerable<KasPerson> addresses)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
Addresses = new ObservableCollection<KasPerson>(addresses);
|
||||
|
||||
DataContext = this;
|
||||
}
|
||||
public ObservableCollection<KasPerson> Addresses { get; }
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
+61
-2
@@ -3,8 +3,9 @@
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" Icon="assets/icon.ico"
|
||||
xmlns:local="using:Logof_Client"
|
||||
x:Class="Logof_Client.ResultWindow"
|
||||
Title="Ergebnis">
|
||||
Title="Ergebnis" x:DataType="local:ResultWindow">
|
||||
<Grid Grid.ColumnDefinitions="200,*">
|
||||
<Grid>
|
||||
<Label Content="Filter" Margin="10,10,10,0" HorizontalAlignment="Stretch" VerticalAlignment="Top" />
|
||||
@@ -21,7 +22,65 @@
|
||||
</Grid>
|
||||
<ScrollViewer Grid.Column="1" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto">
|
||||
<!-- <TextBlock x:Name="TbResults"></TextBlock> -->
|
||||
<ListBox x:Name="LbResults"></ListBox>
|
||||
<!-- <ListBox x:Name="LbResults"></ListBox> -->
|
||||
<!-- <DataGrid ItemsSource="{Binding Results}" IsReadOnly="True" -->
|
||||
<!-- AutoGenerateColumns="False"> -->
|
||||
<!-- -->
|
||||
<!-- -->
|
||||
<!-- <DataGrid.Columns> -->
|
||||
<!-- <DataGridTextColumn Header="ID" -->
|
||||
<!-- Binding="{Binding PersonId}" /> -->
|
||||
<!-- -->
|
||||
<!-- <DataGridTextColumn Header="Name" -->
|
||||
<!-- Binding="{Binding Name}" /> -->
|
||||
<!-- -->
|
||||
<!-- <DataGridTextColumn Header="Errors" -->
|
||||
<!-- Binding="{Binding Errors}" /> -->
|
||||
<!-- -->
|
||||
<!-- <DataGridTextColumn Header="Warnings" -->
|
||||
<!-- Binding="{Binding Warnings}" /> -->
|
||||
<!-- -->
|
||||
<!-- <DataGridTextColumn Header="Refsid" -->
|
||||
<!-- Binding="{Binding Refsid}" /> -->
|
||||
<!-- </DataGrid.Columns> -->
|
||||
<!-- -->
|
||||
<!-- </DataGrid> -->
|
||||
<ListBox ItemsSource="{Binding Results}" SelectionMode="Multiple" x:Name="LbResults" SelectedItems="{Binding SelectedResults}">
|
||||
<ListBox.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<VirtualizingStackPanel />
|
||||
</ItemsPanelTemplate>
|
||||
</ListBox.ItemsPanel>
|
||||
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Grid Margin="2">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="2*"/>
|
||||
<ColumnDefinition Width="3*"/>
|
||||
<ColumnDefinition Width="3*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<TextBlock Grid.Column="0"
|
||||
Text="{Binding PersonId}" />
|
||||
|
||||
<TextBlock Grid.Column="1"
|
||||
Text="{Binding Refsid}" />
|
||||
|
||||
<TextBlock Grid.Column="2"
|
||||
Text="{Binding Name}" />
|
||||
|
||||
<TextBlock Grid.Column="3"
|
||||
Text="{Binding Errors}" />
|
||||
|
||||
<TextBlock Grid.Column="4"
|
||||
Text="{Binding Warnings}" />
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
<!-- <StackPanel x:Name="StkResults" Orientation="Vertical" Margin="10" /> -->
|
||||
</ScrollViewer>
|
||||
|
||||
|
||||
+77
-11
@@ -1,6 +1,9 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Interactivity;
|
||||
@@ -8,37 +11,71 @@ using Avalonia.Layout;
|
||||
using Avalonia.Media;
|
||||
|
||||
namespace Logof_Client;
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
public partial class ResultWindow : Window
|
||||
public partial class ResultWindow : Window, INotifyPropertyChanged
|
||||
{
|
||||
public event PropertyChangedEventHandler? PropertyChanged;
|
||||
|
||||
private List<ResultItem> _results = new();
|
||||
|
||||
public List<ResultItem> Results
|
||||
{
|
||||
get => _results;
|
||||
private set
|
||||
{
|
||||
_results = value;
|
||||
PropertyChanged?.Invoke(
|
||||
this,
|
||||
new PropertyChangedEventArgs(nameof(Results))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
public List<CheckBox> errortypecheckboxes = new();
|
||||
public KasAddressList ur_addresses = new("Ergebnis_" + DateTime.Now.ToString("ddMMyy_HHmmss"));
|
||||
public List<KasPerson> ur_result;
|
||||
public List<CheckBox> warningtypecheckboxes = new();
|
||||
public List<ResultItem>? SelectedResults { get; set; }
|
||||
|
||||
public ResultWindow(List<KasPerson> result,
|
||||
int addressSetID)
|
||||
public ResultWindow(List<KasPerson> result, int addressSetID)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
DataContext = this;
|
||||
|
||||
ur_result = result;
|
||||
|
||||
Load(result);
|
||||
}
|
||||
|
||||
private void GenerateView(List<KasPerson> result)
|
||||
{
|
||||
//public List<ResultItem> Results { get; private set; } = new();
|
||||
private void GenerateView(List<KasPerson> result) {
|
||||
try
|
||||
{
|
||||
// Filter to only show persons with errors
|
||||
var result_with_errors = result.Where(p => p.PersonError != null).ToList();
|
||||
LblResultCount.Content = $"{result_with_errors.Count}/{ur_result.Count} Ergebnisse";
|
||||
|
||||
LbResults.Items.Clear();
|
||||
foreach (var person in result_with_errors) LbResults.Items.Add(person.PersonError.ToString(person));
|
||||
//LbResults.Items.Clear();
|
||||
// foreach (var person in result_with_errors)
|
||||
// LbResults.Items.Add(person.PersonError.ToString(person));
|
||||
Results = result_with_errors
|
||||
.Select(person => new ResultItem
|
||||
{
|
||||
Person = person,
|
||||
PersonId = person.id,
|
||||
Name = $"{person.vorname} {person.name}".Trim(),
|
||||
Errors = string.Join(", ", person.PersonError.errors),
|
||||
Warnings = string.Join(", ", person.PersonError.warnings),
|
||||
Refsid = person.refsid.ToString() ?? ""
|
||||
})
|
||||
.ToList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.Log("Error while generating result view: " + ex.Message, Logger.LogType.Warning);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -179,8 +216,9 @@ public partial class ResultWindow : Window
|
||||
|
||||
LblResultCount.Content = $"{temp_result.Count}/{ur_result.Count} Ergebnisse";
|
||||
|
||||
LbResults.Items.Clear();
|
||||
foreach (var person in temp_result) LbResults.Items.Add(person.PersonError.ToString(person));
|
||||
//LbResults.Items.Clear();
|
||||
GenerateView(temp_result);
|
||||
//foreach (var person in temp_result) LbResults.Items.Add(person.PersonError.ToString(person));
|
||||
|
||||
} catch (Exception ex)
|
||||
{
|
||||
@@ -192,7 +230,20 @@ public partial class ResultWindow : Window
|
||||
|
||||
private void BtnShowSelected_OnClick(object? sender, RoutedEventArgs e)
|
||||
{
|
||||
// once upon a time, there was a feature like this
|
||||
if (LbResults.SelectedItems.Count > 0)
|
||||
{
|
||||
var selectedPersons = LbResults.SelectedItems
|
||||
.Cast<ResultItem>()
|
||||
.Select(x => x.Person)
|
||||
.ToList();
|
||||
|
||||
if (selectedPersons.Count == 0)
|
||||
return;
|
||||
|
||||
var preview = new PreviewWindow(selectedPersons);
|
||||
preview.Show();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void BtnExecuteFilter_OnClick(object? sender, RoutedEventArgs e)
|
||||
@@ -200,4 +251,19 @@ public partial class ResultWindow : Window
|
||||
Console.WriteLine("Updating filter...");
|
||||
UpdateFilter();
|
||||
}
|
||||
//public ObservableCollection<ResultItem> Results { get; } = new();
|
||||
}
|
||||
public class ResultItem
|
||||
{
|
||||
public int PersonId { get; init; }
|
||||
|
||||
public string Name { get; init; } = "";
|
||||
|
||||
public string Errors { get; init; } = "";
|
||||
|
||||
public string Warnings { get; init; } = "";
|
||||
|
||||
public string Refsid { get; init; } = "";
|
||||
|
||||
public KasPerson Person { get; init; } = null!;
|
||||
}
|
||||
+66
-41
@@ -58,6 +58,33 @@ public class AddressCheck
|
||||
|
||||
await Task.Run(async () =>
|
||||
{
|
||||
|
||||
// Refsids, die mehrfach vorkommen
|
||||
var doubledRefsids = adset.KasPersons
|
||||
.Where(p => p.refsid > 0)
|
||||
.GroupBy(p => p.refsid)
|
||||
.Where(g => g.Count() > 1)
|
||||
.ToDictionary(g => g.Key, g => true);
|
||||
|
||||
// Adressen, die mehrfach vorkommen
|
||||
var doubledAddresses = adset.KasPersons
|
||||
.GroupBy(p => (
|
||||
p.name,
|
||||
p.strasse,
|
||||
p.vorname,
|
||||
p.ort,
|
||||
p.funktion,
|
||||
p.funktion2,
|
||||
p.funktionad,
|
||||
p.abteilung,
|
||||
p.name1,
|
||||
p.name2,
|
||||
p.name3,
|
||||
p.name4,
|
||||
p.name5))
|
||||
.Where(g => g.Count() > 1)
|
||||
.ToDictionary(g => g.Key, g => true);
|
||||
|
||||
foreach (var person in adset.KasPersons)
|
||||
{
|
||||
var errors = new List<ErrorTypes>();
|
||||
@@ -155,47 +182,35 @@ public class AddressCheck
|
||||
}
|
||||
|
||||
// Address-Component-Count
|
||||
if (!string.IsNullOrWhiteSpace(person.strasse2)) address_component_count++;
|
||||
if (!string.IsNullOrWhiteSpace(person.land)) address_component_count++;
|
||||
if (!string.IsNullOrWhiteSpace(person.name1)) address_component_count++;
|
||||
if (!string.IsNullOrWhiteSpace(person.name2)) address_component_count++;
|
||||
if (!string.IsNullOrWhiteSpace(person.name3)) address_component_count++;
|
||||
if (!string.IsNullOrWhiteSpace(person.name4)) address_component_count++;
|
||||
if (!string.IsNullOrWhiteSpace(person.name5)) address_component_count++;
|
||||
if (!string.IsNullOrWhiteSpace(person.funktion)) address_component_count++;
|
||||
if (!string.IsNullOrWhiteSpace(person.funktion2)) address_component_count++;
|
||||
if (!string.IsNullOrWhiteSpace(person.funktionad)) address_component_count++;
|
||||
if (!string.IsNullOrWhiteSpace(person.abteilung)) address_component_count++;
|
||||
|
||||
// Double-Refsid or DoubleAddresses
|
||||
foreach (var person2 in adset.KasPersons)
|
||||
{
|
||||
if (adset.KasPersons.IndexOf(person) == adset.KasPersons.IndexOf(person2)) continue;
|
||||
|
||||
if (person.refsid == person2.refsid) // trifft auf Patch-Addressen nicht zu
|
||||
// Double-Refsid
|
||||
if (person.refsid > 0 &&
|
||||
doubledRefsids.ContainsKey(person.refsid))
|
||||
{
|
||||
hasFaults = true;
|
||||
warnings.Add(WarningTypes.DoubledRefsid);
|
||||
}
|
||||
|
||||
if (person.name == person2.name &&
|
||||
person.strasse == person2.strasse &&
|
||||
person.vorname == person2.vorname &&
|
||||
person.ort == person2.ort &&
|
||||
person.funktion == person2.funktion &&
|
||||
person.funktion2 == person2.funktion2 &&
|
||||
person.funktionad == person2.funktionad &&
|
||||
person.abteilung == person2.abteilung &&
|
||||
person.name1 == person2.name1 &&
|
||||
person.name2 == person2.name2 &&
|
||||
person.name3 == person2.name3 &&
|
||||
person.name4 == person2.name4 &&
|
||||
person.name5 == person2.name5)
|
||||
// Double-Address
|
||||
var addressKey = (
|
||||
person.name,
|
||||
person.strasse,
|
||||
person.vorname,
|
||||
person.ort,
|
||||
person.funktion,
|
||||
person.funktion2,
|
||||
person.funktionad,
|
||||
person.abteilung,
|
||||
person.name1,
|
||||
person.name2,
|
||||
person.name3,
|
||||
person.name4,
|
||||
person.name5);
|
||||
|
||||
if (doubledAddresses.ContainsKey(addressKey))
|
||||
{
|
||||
hasFaults = true;
|
||||
errors.Add(ErrorTypes.MayBeSameAddress);
|
||||
}
|
||||
}
|
||||
|
||||
// Adressen-Länge
|
||||
if (address_component_count > 10)
|
||||
@@ -216,16 +231,26 @@ public class AddressCheck
|
||||
}
|
||||
|
||||
// Fortschritt aktualisieren
|
||||
Interlocked.Increment(ref current);
|
||||
var percent = current / (double)total * 100;
|
||||
await Dispatcher.UIThread.InvokeAsync(() =>
|
||||
{
|
||||
if (hasFaults)
|
||||
_progress.AddToLog($"Person mit id {person.id} ist fehlerhaft",
|
||||
Convert.ToInt32(percent).ToString());
|
||||
// Interlocked.Increment(ref current);
|
||||
// var percent = current / (double)total * 100;
|
||||
// await Dispatcher.UIThread.InvokeAsync(() =>
|
||||
// {
|
||||
// if (hasFaults)
|
||||
// _progress.AddToLog($"Person mit id {person.id} ist fehlerhaft",
|
||||
// Convert.ToInt32(percent).ToString());
|
||||
//
|
||||
// _progress.ChangePercentage(percent);
|
||||
// });
|
||||
|
||||
_progress.ChangePercentage(percent);
|
||||
});
|
||||
var cd = Interlocked.Increment(ref current);
|
||||
|
||||
if (cd % 10 == 0)
|
||||
{
|
||||
var percent = cd / (double)total * 100;
|
||||
|
||||
await Dispatcher.UIThread.InvokeAsync(() =>
|
||||
_progress.ChangePercentage(percent));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user