Examples of BaseExcepcion


Examples of upc.iluminados.excepcion.BaseExcepcion

                stmt.setDouble(2, vo.getTarifaDiurna());
                stmt.setDouble(3, vo.getTarifaNocturna());
                stmt.setInt(4, vo.getLocal().getId());
                int i = stmt.executeUpdate();
                if (i != 1) {
                    throw new BaseExcepcion("Error al insertar cancha");
                }
                keys = stmt.getGeneratedKeys();
                keys.next();
                idCancha = keys.getInt(1);
                vo.setId(idCancha);

            } catch (SQLException e) {
                System.err.println(e.getMessage());
                throw new BaseExcepcion(e.getMessage());
            } finally {
                this.cerrarResultSet(keys);
                this.cerrarStatement(stmt);
            }

            //Insertar horario
            query = "INSERT INTO tb_horariocancha(dia, hora,idCancha) VALUES (?,?,?)";
            for (HorarioCancha hc : lista) {
                try {
                    stmt = con.prepareStatement(query);
                    stmt.setString(1, hc.getDia());
                    stmt.setString(2, hc.getHora());
                    stmt.setInt(3, idCancha);
                    int i = stmt.executeUpdate();
                    if (i != 1) {
                        throw new BaseExcepcion("Error al insertar horario");
                    }
                } catch (SQLException e) {
                    System.err.println(e.getMessage());
                    throw new BaseExcepcion(e.getMessage());
                } finally {
                    this.cerrarStatement(stmt);
                }

            }
View Full Code Here

Examples of upc.iluminados.excepcion.BaseExcepcion

                vo.setTarifaDiurna(rs.getDouble(3));
                vo.setTarifaNocturna(rs.getDouble(4));
            }
        } catch (SQLException e) {
            System.err.println(e.getMessage());
            throw new BaseExcepcion(e.getMessage());
        } finally {
            this.cerrarResultSet(rs);
            this.cerrarStatement(stmt);
            this.cerrarConexion(con);
        }
View Full Code Here

Examples of upc.iluminados.excepcion.BaseExcepcion

                lista.add(vo);
            }
        } catch (SQLException e) {
            System.err.println(e.getMessage());
            throw new BaseExcepcion(e.getMessage());
        } finally {
            this.cerrarResultSet(rs);
            this.cerrarStatement(stmt);
            this.cerrarConexion(con);
        }
View Full Code Here

Examples of upc.iluminados.excepcion.BaseExcepcion

  private UsuarioDAO usuarioDAO = new UsuarioDAO();

    public void insertar(Usuario vo) throws BaseExcepcion{

        if (StringUtils.isEmpty(vo.getCorreo())) {
            throw new BaseExcepcion("Correo Requerido");
        }
        if (StringUtils.isEmpty(vo.getDni())) {
            throw new BaseExcepcion("Dni Requerido");
        }

        if (StringUtils.isEmpty(vo.getClave())) {
            throw new BaseExcepcion("Clave Requerida");
        }

        if (StringUtils.isEmpty(vo.getNombre())) {
            throw new BaseExcepcion("Nombres Requeridos");
        }
        if (StringUtils.isEmpty(vo.getApellidoPaterno())) {
            throw new BaseExcepcion("Apellido Paterno Requerido");
        }
        if (StringUtils.isEmpty(vo.getApellidoMaterno())) {
            throw new BaseExcepcion("Apellido Materno Requerido");
        }
        Usuario usuario = usuarioDAO.obtenerCorreo(vo.getCorreo());
        if (usuario != null) {
            throw new BaseExcepcion("El correo ya existe");
        }
        if (usuarioDAO.obtenerdni(vo.getDni()) != null) {
            throw new BaseExcepcion("El DNI ya existe");
        }

        usuarioDAO.insertar(vo);
    }
View Full Code Here

Examples of upc.iluminados.excepcion.BaseExcepcion

            if (i != 1) {
                throw new SQLException("No se pudo insertar");
            }
        } catch (SQLException e) {
            System.err.println(e.getMessage());
            throw new BaseExcepcion(e.getMessage());
        } finally {
            this.cerrarStatement(stmt);
            this.cerrarConexion(con);
        }
    }
View Full Code Here

Examples of upc.iluminados.excepcion.BaseExcepcion

//                vo.setTarifaNocturna(rs.getDouble(4));

            }
        } catch (SQLException e) {
            System.err.println(e.getMessage());
            throw new BaseExcepcion(e.getMessage());
        } finally {
            this.cerrarResultSet(rs);
            this.cerrarStatement(stmt);
            this.cerrarConexion(con);
        }
View Full Code Here

Examples of upc.iluminados.excepcion.BaseExcepcion

 
   private AlquilerCanchaDAO alquilerCanchaDAO = new AlquilerCanchaDAO();

    public void insertar(AlquilerCancha vo) throws BaseExcepcion {
        if (vo.getHorarioCancha().getCancha() == null || vo.getHorarioCancha().getCancha().getId() == null) {
              throw new BaseExcepcion("Cancha Requerido");
          }
        
          if (StringUtils.isEmpty(vo.getFecha())) {
              throw new BaseExcepcion("Fecha Requerido");
          }
         
          if (StringUtils.isEmpty(vo.getHoraFin())) {
              throw new BaseExcepcion("Hora Fin Requerido");
          }
         
         
          if (StringUtils.isEmpty(vo.getHoraInicio())) {
              throw new BaseExcepcion("Hora Inicio Requerido");
          }
 
          AlquilerCancha cancha = alquilerCanchaDAO.obtener(vo.getHorarioCancha().getId());
          if (cancha != null) {
              throw new BaseExcepcion("Identificador de Cancha ya existe");
          }
 
          alquilerCanchaDAO.insertar(vo);
    }
View Full Code Here

Examples of upc.iluminados.excepcion.BaseExcepcion

                lista.add(vo);
            }
        } catch (SQLException e) {
            System.err.println(e.getMessage());
            throw new BaseExcepcion(e.getMessage());
        } finally {
            this.cerrarResultSet(rs);
            this.cerrarStatement(stmt);
            this.cerrarConexion(con);
        }
View Full Code Here

Examples of upc.iluminados.excepcion.BaseExcepcion

            if (i != 1) {
                throw new SQLException("No se pudo insertar");
            }
        } catch (SQLException e) {
            System.err.println(e.getMessage());
            throw new BaseExcepcion(e.getMessage());
        } finally {
            this.cerrarStatement(stmt);
            this.cerrarConexion(con);
        }
    }
View Full Code Here

Examples of upc.iluminados.excepcion.BaseExcepcion

                vo.setApellidoMaterno(rs.getString(4));
              vo.setTipo(rs.getInt(5));
            }
        } catch (SQLException e) {
            System.err.println(e.getMessage());
            throw new BaseExcepcion(e.getMessage());
        } finally {
            this.cerrarResultSet(rs);
            this.cerrarStatement(stmt);
            this.cerrarConexion(con);
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.