public List <PerfilBe> ListarPerfilPorUsuario(int empresaId, int usuarioId, bool loadListaOpcion = false) { List <PerfilBe> lista = null; try { cn.Open(); lista = perfilDa.ListarPorUsuario(usuarioId, empresaId, cn); if (lista != null) { if (loadListaOpcion) { foreach (var itemPerfil in lista) { itemPerfil.ListaOpcion = opcionDa.ListarPorPerfil(itemPerfil.PerfilId, empresaId, cn); } } } } catch (Exception ex) { throw ex; } finally { if (cn.State == ConnectionState.Open) { cn.Close(); } } return(lista); }
public UsuarioBe ObtenerUsuarioPorNombre(string nombre, int?empresaId, bool loadListaPerfil = false, bool loadListaOpcionxPerfil = false, bool LoadListaSede = false) { UsuarioBe item = null; try { cn.Open(); item = usuarioDa.ObtenerPorNombre(nombre, empresaId, cn); if (item != null) { if (loadListaPerfil) { item.ListaPerfil = perfilDa.ListarPorUsuario(item.UsuarioId, item.EmpresaId.Value, cn); } if (item.ListaPerfil != null) { if (loadListaOpcionxPerfil) { foreach (var itemPerfil in item.ListaPerfil) { itemPerfil.ListaOpcion = opcionDa.ListarPorPerfil(itemPerfil.PerfilId, item.EmpresaId.Value, cn); } } } if (LoadListaSede) { item.ListaSede = sedeDa.ListarPorUsuario(item.UsuarioId, item.EmpresaId.Value, cn); } } } catch (Exception ex) { throw ex; } finally { if (cn.State == ConnectionState.Open) { cn.Close(); } } return(item); }
public List <OpcionBe> ListarOpcionPorPerfil(int empresaId, int perfilId) { List <OpcionBe> lista = null; try { cn.Open(); lista = opcionDa.ListarPorPerfil(perfilId, empresaId, cn); } catch (Exception ex) { throw ex; } finally { if (cn.State == ConnectionState.Open) { cn.Close(); } } return(lista); }