From f6fc6fe7dce50bdb87eda083a84c94c2d7218ee2 Mon Sep 17 00:00:00 2001 From: Jonathan Jenne Date: Tue, 28 Feb 2023 14:34:46 +0100 Subject: [PATCH] ZUGFeRDRESTService: Add specification, add logging --- WEBSERVICES/ZUGFeRDRESTService/Database.cs | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/WEBSERVICES/ZUGFeRDRESTService/Database.cs b/WEBSERVICES/ZUGFeRDRESTService/Database.cs index da034d25..ac19132a 100644 --- a/WEBSERVICES/ZUGFeRDRESTService/Database.cs +++ b/WEBSERVICES/ZUGFeRDRESTService/Database.cs @@ -14,6 +14,7 @@ namespace ZUGFeRDRESTService { public class Database: IDatabase { + private DigitalData.Modules.Logging.Logger _Logger = null; private string _gdPictureKey = null; private Dictionary _propertyMap = null; @@ -42,6 +43,8 @@ namespace ZUGFeRDRESTService oLogger.Debug("MSSQL Connection: [{0}]", MSSQL.CurrentConnectionString); oLogger.Debug("Firebird Connection: [{0}]", Firebird.ConnectionString); + + _Logger = oLogger; } public string GetGDPictureKey() @@ -52,12 +55,16 @@ namespace ZUGFeRDRESTService return _gdPictureKey; } - public Dictionary GetPropertyMap() + public Dictionary GetPropertyMap() { if (_propertyMap == null) { + _Logger.Debug("Property map does not exist, creating."); + _propertyMap = new Dictionary(); - var oDatatable = Firebird.GetDatatable(string.Format(QUERY_GET_PROPERTY_MAP, "DEFAULT")); + var oDatatable = Firebird.GetDatatable(QUERY_GET_PROPERTY_MAP); + + _Logger.Debug("Datatable Rows: [{0}]", oDatatable.Rows); foreach (DataRow oRow in oDatatable.Rows) { @@ -68,10 +75,16 @@ namespace ZUGFeRDRESTService TableColumn = oRow["TABLE_COLUMN"].ToString(), GroupScope = oRow["GROUP_SCOPE"].ToString(), IsRequired = (bool)oRow["IS_REQUIRED"], - IsGrouped = (bool)oRow["IS_GROUPED"] + IsGrouped = (bool)oRow["IS_GROUPED"], + Specification = oRow["SPECIFICATION"].ToString() }); } - } + } else + { + _Logger.Debug("Property map already exists, returning."); + } + + _Logger.Debug("Returning Property Map with [{0}] entries.", _propertyMap.Count); return _propertyMap; }