Beispiel #1
0
        public static void SetSqlSettingValue(string strName, string strValue, SQLDataAccess db)
        {
            SetSqlSettingValueFromDB(strName, strValue, db);

            // Add into cahce
            string strCacheName = CacheNames.GetCommonSettingsCacheObjectName(strName);

            CacheManager.Insert(strCacheName, strValue);
        }
Beispiel #2
0
        public static bool RemoveSqlSetting(string strKey)
        {
            SQLDataAccess.ExecuteNonQuery("DELETE FROM [Settings].[Settings] WHERE [Name]=@Name", CommandType.Text, new SqlParameter("@Name", strKey));

            // Clear cache object
            string strCacheName = CacheNames.GetCommonSettingsCacheObjectName(strKey);

            CacheManager.Remove(strCacheName);
            return(true);
        }
Beispiel #3
0
        /// <summary>
        /// Save settings into DB
        /// </summary>
        /// <param name="strName"></param>
        /// <param name="strValue"></param>
        /// <remarks></remarks>
        public static bool SetSqlSettingValue(string strName, string strValue)
        {
            bool boolReult = SetSqlSettingValueFromDB(strName, strValue);

            // Add into cahce
            string strCacheName = CacheNames.GetCommonSettingsCacheObjectName(strName);

            CacheManager.Insert(strCacheName, strValue);

            return(boolReult);
        }
Beispiel #4
0
        /// <summary>
        /// Read settings from DB.
        /// On Err: Function will return Nothing
        /// </summary>
        /// <param name="strName"></param>
        /// <returns></returns>
        /// <remarks></remarks>
        public static string GetSqlSettingValue(string strName)
        {
            string strRes;

            string strCacheName = CacheNames.GetCommonSettingsCacheObjectName(strName);

            if (CacheManager.Contains(strCacheName))
            {
                strRes = CacheManager.Get <string>(strCacheName);
            }
            else
            {
                strRes = GetSqlSettingValueFromDB(strName);

                if (strRes != null)
                {
                    CacheManager.Insert(strCacheName, strRes);
                }
            }

            return(strRes);
        }