Load client parameters from database

This commit is contained in:
2023-08-17 16:39:05 +02:00
parent 258b2b3c5b
commit 3ab2b8a8dc
2 changed files with 51 additions and 29 deletions

View File

@ -61,15 +61,21 @@ namespace Elwig {
if (!ctx.Database.CanConnect()) {
MessageBox.Show($"Invalid Database:\n\n{Config.DatabaseFile}", "Invalid Database", MessageBoxButton.OK, MessageBoxImage.Error);
Shutdown();
return;
} else {
branches = ctx.Branches.ToDictionary(b => b.Name.ToLower(), b => (b.ZwstId, b.Name, b.PostalDest?.AtPlz?.Plz, b.PostalDest?.AtPlz?.Dest, b.Address, b.PhoneNr, b.FaxNr, b.MobileNr));
try {
Client = new(ctx);
} catch (Exception e) {
MessageBox.Show($"Fehler beim Laden der Mandantendaten:\n\n{e.Message}", "Fehler");
Shutdown();
return;
}
}
}
Utils.RunBackground("HTML Initialization", () => Documents.Html.Init(PrintingReadyChanged));
Utils.RunBackground("PDF Initialization", () => Documents.Pdf.Init(PrintingReadyChanged));
Client = new();
var list = new List<IScale>();
foreach (var s in Config.Scales) {
try {