From 351a0b8d57ac6de1c0087b8704d06feb70d3ad8b Mon Sep 17 00:00:00 2001 From: Lorenz Stechauner Date: Fri, 28 Apr 2023 11:56:54 +0200 Subject: [PATCH] Add ClientParameters --- Elwig/App.xaml.cs | 3 ++ Elwig/Documents/BusinessDocument.cshtml | 6 ++- Elwig/Documents/BusinessDocument.cshtml.cs | 6 ++- Elwig/Documents/DeliveryNote.cshtml | 14 +++---- Elwig/Documents/Document.cshtml.cs | 4 +- Elwig/Helpers/ClientParameters.cs | 47 ++++++++++++++++++++++ Elwig/Models/Member.cs | 7 ++++ 7 files changed, 74 insertions(+), 13 deletions(-) create mode 100644 Elwig/Helpers/ClientParameters.cs diff --git a/Elwig/App.xaml.cs b/Elwig/App.xaml.cs index c5f5095..163096b 100644 --- a/Elwig/App.xaml.cs +++ b/Elwig/App.xaml.cs @@ -16,6 +16,7 @@ namespace Elwig { public static readonly string ExePath = @"C:\Program Files\Elwig\"; public static readonly Config Config = new(DataPath + "config.ini"); public static IEnumerable Scales { get; private set; } + public static ClientParameters Client { get; private set; } public static bool IsPrintingReady => Documents.Html.IsReady && Documents.Pdf.IsReady; public static Dispatcher MainDispatcher { get; private set; } @@ -38,6 +39,8 @@ namespace Elwig { Utils.RunBackground("HTML Initialization", () => Documents.Html.Init(PrintingReadyChanged)); Utils.RunBackground("PDF Initialization", () => Documents.Pdf.Init(PrintingReadyChanged)); + Client = new(); + var list = new LinkedList(); foreach (var s in Config.Scales) { try { diff --git a/Elwig/Documents/BusinessDocument.cshtml b/Elwig/Documents/BusinessDocument.cshtml index 1f2dad8..3fc80fd 100644 --- a/Elwig/Documents/BusinessDocument.cshtml +++ b/Elwig/Documents/BusinessDocument.cshtml @@ -6,8 +6,10 @@
-
WG Matzen | Schloßstraße 6 | 2243 Matzen
-
E Österreichische Post AG Eco Brief
+ @if (Model.IncludeSender) { +
@Elwig.App.Client.Sender1
+
@Elwig.App.Client.Sender2
+ }
@Model.Address
diff --git a/Elwig/Documents/BusinessDocument.cshtml.cs b/Elwig/Documents/BusinessDocument.cshtml.cs index caf4e2b..df5d5b3 100644 --- a/Elwig/Documents/BusinessDocument.cshtml.cs +++ b/Elwig/Documents/BusinessDocument.cshtml.cs @@ -4,9 +4,11 @@ namespace Elwig.Documents { public abstract class BusinessDocument : Document { public Member Member; + public bool IncludeSender = false; - public BusinessDocument(string title, Member m) : base(title) { + public BusinessDocument(string title, Member m, bool includeSender = false) : base(title) { Member = m; + IncludeSender = includeSender; } public string Address { @@ -16,7 +18,7 @@ namespace Elwig.Documents { if (b != null) { return $"{b.Name}\n{b.Address}\n{plz.Plz} {plz.Dest}"; } else { - return $"{Member.Name}\n{Member.Address}\n{plz.Plz} {plz.Dest}"; + return $"{Member.AdministrativeName}\n{Member.Address}\n{plz.Plz} {plz.Dest}"; } } } diff --git a/Elwig/Documents/DeliveryNote.cshtml b/Elwig/Documents/DeliveryNote.cshtml index c2d6258..5c46ac3 100644 --- a/Elwig/Documents/DeliveryNote.cshtml +++ b/Elwig/Documents/DeliveryNote.cshtml @@ -7,15 +7,15 @@ - - - - + + + + - - - + + + diff --git a/Elwig/Documents/Document.cshtml.cs b/Elwig/Documents/Document.cshtml.cs index 5f9cb7e..f9810bd 100644 --- a/Elwig/Documents/Document.cshtml.cs +++ b/Elwig/Documents/Document.cshtml.cs @@ -11,8 +11,8 @@ namespace Elwig.Documents { public Document(string title) { DataPath = App.DataPath; Title = title; - Header = "

Winzergenossenschaft Matzen

"; - Footer = "Winzergenossenschaft für Matzen und Umgebung reg. Gen.m.b.H."; + Header = $"

{App.Client.Name}

"; + Footer = App.Client.NameFull; Date = DateTime.Today; } diff --git a/Elwig/Helpers/ClientParameters.cs b/Elwig/Helpers/ClientParameters.cs new file mode 100644 index 0000000..ae2c47f --- /dev/null +++ b/Elwig/Helpers/ClientParameters.cs @@ -0,0 +1,47 @@ +using Elwig.Models; + +namespace Elwig.Helpers { + public class ClientParameters { + + public string NameToken; + public string NameShort; + public string NameShortened; + public string Name; + public string NameSuffix; + public string NameFull => $"{Name} {NameSuffix}"; + + public PostalDest PostalDest { + set { + Plz = value.AtPlz.Plz; + Ort = value.AtPlz.Ort.Name; + } + } + public int Plz { get; private set; } + public string Ort { get; private set; } + public string Address; + public string Sender1 => $"{NameShort} | {Address} | {Plz} {Ort}"; + public string Sender2; + + public string? Iban; + public string? Bic; + public string? UstId; + public string? LfbisNr; + + public string? PhoneNr; + public string? FaxNr; + public string? EmailAddress; + public string? Website; + + public ClientParameters() { + NameToken = "WGM"; + NameShort = "WG Matzen"; + NameShortened = "Winzergenossenschaft f. Matzen u. Umgebung"; + Name = "Winzergenossenschaft für Matzen und Umgebung"; + NameSuffix = "reg. Gen.m.b.H."; + Plz = 2243; + Ort = "Matzen"; + Address = "Schloßstraße 6"; + Sender2 = "E Österreichische Post AG Eco Brief"; + } + } +} diff --git a/Elwig/Models/Member.cs b/Elwig/Models/Member.cs index 561dfff..667c9fd 100644 --- a/Elwig/Models/Member.cs +++ b/Elwig/Models/Member.cs @@ -44,6 +44,13 @@ namespace Elwig.Models { public string ShortName => GivenName + " " + FamilyName; + public string AdministrativeName => + FamilyName.ToUpper() + " " + + (Prefix != null ? Prefix + " " : "") + + GivenName + + (MiddleName != null ? " " + MiddleName: "") + + (Suffix != null ? " " + Suffix : ""); + [Column("birthday")] public string? Birthday { get; set; }
SorteQualitätsstufeGradationGewichtSorteQualitätsstufeGradationGewicht
°KMW°Oekg°KMW°Oekg