Exemplo n.º 1
0
        public string GetProperty(string code, string def, string guid = "")
        {
            string res = def;

            CoreManager mng      = new CoreManager();
            Guid        userGuid = Guid.Empty;

            if (guid == "")
            {
                userGuid = mng.GetUserGuid();
            }
            else
            {
                userGuid = new Guid(guid);
            }

            string key = "as_profile_prop_code_" + code + "_user_" + userGuid + "_def_" + def;

            if (CacheManager.EnableCaching && CacheManager.Cache[key] != null)
            {
                res = CacheManager.Cache[key].ToString();
            }
            else
            {
                var item = db.GetProfileProperty(code);
                if (item != null)
                {
                    var itemVal = db.GetProfilePropertyValue(item.id, userGuid);
                    if (itemVal != null)
                    {
                        res = itemVal.value;
                    }
                }
                CacheManager.CacheData(key, res);
            }
            return(res);
        }