示例#1
0
        public Fato Obter(int id)
        {
            try
            {
                Fato   resultado;
                string cacheKey = string.Format("Fato{0}", id);

                if (!GerenciadorCache.Get(cacheKey, out resultado))
                {
                    resultado = _da.Obter(id);
                    ObterCamposListas(resultado);
                    GerenciadorCache.SetCache(cacheKey, resultado);
                }
                else
                {
                    ObterCamposDinamicos(resultado);
                    ObterCamposListas(resultado);
                }

                return(resultado);
            }
            catch (Exception exc)
            {
                Validacao.AddErro(exc);
            }

            return(null);
        }
示例#2
0
        public List <Lista> ObterFonteDados()
        {
            try
            {
                List <Lista> resultado;
                string       cacheKey = "FatosDoSistema";

                if (!GerenciadorCache.Get(cacheKey, out resultado))
                {
                    resultado = _da.ObterFonteDados();
                    GerenciadorCache.SetCache(cacheKey, resultado);
                }

                return(resultado);
            }
            catch (Exception exc)
            {
                Validacao.AddErro(exc);
            }

            return(null);
        }