Files
jdescopingtool/OLD/DataModel/Config.cs
T
Joseph Doherty 427c488cd6 Strip JDE/CMS data-sync from OLD/ for v5 POC
Remove JDE/CMS source-system integration: JDE/CMS query classes, SQL files,
WorkerService UpdateProcessor pipeline, dsconfig data-source configs, and
Oracle/Sybase/DDTek driver references. WorkProcessor now goes straight to
processing queued searches against the existing local SQL Server cache; DB
schema (DataUpdate table, MatchMis function) is left intact.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-04 08:25:08 -04:00

73 lines
2.3 KiB
C#
Executable File

using System;
using System.Configuration;
using System.Text.RegularExpressions;
using DataModel.Helpers;
using static System.Configuration.ConfigurationManager;
namespace DataModel
{
/// <summary>
/// Application configuration
/// </summary>
public class Config
{
/// <summary>
/// Default query timeout (in seconds)
/// </summary>
public static int QueryTimeout
{
get
{
if (!_queryTimeout.HasValue)
{
try
{
string queryTimeoutStr = ConfigurationManager.AppSettings["querytimeout"];
_queryTimeout = int.Parse(queryTimeoutStr);
}
catch (Exception error)
{
throw new Exception("Failed to parse query timeout", error);
}
}
return _queryTimeout.Value;
}
}
private static int? _queryTimeout;
/// <summary>
/// Lot finder DB
/// </summary>
public static string LotFinderDBCS
{
get
{
if (string.IsNullOrEmpty(_lotFinderDBCS))
{
try
{
//Extract configured connection string
string encryptedCS = ConnectionStrings["LotFinderDB"].ConnectionString;
//Extract encrypted password and decrypt it
MatchCollection matches = Regex.Matches(encryptedCS, @"Password=([^\;;]+ {0,1})");
string encyptedPassword = matches[0].Groups[1].Value;
string decryptedPassword = EncryptionHelper.Decrypt(encyptedPassword, "JDESCOPETOOL");
//Update connection string with decyrpted password
_lotFinderDBCS = encryptedCS.Replace(encyptedPassword, decryptedPassword);
}
catch (Exception error)
{
throw new Exception("Failed to parse LotFinderDB connection string", error);
}
}
return _lotFinderDBCS;
}
}
private static string _lotFinderDBCS;
}
}