Add ClientParameters
This commit is contained in:
		@@ -16,6 +16,7 @@ namespace Elwig {
 | 
				
			|||||||
        public static readonly string ExePath = @"C:\Program Files\Elwig\";
 | 
					        public static readonly string ExePath = @"C:\Program Files\Elwig\";
 | 
				
			||||||
        public static readonly Config Config = new(DataPath + "config.ini");
 | 
					        public static readonly Config Config = new(DataPath + "config.ini");
 | 
				
			||||||
        public static IEnumerable<IScale> Scales { get; private set; }
 | 
					        public static IEnumerable<IScale> Scales { get; private set; }
 | 
				
			||||||
 | 
					        public static ClientParameters Client { get; private set;  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        public static bool IsPrintingReady => Documents.Html.IsReady && Documents.Pdf.IsReady;
 | 
					        public static bool IsPrintingReady => Documents.Html.IsReady && Documents.Pdf.IsReady;
 | 
				
			||||||
        public static Dispatcher MainDispatcher { get; private set; }
 | 
					        public static Dispatcher MainDispatcher { get; private set; }
 | 
				
			||||||
@@ -38,6 +39,8 @@ namespace Elwig {
 | 
				
			|||||||
            Utils.RunBackground("HTML Initialization", () => Documents.Html.Init(PrintingReadyChanged));
 | 
					            Utils.RunBackground("HTML Initialization", () => Documents.Html.Init(PrintingReadyChanged));
 | 
				
			||||||
            Utils.RunBackground("PDF Initialization", () => Documents.Pdf.Init(PrintingReadyChanged));
 | 
					            Utils.RunBackground("PDF Initialization", () => Documents.Pdf.Init(PrintingReadyChanged));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            Client = new();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            var list = new LinkedList<IScale>();
 | 
					            var list = new LinkedList<IScale>();
 | 
				
			||||||
            foreach (var s in Config.Scales) {
 | 
					            foreach (var s in Config.Scales) {
 | 
				
			||||||
                try {
 | 
					                try {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -6,8 +6,10 @@
 | 
				
			|||||||
<div class="info-wrapper">
 | 
					<div class="info-wrapper">
 | 
				
			||||||
    <div class="address-wrapper">
 | 
					    <div class="address-wrapper">
 | 
				
			||||||
        <div class="sender">
 | 
					        <div class="sender">
 | 
				
			||||||
            <div>WG Matzen | Schloßstraße 6 | 2243 Matzen</div>
 | 
					            @if (Model.IncludeSender) {
 | 
				
			||||||
            <div>E Österreichische Post AG Eco Brief</div>
 | 
					                <div>@Elwig.App.Client.Sender1</div>
 | 
				
			||||||
 | 
					                <div>@Elwig.App.Client.Sender2</div>
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
        </div>
 | 
					        </div>
 | 
				
			||||||
        <address>@Model.Address</address>
 | 
					        <address>@Model.Address</address>
 | 
				
			||||||
    </div>
 | 
					    </div>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -4,9 +4,11 @@ namespace Elwig.Documents {
 | 
				
			|||||||
    public abstract class BusinessDocument : Document {
 | 
					    public abstract class BusinessDocument : Document {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        public Member Member;
 | 
					        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;
 | 
					            Member = m;
 | 
				
			||||||
 | 
					            IncludeSender = includeSender;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        public string Address {
 | 
					        public string Address {
 | 
				
			||||||
@@ -16,7 +18,7 @@ namespace Elwig.Documents {
 | 
				
			|||||||
                if (b != null) {
 | 
					                if (b != null) {
 | 
				
			||||||
                    return $"{b.Name}\n{b.Address}\n{plz.Plz} {plz.Dest}";
 | 
					                    return $"{b.Name}\n{b.Address}\n{plz.Plz} {plz.Dest}";
 | 
				
			||||||
                } else {
 | 
					                } else {
 | 
				
			||||||
                    return $"{Member.Name}\n{Member.Address}\n{plz.Plz} {plz.Dest}";
 | 
					                    return $"{Member.AdministrativeName}\n{Member.Address}\n{plz.Plz} {plz.Dest}";
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -7,15 +7,15 @@
 | 
				
			|||||||
<table>
 | 
					<table>
 | 
				
			||||||
<thead>
 | 
					<thead>
 | 
				
			||||||
<tr>
 | 
					<tr>
 | 
				
			||||||
    <td rowspan="2">Sorte</td>
 | 
					    <th rowspan="2">Sorte</th>
 | 
				
			||||||
    <td rowspan="2">Qualitätsstufe</td>
 | 
					    <th rowspan="2">Qualitätsstufe</th>
 | 
				
			||||||
    <td colspan="2">Gradation</td>
 | 
					    <th colspan="2">Gradation</th>
 | 
				
			||||||
    <td>Gewicht</td>
 | 
					    <th>Gewicht</th>
 | 
				
			||||||
</tr>
 | 
					</tr>
 | 
				
			||||||
<tr>
 | 
					<tr>
 | 
				
			||||||
    <td>°KMW</td>
 | 
					    <th>°KMW</th>
 | 
				
			||||||
    <td>°Oe</td>
 | 
					    <th>°Oe</th>
 | 
				
			||||||
    <td>kg</td>
 | 
					    <th>kg</th>
 | 
				
			||||||
</tr>
 | 
					</tr>
 | 
				
			||||||
</thead>
 | 
					</thead>
 | 
				
			||||||
<tbody>
 | 
					<tbody>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -11,8 +11,8 @@ namespace Elwig.Documents {
 | 
				
			|||||||
        public Document(string title) {
 | 
					        public Document(string title) {
 | 
				
			||||||
            DataPath = App.DataPath;
 | 
					            DataPath = App.DataPath;
 | 
				
			||||||
            Title = title;
 | 
					            Title = title;
 | 
				
			||||||
            Header = "<h1>Winzergenossenschaft Matzen</h1>";
 | 
					            Header = $"<h1>{App.Client.Name}</h1>";
 | 
				
			||||||
            Footer = "Winzergenossenschaft für Matzen und Umgebung reg. Gen.m.b.H.";
 | 
					            Footer = App.Client.NameFull;
 | 
				
			||||||
            Date = DateTime.Today;
 | 
					            Date = DateTime.Today;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										47
									
								
								Elwig/Helpers/ClientParameters.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										47
									
								
								Elwig/Helpers/ClientParameters.cs
									
									
									
									
									
										Normal file
									
								
							@@ -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";
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@@ -44,6 +44,13 @@ namespace Elwig.Models {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        public string ShortName => GivenName + " " + FamilyName;
 | 
					        public string ShortName => GivenName + " " + FamilyName;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        public string AdministrativeName =>
 | 
				
			||||||
 | 
					            FamilyName.ToUpper() + " " +
 | 
				
			||||||
 | 
					            (Prefix != null ? Prefix + " " : "") +
 | 
				
			||||||
 | 
					            GivenName +
 | 
				
			||||||
 | 
					            (MiddleName != null ? " " + MiddleName: "") +
 | 
				
			||||||
 | 
					            (Suffix != null ? " " + Suffix : "");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        [Column("birthday")]
 | 
					        [Column("birthday")]
 | 
				
			||||||
        public string? Birthday { get; set; }
 | 
					        public string? Birthday { get; set; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user