Compare commits

..

No commits in common. "8d1d8db6a0dac222212e914fc6711143aab2fbf4" and "7f5aadd12859c63385b094efc9b518dc482a258a" have entirely different histories.

2 changed files with 1 additions and 133 deletions

View File

@ -1,127 +0,0 @@
package mx.uv.Controller;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;
import mx.uv.Model.Tutor;
public class DAOTutor {
private static Conexion cn = Conexion.getInstance();
public static List<Tutor> dameTutores() {
Statement stm = null;
ResultSet rs = null;
Connection conn = null;
List<Tutor> resultado = new ArrayList<>();
conn = cn.conectar();
try {
String sql = "SELECT * from tutor";
stm = conn.createStatement();
rs = stm.executeQuery(sql);
while (rs.next()) {
Tutor u = new Tutor(rs.getInt(1), rs.getString(2), rs.getString(3),rs.getString(4), rs.getString(5),rs.getString(6));
resultado.add(u);
}
} catch (Exception e) {
System.out.println(e);
} finally {
cerrarConexiones(null, conn);
}
return resultado;
}
public static boolean validarTutor(Tutor tutor){
Statement stm = null;
Connection conn = null;
boolean verificacion =false;
ResultSet rs = null;
conn = cn.conectar();
try {
String sql ="select * from tutor "
+ "where id= '"+tutor.getId()+"' and nombre='"+tutor.getNombre()+"'";
stm = (Statement) conn.createStatement();
rs = stm.executeQuery(sql);
if(rs.next()){
verificacion = true;
}else{
verificacion = false;
}
conn.close();
} catch (Exception ex) {
System.err.println(ex);
}
return verificacion;
}
public static boolean agregarTutor(Tutor tutor) {
PreparedStatement stm = null;
Connection conn = null;
boolean msj = false;
conn = cn.conectar();
try {
String sql = "INSERT INTO `tutor`(`nombre`,`apellido`,`parentesco`,`ocupacion`,`telefono`)VALUES(?,?,?,?,?);";
stm = (PreparedStatement) conn.prepareStatement(sql);
stm.setString(1, tutor.getNombre());
stm.setString(2, tutor.getApellido());
stm.setString(3, tutor.getParentesco());
stm.setString(4, tutor.getOcupacion());
stm.setString(5, tutor.getTelefono());
} catch (Exception e) {
System.out.println(e);
} finally {
//cerrarConexiones(stm, conn);
}
return msj;
}
private static void cerrarConexiones(PreparedStatement stm, Connection conn){
if(stm != null){
try {
stm.close();
} catch (Exception e) {
System.out.println(e);
}
stm = null;
}
try{
conn.close();
cn.cerrarConexion();
} catch (Exception e) {
System.out.println(e);
}
}
public static boolean eliminarTutor(Tutor tutor) {
return false;
}
public static boolean editarTutor(Tutor tutor) {
PreparedStatement stm = null;
Connection conn = null;
boolean verificacion = false;
conn = cn.conectar();
try{
String sql ="UPDATE `tutor` SET `nombre` = '"+tutor.getNombre()+"',`apellido` = '"+tutor.getApellido()+"',`parentesco` = '"+tutor.getParentesco()+"',`ocupacion` = '"+tutor.getOcupacion()+"', `telefono` = '"+tutor.getTelefono()+"';";
stm = conn.prepareStatement(sql);
stm.executeQuery();
verificacion = true;
} catch (SQLException ex){
System.out.println(ex);
} finally {
cerrarConexiones(stm, conn);
cn.cerrarConexion();
}
return verificacion;
}
}

View File

@ -2,14 +2,9 @@ import React from 'react'
import ReactDOM from 'react-dom/client'
import OfertaEducativa from './OfertaEducativa.jsx'
import './Registro.css'
import './login.css'
ReactDOM.createRoot(document.getElementById('root')).render(
<React.StrictMode>
<OfertaEducativa/>
<General/>
</React.StrictMode>,
)