Example #1
0
        /// <summary>
        ///Individual setting based on application key.
        /// </summary>
        /// <param name="Key">Application key.</param>
        /// <returns>Return settings based on application key.</returns>
        public string GetSettingsByKeyIndividual(string Key)
        {
            try
            {
                string          strValue = string.Empty;
                SettingProvider sep      = new SettingProvider();
                Hashtable       hst      = new Hashtable();
                if (HttpRuntime.Cache[CacheKeys.SageSetting] != null)
                {
                    hst = (Hashtable)HttpRuntime.Cache[CacheKeys.SageSetting];
                }
                else
                {
                    DataTable dt = sep.GetSettingsByPortal("1", string.Empty); //GetSettingsByPortal();
                    if (dt != null && dt.Rows.Count > 0)
                    {
                        for (int i = 0; i < dt.Rows.Count; i++)
                        {
                            hst.Add(dt.Rows[i]["SettingKey"].ToString(), dt.Rows[i]["SettingValue"].ToString());
                        }
                    }
                }
                //need to be cleared when any key is chnaged
                HttpRuntime.Cache.Insert(CacheKeys.SageSetting, hst);//
                strValue = hst[SettingPortal + "." + Key].ToString();
                return(strValue);
            }

            catch (Exception e)
            {
                throw e;
            }
        }
Example #2
0
        private void BindPortalSetting()
        {
            Hashtable       hst = new Hashtable();
            SettingProvider sep = new SettingProvider();
            DataTable       dt  = sep.GetSettingsByPortal(GetPortalID.ToString(), string.Empty); //GetSettingsByPortal();

            if (dt != null && dt.Rows.Count > 0)
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    hst.Add(dt.Rows[i]["SettingKey"].ToString(), dt.Rows[i]["SettingValue"].ToString());
                }
            }
            HttpContext.Current.Cache.Insert("SageSetting", hst);
        }
Example #3
0
        /// <summary>
        /// Resetsetting keys based on portal ID.
        /// </summary>
        /// <param name="PortalID">PortalID</param>
        public void ResetSettingKeys(int PortalID)
        {
            SettingProvider sep = new SettingProvider();
            Hashtable       hst = new Hashtable();
            DataTable       dt  = sep.GetSettingsByPortal(PortalID.ToString(), string.Empty);

            if (dt != null && dt.Rows.Count > 0)
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    hst.Add(dt.Rows[i]["SettingKey"].ToString(), dt.Rows[i]["SettingValue"].ToString());
                }
            }
            //need to be cleared when any key is chnaged
            HttpRuntime.Cache.Insert(CacheKeys.SageSetting, hst);//
        }