public static Perfil Get(PerfilType perfilType) { switch (perfilType) { case PerfilType.Aplicacion: return(Query.GetPerfiles().Single <Perfil>(x => x.Clave == "aplicacion")); case PerfilType.Empresa: return(Query.GetPerfiles().Single <Perfil>(x => x.Clave == "empresa")); case PerfilType.Sostenedor: return(Query.GetPerfiles().Single <Perfil>(x => x.Clave == "sostenedor")); case PerfilType.CentroCosto: return(Query.GetPerfiles().Single <Perfil>(x => x.Clave == "centro_costo")); case PerfilType.Establecimiento: return(Query.GetPerfiles().Single <Perfil>(x => x.Clave == "establecimiento")); case PerfilType.Ano: return(Query.GetPerfiles().Single <Perfil>(x => x.Clave == "ano")); case PerfilType.AnoMes: return(Query.GetPerfiles().Single <Perfil>(x => x.Clave == "ano_mes")); case PerfilType.PeriodoRemuneracion: return(Query.GetPerfiles().Single <Perfil>(x => x.Clave == "periodo_remuneracion")); case PerfilType.PeriodoTributario: return(Query.GetPerfiles().Single <Perfil>(x => x.Clave == "periodo_tributario")); default: return(null); } }
public static bool RequireProfile(Aplicacion aplicacion, PerfilType perfilType) { if (aplicacion == null) { return(false); } Perfil perfil = Perfil.Get(perfilType); return(AplicacionPerfil.Exists(aplicacion, perfil)); }