[struc:] moved KasPersonError-Instance from addressset to KasPerson-Instance
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Interactivity;
|
||||
@@ -11,10 +12,10 @@ public partial class ResultWindow : Window
|
||||
{
|
||||
public List<CheckBox> errortypecheckboxes = new();
|
||||
public KasAddressList ur_addresses = new("Ergebnis_" + DateTime.Now.ToString("ddMMyy_HHmmss"));
|
||||
public List<KasPersonError> ur_result;
|
||||
public List<KasPerson> ur_result;
|
||||
public List<CheckBox> warningtypecheckboxes = new();
|
||||
|
||||
public ResultWindow(List<KasPersonError> result,
|
||||
public ResultWindow(List<KasPerson> result,
|
||||
int addressSetID)
|
||||
{
|
||||
InitializeComponent();
|
||||
@@ -24,12 +25,12 @@ public partial class ResultWindow : Window
|
||||
//ViewSingle(200552426);
|
||||
}
|
||||
|
||||
private void GenerateView(List<KasPersonError> result)
|
||||
private void GenerateView(List<KasPerson> result)
|
||||
{
|
||||
// var errors = new List<KasPersonError>();
|
||||
//foreach (var single_result in result) errors.Add(single_result);
|
||||
LblResultCount.Content = $"{result.Count}/{ur_result.Count} Ergebnisse";
|
||||
DgResult.ItemsSource = result;
|
||||
// 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";
|
||||
DgResult.ItemsSource = result_with_errors;
|
||||
}
|
||||
|
||||
private void ViewSingle(int refsid)
|
||||
@@ -62,18 +63,20 @@ public partial class ResultWindow : Window
|
||||
}
|
||||
}
|
||||
|
||||
private void Load(List<KasPersonError> result)
|
||||
private void Load(List<KasPerson> result)
|
||||
{
|
||||
var knownErrors = new List<AddressCheck.ErrorTypes>();
|
||||
var knownWarnings = new List<AddressCheck.WarningTypes>();
|
||||
|
||||
foreach (var single_result in result)
|
||||
foreach (var person in result)
|
||||
{
|
||||
foreach (var errtyp in single_result.errors)
|
||||
if (person.PersonError == null) continue;
|
||||
|
||||
foreach (var errtyp in person.PersonError.errors)
|
||||
if (!knownErrors.Contains(errtyp))
|
||||
knownErrors.Add(errtyp);
|
||||
|
||||
foreach (var wartyp in single_result.warnings)
|
||||
foreach (var wartyp in person.PersonError.warnings)
|
||||
if (!knownWarnings.Contains(wartyp))
|
||||
knownWarnings.Add(wartyp);
|
||||
}
|
||||
@@ -108,7 +111,7 @@ public partial class ResultWindow : Window
|
||||
|
||||
private void UpdateFilter()
|
||||
{
|
||||
var temp_result = new List<KasPersonError>();
|
||||
var temp_result = new List<KasPerson>();
|
||||
var checked_types = new List<AddressCheck.ErrorTypes>();
|
||||
var checked_types_war = new List<AddressCheck.WarningTypes>();
|
||||
foreach (var cb in errortypecheckboxes)
|
||||
@@ -121,21 +124,19 @@ public partial class ResultWindow : Window
|
||||
checked_types_war.Add(
|
||||
(AddressCheck.WarningTypes)Enum.Parse(typeof(AddressCheck.WarningTypes), cb.Content.ToString()));
|
||||
|
||||
foreach (var sres in ur_result)
|
||||
foreach (var person in ur_result)
|
||||
{
|
||||
foreach (var err in sres.errors)
|
||||
if (checked_types.Contains(err) && !temp_result.Contains(sres))
|
||||
temp_result.Add(sres);
|
||||
if (person.PersonError == null) continue;
|
||||
|
||||
foreach (var war in sres.warnings)
|
||||
if (checked_types_war.Contains(war) && !temp_result.Contains(sres))
|
||||
temp_result.Add(sres);
|
||||
foreach (var err in person.PersonError.errors)
|
||||
if (checked_types.Contains(err) && !temp_result.Contains(person))
|
||||
temp_result.Add(person);
|
||||
|
||||
foreach (var war in person.PersonError.warnings)
|
||||
if (checked_types_war.Contains(war) && !temp_result.Contains(person))
|
||||
temp_result.Add(person);
|
||||
}
|
||||
|
||||
|
||||
//var errors = new List<KasPersonError>();
|
||||
//foreach (var single_result in temp_result) errors.Add(new KasPersonError(single_result));
|
||||
|
||||
LblResultCount.Content = $"{temp_result.Count}/{ur_result.Count} Ergebnisse";
|
||||
DgResult.ItemsSource = temp_result;
|
||||
}
|
||||
@@ -145,7 +146,7 @@ public partial class ResultWindow : Window
|
||||
foreach (var selected in DgResult.SelectedItems)
|
||||
try
|
||||
{
|
||||
var _asKas = (KasPersonError)selected;
|
||||
var _asKas = (KasPerson)selected;
|
||||
ViewSingle(_asKas.refsid);
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
||||
Reference in New Issue
Block a user