ZUGFeRD Service/WebService: Lesen/Auswertung neue Config-Schalter. GDPicture-Lizenz-Abfrage
This commit is contained in:
@@ -1,14 +1,10 @@
|
||||
using System;
|
||||
using DigitalData.Modules.Database;
|
||||
using DigitalData.Modules.Interfaces;
|
||||
using DigitalData.Modules.Config;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using DigitalData.Modules.Database;
|
||||
using DigitalData.Modules.Interfaces;
|
||||
using Microsoft.AspNetCore.Mvc.Formatters;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.Options;
|
||||
using DigitalData.Modules.Logging;
|
||||
|
||||
namespace ZUGFeRDRESTService
|
||||
{
|
||||
@@ -18,6 +14,11 @@ namespace ZUGFeRDRESTService
|
||||
private string _gdPictureKey = null;
|
||||
private Dictionary<string, XmlItemProperty> _propertyMap = null;
|
||||
|
||||
private LogConfig _logConfig = null;
|
||||
private string _connString;
|
||||
private string _GDPictureVersion;
|
||||
|
||||
|
||||
private const string QUERY_GET_GDPICTURE_KEY = "SELECT LICENSE FROM TBDD_3RD_PARTY_MODULES WHERE NAME = 'GDPICTURE'";
|
||||
private const string QUERY_GET_PROPERTY_MAP = "SELECT * FROM TBDD_ZUGFERD_XML_ITEMS WHERE ACTIVE = 1 ORDER BY XML_PATH";
|
||||
|
||||
@@ -25,12 +26,14 @@ namespace ZUGFeRDRESTService
|
||||
|
||||
public Database(ILogging Logging, IConfiguration Config)
|
||||
{
|
||||
var oLogConfig = Logging.LogConfig;
|
||||
_logConfig = Logging.LogConfig;
|
||||
var oLogger = Logging.LogConfig.GetLogger();
|
||||
var oAppConfig = Config.GetSection("Config");
|
||||
_connString = oAppConfig["MSSQLConnectionString"];
|
||||
_GDPictureVersion = oAppConfig["GDPictureVersion"];
|
||||
|
||||
oLogger.Debug("Establishing MSSQL Database connection..");
|
||||
MSSQL = new MSSQLServer(oLogConfig, oAppConfig["MSSQLConnectionString"]);
|
||||
MSSQL = new MSSQLServer(_logConfig, _connString);
|
||||
|
||||
oLogger.Debug("MSSQL Connection: [{0}]", MSSQL.CurrentConnectionString);
|
||||
|
||||
@@ -39,8 +42,7 @@ namespace ZUGFeRDRESTService
|
||||
|
||||
public string GetGDPictureKey()
|
||||
{
|
||||
if (_gdPictureKey == null)
|
||||
_gdPictureKey = MSSQL.GetScalarValue(QUERY_GET_GDPICTURE_KEY).ToString();
|
||||
_gdPictureKey = ConfigDbFunct.GetProductLicense("GDPICTURE", _GDPictureVersion, _logConfig, _connString);
|
||||
|
||||
return _gdPictureKey;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user