Refactored ConfigModel to use dependency injection for MSSQLServer and ILogger, removed BaseModel inheritance and constructor. Updated using directives and replaced Logger.Error with Logger.LogError for better error handling.
35 lines
1.2 KiB
C#
35 lines
1.2 KiB
C#
using DigitalData.Modules.Database;
|
|
using EnvelopeGenerator.ServiceHost.Extensions;
|
|
|
|
namespace EnvelopeGenerator.ServiceHost.Jobs;
|
|
|
|
public class ConfigModel(MSSQLServer Database, ILogger Logger)
|
|
{
|
|
public DbConfig LoadConfiguration()
|
|
{
|
|
try
|
|
{
|
|
const string sql = "SELECT TOP 1 * FROM TBSIG_CONFIG";
|
|
var table = Database.GetDatatable(sql);
|
|
var row = table.Rows[0];
|
|
|
|
return new DbConfig
|
|
{
|
|
DocumentPath = row.ItemEx("DOCUMENT_PATH", string.Empty),
|
|
DocumentPathOrigin = row.ItemEx("DOCUMENT_PATH", string.Empty),
|
|
ExportPath = row.ItemEx("EXPORT_PATH", string.Empty),
|
|
SendingProfile = row.ItemEx("SENDING_PROFILE", 0),
|
|
SignatureHost = row.ItemEx("SIGNATURE_HOST", string.Empty),
|
|
ExternalProgramName = row.ItemEx("EXTERNAL_PROGRAM_NAME", string.Empty),
|
|
Default_Tfa_Enabled = row.ItemEx("DEF_TFA_ENABLED", false),
|
|
Default_Tfa_WithPhone = row.ItemEx("DEF_TFA_WITH_PHONE", false)
|
|
};
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
Logger.LogError(ex);
|
|
return new DbConfig();
|
|
}
|
|
}
|
|
}
|