コード例 #1
0
        public static string ObterValor(this Enum enumerator)
        {
            MemberInfo memberInfo = enumerator.GetType().GetMember(enumerator.ToString()).FirstOrDefault();

            if (memberInfo != null)
            {
                KVAttribute attribute = (KVAttribute)memberInfo.GetCustomAttributes(typeof(KVAttribute), false).FirstOrDefault();
                return(attribute.Key);
            }
            return(String.Empty);
        }
コード例 #2
0
        private static bool VerificaPermissaoAcesso()
        {
            if (HttpContext.Current.Application[Constantes.CONSTANTE_APLICACAO_PAGINAS] != null)
            {
                List <KVAttribute> paginas = (List <KVAttribute>)HttpContext.Current.Application[Constantes.CONSTANTE_APLICACAO_PAGINAS];
                KVAttribute        pagina  = paginas.FirstOrDefault(
                    p => p.Key == HttpContext.Current.Request.AppRelativeCurrentExecutionFilePath &&
                    (p.Value == "0" || SessaoUsuario != null &&
                     (p.Value == "1" && SessaoUsuario.TipoUsuario == TipoUsuario.Taxista || p.Value == "2" && SessaoUsuario.TipoUsuario == TipoUsuario.Cliente)
                    )
                    );

                return(pagina != null);
            }
            return(false);
        }