private static SAFConfigurationParametersMap _CheckCache(int cacheSecs)
        {
            AppDomain domainCurr = AppDomain.CurrentDomain;
            SAFConfigurationParametersMap cacheData = domainCurr.GetData("ExpandSAFConfigurationDomainCache") as SAFConfigurationParametersMap;

            bool needsUpdate = false;

            if (cacheData == null)
            {
                needsUpdate = true;
            }
            else
            {
                TimeSpan elapsedSpan = DateTime.UtcNow - cacheData.LastUpdate;
                double   totSecs     = elapsedSpan.TotalSeconds;
                if (totSecs > (double)cacheSecs || totSecs < 0)
                {
                    needsUpdate = true;
                }
            }

            if (needsUpdate)
            {
                cacheData = GetAllParametersFromDB();
                if (cacheData == null)
                {
                    return(null);
                }

                cacheData.LastUpdate = DateTime.UtcNow;
                domainCurr.SetData("ExpandSAFConfigurationDomainCache", cacheData);
            }

            return(cacheData);
        }
        private static SAFConfigurationParametersMap GetAllParametersFromDB()
        {
            SAFConfigurationParametersMap cacheData = new SAFConfigurationParametersMap();

            try
            {
                string connStr = SAFConfiguration.readConnectionStringBusiness();

                using (IDbConnection connection = new SqlConnection(connStr))
                {
                    connection.Open();

                    using (IDbCommand command = connection.CreateCommand())
                    {
                        command.CommandType = CommandType.StoredProcedure;
                        command.CommandText = "GetAllConfiguration";

                        IDataReader dr = command.ExecuteReader(CommandBehavior.CloseConnection);
                        while (dr.Read())
                        {
                            SAFConfigurationParameter par = new SAFConfigurationParameter();
                            par.section       = dr.GetString(0);
                            par.name          = dr.GetString(1);
                            par.value         = dr.IsDBNull(2) ? null : dr.GetString(2);
                            par.lastUTCupdate = dr.GetDateTime(3);
                            par.frozen        = dr.GetBoolean(4);
                            par.hidden        = dr.GetBoolean(5);

                            string fullname = par.section + "@" + par.name;

                            cacheData.Add(fullname, par);
                        }
                    }
                }
                //All went fine
                return(cacheData);
            }
            catch (Exception ex)
            {
                LOGGER.Write(LOGGER.LogCategory.ERROR, "SF.Expand.SAF.Configuration.SAFConfiguration::GetAllParameters failed. Err:" + ex.Message, ex);
                return(null);
            }
        }
        private static string _readParameterBusiness(string parameterFullName, int cacheSecs)
        {
            SAFConfigurationParametersMap cacheData = _CheckCache(cacheSecs);

            if (cacheData == null)
            {
                return(null);
            }

            try
            {
                return((string)cacheData[parameterFullName].value);
            }
            catch (Exception ex)
            {
                LOGGER.Write(LOGGER.LogCategory.ERROR, "SF.Expand.SAF.Configuration.SAFConfiguration::readParameterBusinessChangeable error getting parameter[" +
                             parameterFullName + "]. Err:" + ex.Message, ex);
                return(null);
            }
        }