[chore:] added ID to addres-sets (yes, there was no -_-)

This commit is contained in:
Elias Fierke
2025-10-09 10:22:22 +02:00
parent 63d430dd72
commit af8a74c2c3
4 changed files with 272 additions and 239 deletions

View File

@@ -1,25 +1,43 @@
using System;
using System.Collections.Generic;
namespace Logof_Client;
public class KasAddressList
public class KasAddressList //Address-Set
{
public List<KasPersonError> errors = new();
public List<KasPerson> KasPersons;
public KasAddressList(string name)
{
KasPersons = new List<KasPerson>();
Name = name;
var highest = 0;
foreach (var k in Settings._instance.addressSets.addresses)
if (highest <= k.ID)
highest = k.ID + 1;
ID = highest;
}
public string Name { get; set; } = "Neues Address-Set";
public int owner_id { get; set; }
public int ID { get; }
public void SetOwner(int owner_id)
{
this.owner_id = owner_id;
}
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 static int GetIDByAddressSetListItem(string listItemName)
{
var id = listItemName.Split(" - ")[0];
return int.Parse(id);
}
}
public class KasPerson
@@ -134,32 +152,34 @@ public class KasPersonError
public KasPersonError((int, List<AddressCheck.ErrorTypes>, List<AddressCheck.WarningTypes>) single_result)
{
refsid = single_result.Item1;
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);
}
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);
// }
}
public int refsid { get; set; }
public string errors { get; set; } = "";
public string warnings { get; set; } = "";
public List<AddressCheck.ErrorTypes> errors { get; set; } = new();
public List<AddressCheck.WarningTypes> warnings { get; set; } = new();
}