diff --git a/src/com/rjconsultores/ventaboletos/dao/CategoriaCtrlDAO.java b/src/com/rjconsultores/ventaboletos/dao/CategoriaCtrlDAO.java index 7a34ef59d..26c28f5de 100644 --- a/src/com/rjconsultores/ventaboletos/dao/CategoriaCtrlDAO.java +++ b/src/com/rjconsultores/ventaboletos/dao/CategoriaCtrlDAO.java @@ -4,6 +4,8 @@ */ package com.rjconsultores.ventaboletos.dao; +import java.util.List; + import com.rjconsultores.ventaboletos.entidad.CategoriaCtrl; /** @@ -11,4 +13,5 @@ import com.rjconsultores.ventaboletos.entidad.CategoriaCtrl; * @author Administrador */ public interface CategoriaCtrlDAO extends GenericDAO { + } diff --git a/src/com/rjconsultores/ventaboletos/dao/PuntoVentaDAO.java b/src/com/rjconsultores/ventaboletos/dao/PuntoVentaDAO.java index 98b560ce0..789c7c956 100644 --- a/src/com/rjconsultores/ventaboletos/dao/PuntoVentaDAO.java +++ b/src/com/rjconsultores/ventaboletos/dao/PuntoVentaDAO.java @@ -4,6 +4,7 @@ */ package com.rjconsultores.ventaboletos.dao; +import com.rjconsultores.ventaboletos.entidad.Parada; import com.rjconsultores.ventaboletos.entidad.PuntoVenta; import java.util.List; @@ -17,4 +18,5 @@ public interface PuntoVentaDAO extends GenericDAO { public List busca(String nomPuntoVenta, Integer numPuntoVenta); public List buscaPuntoVenta(Integer numPuntoVenta); + public List buscaPuntoVentaParada(Parada parada); } diff --git a/src/com/rjconsultores/ventaboletos/dao/UsuarioEmpresaDAO.java b/src/com/rjconsultores/ventaboletos/dao/UsuarioEmpresaDAO.java index d5d53369c..13fba99a3 100644 --- a/src/com/rjconsultores/ventaboletos/dao/UsuarioEmpresaDAO.java +++ b/src/com/rjconsultores/ventaboletos/dao/UsuarioEmpresaDAO.java @@ -10,5 +10,5 @@ public interface UsuarioEmpresaDAO extends GenericDAO { public List obtenerPorUsuario(Usuario usuario); public List obtenerEmpresa(Usuario usuario) ; - public List obtenerPorEmpresaUsuario(Empresa empresa, Usuario usuario); + public Boolean obtenerPorEmpresaUsuario(Empresa empresa, Usuario usuario); } diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/PuntoVentaHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/PuntoVentaHibernateDAO.java index aaaa88e76..44428bbb2 100644 --- a/src/com/rjconsultores/ventaboletos/dao/hibernate/PuntoVentaHibernateDAO.java +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/PuntoVentaHibernateDAO.java @@ -5,6 +5,7 @@ package com.rjconsultores.ventaboletos.dao.hibernate; import com.rjconsultores.ventaboletos.dao.PuntoVentaDAO; +import com.rjconsultores.ventaboletos.entidad.Parada; import com.rjconsultores.ventaboletos.entidad.PuntoVenta; import java.util.List; import org.hibernate.criterion.Order; @@ -65,4 +66,15 @@ public class PuntoVentaHibernateDAO extends GenericHibernateDAO buscaPuntoVentaParada(Parada parada){ + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("parada", parada)); + if (!c.list().isEmpty()){ + return c.list(); + }else{ + return null; + } + } } diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/UsuarioEmpresaHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/UsuarioEmpresaHibernateDAO.java index a36197ac5..7d5b1b64a 100644 --- a/src/com/rjconsultores/ventaboletos/dao/hibernate/UsuarioEmpresaHibernateDAO.java +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/UsuarioEmpresaHibernateDAO.java @@ -42,13 +42,16 @@ public class UsuarioEmpresaHibernateDAO extends GenericHibernateDAO obtenerPorEmpresaUsuario(Empresa empresa, Usuario usuario) { + public Boolean obtenerPorEmpresaUsuario(Empresa empresa, Usuario usuario) { Criteria c = getSession().createCriteria(getPersistentClass()); c.add(Restrictions.eq("activo", Boolean.TRUE)); c.add(Restrictions.eq("empresa", empresa)); c.add(Restrictions.eq("usuarioLog", usuario)); - - return c.list(); + if(!c.list().isEmpty()){ + return true; + }else{ + return false; + } } public List obtenerEmpresa(Usuario usuario) { diff --git a/src/com/rjconsultores/ventaboletos/service/PuntoVentaService.java b/src/com/rjconsultores/ventaboletos/service/PuntoVentaService.java index b86f67c1e..0691bf4ef 100644 --- a/src/com/rjconsultores/ventaboletos/service/PuntoVentaService.java +++ b/src/com/rjconsultores/ventaboletos/service/PuntoVentaService.java @@ -4,6 +4,7 @@ */ package com.rjconsultores.ventaboletos.service; +import com.rjconsultores.ventaboletos.entidad.Parada; import com.rjconsultores.ventaboletos.entidad.PuntoVenta; import java.util.List; @@ -17,4 +18,5 @@ public interface PuntoVentaService extends GenericService { public List buscar(String nomPuntoVenta, Integer numPuntoVenta); public List buscaPuntoVenta(Integer numPuntoVenta); + public List buscaPuntoVentaParada(Parada paradaId); } diff --git a/src/com/rjconsultores/ventaboletos/service/UsuarioEmpresaService.java b/src/com/rjconsultores/ventaboletos/service/UsuarioEmpresaService.java index 7e11687fe..b8b979b62 100644 --- a/src/com/rjconsultores/ventaboletos/service/UsuarioEmpresaService.java +++ b/src/com/rjconsultores/ventaboletos/service/UsuarioEmpresaService.java @@ -10,7 +10,7 @@ public interface UsuarioEmpresaService extends GenericService obtenerPorUsuario(Usuario usuario); public List obtenerEmpresa(Usuario usuario) ; - public List obtenerPorEmpresaUsuario(Empresa empresa, Usuario usuario); + public Boolean obtenerPorEmpresaUsuario(Empresa empresa, Usuario usuario); } diff --git a/src/com/rjconsultores/ventaboletos/service/impl/PuntoVentaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/PuntoVentaServiceImpl.java index 4f0a528a1..480872559 100644 --- a/src/com/rjconsultores/ventaboletos/service/impl/PuntoVentaServiceImpl.java +++ b/src/com/rjconsultores/ventaboletos/service/impl/PuntoVentaServiceImpl.java @@ -6,6 +6,7 @@ package com.rjconsultores.ventaboletos.service.impl; import com.rjconsultores.ventaboletos.dao.PuntoVentaDAO; import com.rjconsultores.ventaboletos.entidad.FormaPagoDet; +import com.rjconsultores.ventaboletos.entidad.Parada; import com.rjconsultores.ventaboletos.entidad.PtovtaEmpresa; import com.rjconsultores.ventaboletos.entidad.PtovtaEstoque; import com.rjconsultores.ventaboletos.entidad.PuntoVenta; @@ -116,4 +117,8 @@ public class PuntoVentaServiceImpl implements PuntoVentaService { public List buscaPuntoVenta(Integer numPuntoVenta) { return puntoVentaDAO.buscaPuntoVenta(numPuntoVenta); } + + public List buscaPuntoVentaParada(Parada paradaId) { + return puntoVentaDAO.buscaPuntoVentaParada(paradaId); + } } diff --git a/src/com/rjconsultores/ventaboletos/service/impl/UsuarioEmpresaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/UsuarioEmpresaServiceImpl.java index 8bc1e9f3c..fca54cd5c 100644 --- a/src/com/rjconsultores/ventaboletos/service/impl/UsuarioEmpresaServiceImpl.java +++ b/src/com/rjconsultores/ventaboletos/service/impl/UsuarioEmpresaServiceImpl.java @@ -65,7 +65,7 @@ public class UsuarioEmpresaServiceImpl implements UsuarioEmpresaService { return usuarioEmpresaDAO.obtenerEmpresa(usuario); } - public List obtenerPorEmpresaUsuario(Empresa empresa, Usuario usuario) { + public Boolean obtenerPorEmpresaUsuario(Empresa empresa, Usuario usuario) { return usuarioEmpresaDAO.obtenerPorEmpresaUsuario( empresa, usuario); }