[struc:] moved KasPersonError-Instance from addressset to KasPerson-Instance

This commit is contained in:
Elias Fierke
2025-12-07 13:30:25 +01:00
parent 8c56717b9c
commit b70bd5e324
3 changed files with 82 additions and 89 deletions

View File

@@ -5,7 +5,7 @@ namespace Logof_Client;
public class KasAddressList //Address-Set
{
public List<KasPersonError> errors = new();
//public List<KasPersonError> errors = new();
public List<KasPerson> KasPersons;
public KasAddressList(string name)
@@ -13,12 +13,9 @@ public class KasAddressList //Address-Set
KasPersons = new List<KasPerson>();
Name = name;
foreach (var set in Settings._instance.addressSets.addresses)
{
if (Name == set.Name)
{
Name = name + "-new";
}
}
var highest = 0;
foreach (var k in Settings._instance.addressSets.addresses)
if (highest <= k.ID)
@@ -37,17 +34,20 @@ public class KasAddressList //Address-Set
public static string GenerateName(string basic_type, bool? is_rest = false)
{
if(is_rest == true)
if (is_rest == true)
return basic_type + " - " + DateTime.Now.ToShortDateString() + " - Rest";
else
return basic_type + " - " + DateTime.Now.ToShortDateString();
return basic_type + " - " + DateTime.Now.ToShortDateString();
}
public void UpdateErrorList(List<(int, List<AddressCheck.ErrorTypes>, List<AddressCheck.WarningTypes>)> errorList)
{
errors.Clear();
foreach (var error in errorList) errors.Add(new KasPersonError(error));
}
// public void UpdateErrorList(List<KasPersonError> errorList)
// {
// //errors.Clear();
// // foreach (KasPersonError err in errorList)
// // {
// //
// // }
// //foreach (var error in errorList) errors.Add(new KasPersonError(error));
// }
public static int GetIDByAddressSetListItem(string listItemName)
{
@@ -58,6 +58,8 @@ public class KasAddressList //Address-Set
public class KasPerson
{
public KasPersonError PersonError = null;
public KasPerson()
{
refsid = 0;
@@ -165,37 +167,14 @@ public class KasPerson
public class KasPersonError
{
public KasPersonError((int, List<AddressCheck.ErrorTypes>, List<AddressCheck.WarningTypes>) single_result)
public KasPersonError((List<AddressCheck.ErrorTypes>, List<AddressCheck.WarningTypes>) single_result)
{
refsid = single_result.Item1;
errors = single_result.Item2;
warnings = single_result.Item3;
// try
// {
// foreach (var err in single_result.Item2) errors += err + ", ";
// errors = errors.Trim();
// errors = errors.TrimEnd(',');
// }
// catch
// {
// }
//
// try
// {
// if (single_result.Item3 != null)
// {
// foreach (var err in single_result.Item3) warnings += err + ", ";
// warnings = warnings.Trim();
// warnings = warnings.TrimEnd(',');
// }
// }
// catch (Exception e)
// {
// Console.WriteLine(e.Message);
// }
//refsid = single_result.Item1;
errors = single_result.Item1;
warnings = single_result.Item2;
}
public int refsid { get; set; }
//public int refsid { get; set; }
public List<AddressCheck.ErrorTypes> errors { get; set; } = new();
public List<AddressCheck.WarningTypes> warnings { get; set; } = new();
}