diff --git a/Tasks/AddressCreation.cs b/Tasks/AddressCreation.cs
index 962365e..2b99243 100644
--- a/Tasks/AddressCreation.cs
+++ b/Tasks/AddressCreation.cs
@@ -5,56 +5,6 @@ namespace Logof_Client;
public static class AddressCreator
{
- ///
- /// Creates max-seven-lines-long Markdown address-string. Analyzes the KasPerson-Instance to find the best result.
- ///
- /// KasPerson-ID
- /// A Markdown string with the address that is maximum seven lines long
- public static string? CreateFinalMarkdownString2(int refsid)
- {
- // Maximum seven lines of information
-
- // find the address
- KasPerson? address = null;
- var string_address = "";
- var address_line_count = 0;
- foreach (var set in Settings._instance.addressSets.addresses)
- {
- var temp = set.KasPersons.FirstOrDefault(obj => obj.refsid == refsid);
- if (temp != null)
- {
- address = temp;
- break;
- }
- }
-
- // no address found
- if (address == null) return null;
-
- // let's get started: the name (and anrede), block-line-count: 1
- if (!string.IsNullOrEmpty(address.anrede))
- {
- if (address.anrede == "Herr") string_address += "Herrn";
- else string_address += address.anrede;
- address_line_count++;
- }
-
- if (!string.IsNullOrEmpty(address.name) && !string.IsNullOrEmpty(address.vorname))
- {
- string_address += " " + address.vorname + " " + address.name;
- }
- else if (!string.IsNullOrEmpty(address.name))
- {
- }
- else // Anrede but no name? to the trash!
- {
- string_address = "";
- address_line_count = 0;
- }
-
- return "Hier könnte eine\nAdresse stehen";
- }
-
//+++ Aufbau +++
//
// Von unten anfangen, max. 7 Zeilen
@@ -124,13 +74,11 @@ public static class AddressCreator
var countryToShow = trimmedLand; // default: use raw land value
if (!string.IsNullOrEmpty(trimmedLand))
- {
// search for matching country via alternatives using for-loops
for (var ci = 0; ci < Global._instance.countries.Count; ci++)
{
var country = Global._instance.countries[ci];
for (var ai = 0; ai < country.alternatives.Count; ai++)
- {
try
{
var alt = (country.alternatives[ai] ?? "").Trim();
@@ -146,9 +94,7 @@ public static class AddressCreator
{
// ignore malformed alternative
}
- }
}
- }
CountryFound:
string_address = "\n**" + countryToShow + "**"; // Needs to be bold
@@ -249,7 +195,6 @@ public static class AddressCreator
} // Error-Handling?
return string_address;
- return "Hier könnte eine\nAdresse stehen";
}
public static string CreateNameLine(string anredezus, string anrede, string titel, string vorname, string adel,
diff --git a/Tasks/PdfBuilder.cs b/Tasks/PdfBuilder.cs
index 912b9d9..cf3b26d 100644
--- a/Tasks/PdfBuilder.cs
+++ b/Tasks/PdfBuilder.cs
@@ -35,59 +35,6 @@ public class PdfBuilder
private readonly XFont _regularFont = new("Arial", 9, XFontStyleEx.Regular);
private readonly XFont _smallFont = new("Arial", 6, XFontStyleEx.Regular);
- ///
- /// Creates a PDF document with address stickers from an AddressSet in a 3×7 grid layout on A4 pages.
- ///
- /// The ID of the AddressSet to use
- /// Path where the PDF should be saved
- public void CreateAddressLabelPdfFromAddressSet(int addressSetId, string outputPath)
- {
- // Find the AddressSet by ID
- var addressSet = Settings._instance.addressSets.GetAddressSetByID(addressSetId);
- if (addressSet == null)
- throw new ArgumentException($"AddressSet with ID {addressSetId} not found");
-
- if (addressSet.KasPersons == null || addressSet.KasPersons.Count == 0)
- throw new ArgumentException($"AddressSet with ID {addressSetId} contains no addresses");
-
- // Generate markdown addresses from all KasPersons in the set
- //var addresses = new string?[addressSet.KasPersons.Count];
- var addresses = new List();
-
- // find customer (owner) to include sender_address
- string senderLine = null;
- try
- {
- var owner = Settings._instance.customers.customers.FirstOrDefault(c => c.ID == addressSet.owner_id);
- if (owner != null && !string.IsNullOrWhiteSpace(owner.sender_address))
- // ensure single line and wrap in a small-font tag
- senderLine = "" + owner.sender_address.Replace("\n", " ").Trim();
-
- }
- catch
- {
- senderLine = null;
- }
-
- for (var i = 0; i < addressSet.KasPersons.Count; i++)
- {
- var addr = AddressCreator.CreateFinalMarkdownString(addressSet.KasPersons[i].refsid);
- if (string.IsNullOrWhiteSpace(addr.Trim())) continue;
- if (!string.IsNullOrEmpty(senderLine))
- {
- if (addressSet.KasPersons[i].refsid != null)
- {
- senderLine += "\nID: " + addressSet.KasPersons[i].refsid + "\n";
- }
- addresses.Add(senderLine + addr);
-
- }
- else
- addresses.Add(addr);
- }
-
- CreateAddressLabelPdf(addresses, outputPath);
- }
///
/// Creates a PDF document with address stickers from an AddressSet with a placeholder in the first cell.