[EDIT] CAMBIOS PARA MYSQL EN PROGRESO

parent 5da179ab
...@@ -68,13 +68,18 @@ ...@@ -68,13 +68,18 @@
<dependency> <dependency>
<groupId>org.json</groupId> <groupId>org.json</groupId>
<artifactId>json</artifactId> <artifactId>json</artifactId>
<version>20171018</version> <version>20230618</version>
</dependency> </dependency>
<!-- https://mvnrepository.com/artifact/com.microsoft.sqlserver/sqljdbc42 --> <!-- https://mvnrepository.com/artifact/com.microsoft.sqlserver/sqljdbc42 -->
<dependency> <!-- <dependency>
<groupId>com.microsoft.sqlserver</groupId> <groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId> <artifactId>mssql-jdbc</artifactId>
<version>6.1.0.jre8</version> <version>6.1.0.jre8</version>
</dependency> -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.44</version>
</dependency> </dependency>
</dependencies> </dependencies>
...@@ -127,17 +132,7 @@ ...@@ -127,17 +132,7 @@
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
<!-- <plugin>-->
<!-- <groupId>org.wildfly.plugins</groupId>-->
<!-- <artifactId>wildfly-maven-plugin</artifactId>-->
<!-- <version>3.0.2.Final</version>-->
<!-- <configuration>-->
<!-- <hostname>172.16.1.33</hostname>-->
<!-- <port>9990</port>-->
<!-- <username>wildfly</username>-->
<!-- <password>Saco1357$</password>-->
<!-- </configuration>-->
<!-- </plugin>-->
</plugins> </plugins>
</build> </build>
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
*/ */
package com.mycompany.moduloseguridad.dao; package com.mycompany.moduloseguridad.dao;
import com.mycompany.moduloseguridad.sqlserverdao.SqlServerDAOFactory; import com.mycompany.moduloseguridad.mysqldao.MySQLDAOFactory;
/** /**
* *
...@@ -13,16 +13,13 @@ import com.mycompany.moduloseguridad.sqlserverdao.SqlServerDAOFactory; ...@@ -13,16 +13,13 @@ import com.mycompany.moduloseguridad.sqlserverdao.SqlServerDAOFactory;
*/ */
public abstract class DAOFactory { public abstract class DAOFactory {
public static final int SQLSERVER = 1; public static final int MYSQL = 1;
public static final int MYSQL = 2;
public static DAOFactory getDAOFactory(int Motor_Base) { public static DAOFactory getDAOFactory(int Motor_Base) {
switch (Motor_Base) { if (Motor_Base == MYSQL) {
case SQLSERVER: return new MySQLDAOFactory();
return new SqlServerDAOFactory();
default:
return null;
} }
return null;
} }
public abstract TipoUsuarioDAO getTipoUsuario(); public abstract TipoUsuarioDAO getTipoUsuario();
......
...@@ -14,7 +14,7 @@ import org.json.JSONObject; ...@@ -14,7 +14,7 @@ import org.json.JSONObject;
*/ */
public interface MenuDAO { public interface MenuDAO {
public JSONArray listarProyecto() throws Exception; public JSONArray listarProyecto(int estado) throws Exception;
public JSONArray listarTipoDeUsuario(int proyecto) throws Exception; public JSONArray listarTipoDeUsuario(int proyecto) throws Exception;
......
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.mycompany.moduloseguridad.dao; package com.mycompany.moduloseguridad.dao;
import org.json.JSONObject; import org.json.JSONObject;
/**
*
* @author sistem17user
*/
public interface TipoUsuarioDAO { public interface TipoUsuarioDAO {
public JSONObject listarProyectos() throws Exception; JSONObject listarProyectos() throws Exception;
public JSONObject listarTiposUsuarios(int codigoProyecto) throws Exception; JSONObject listarTiposUsuarios(int codigoProyecto) throws Exception;
public JSONObject asignarAcciones(JSONObject datos) throws Exception; JSONObject asignarAcciones(JSONObject datos) throws Exception;
public JSONObject activarDesactivarAccion(JSONObject datos) throws Exception; JSONObject activarDesactivarAccion(JSONObject datos) throws Exception;
public JSONObject activarDesactivarTipoUsuario(JSONObject datos) throws Exception; JSONObject activarDesactivarTipoUsuario(JSONObject datos) throws Exception;
public JSONObject listarAcciones(JSONObject datos) throws Exception; JSONObject listarAcciones(JSONObject datos) throws Exception;
public JSONObject listarCboAcciones() throws Exception; JSONObject listarCboAcciones() throws Exception;
public JSONObject listadoPrincipal(String filtro, int filtrado, int proyecto, int vstart, int vlength, String draw) throws Exception; JSONObject listadoPrincipal(String filtro, int filtrado, int proyecto, int vstart, int vlength, String draw, int estado) throws Exception;
public int activarTipoUsuario(int codigo) throws Exception; int activarTipoUsuario(int codigo) throws Exception;
public int desactivarTipoUsuario(int codigo) throws Exception; int desactivarTipoUsuario(int codigo) throws Exception;
public int editarTipoUsuario(int codigo, String nombre) throws Exception; int editarTipoUsuario(int codigo, String nombre) throws Exception;
public int crearTipoUsuario(String nombre) throws Exception; int crearTipoUsuario(String nombre) throws Exception;
public int validarTipoUsuario(int codigo) throws Exception; int validarTipoUsuario(int codigo) throws Exception;
public int validarNombreTipoUsuario(String nombreInicial, String nombreIngreso, int tipo) throws Exception; int validarNombreTipoUsuario(String nombreInicial, String nombreIngreso, int tipo) throws Exception;
} }
\ No newline at end of file
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* To change this template file, choose Tools | Templates * To change this template file, choose Tools | Templates
* and open the template in the editor. * and open the template in the editor.
*/ */
package com.mycompany.moduloseguridad.sqlserverdao; package com.mycompany.moduloseguridad.mysqldao;
import java.sql.Connection; import java.sql.Connection;
import java.sql.DriverManager; import java.sql.DriverManager;
...@@ -14,12 +14,7 @@ import com.mycompany.moduloseguridad.dao.TipoUsuarioDAO; ...@@ -14,12 +14,7 @@ import com.mycompany.moduloseguridad.dao.TipoUsuarioDAO;
import com.mycompany.moduloseguridad.dao.UsuarioDAO; import com.mycompany.moduloseguridad.dao.UsuarioDAO;
import com.mycompany.moduloseguridad.utilities.dotenSrv; import com.mycompany.moduloseguridad.utilities.dotenSrv;
/** public class MySQLDAOFactory extends DAOFactory {
*
* @author Felipe
*
*/
public class SqlServerDAOFactory extends DAOFactory {
public static Connection getConnectionSQL(String base) { public static Connection getConnectionSQL(String base) {
Connection conexion = null; Connection conexion = null;
...@@ -29,18 +24,18 @@ public class SqlServerDAOFactory extends DAOFactory { ...@@ -29,18 +24,18 @@ public class SqlServerDAOFactory extends DAOFactory {
String userSgbd = ""; String userSgbd = "";
String passwordSgbd = ""; String passwordSgbd = "";
if (base.equalsIgnoreCase("security")) { if (base.equalsIgnoreCase("security")) {
host = dotenSrv.obtenerValorVariableEntorno("SQLSERVER_SECURITY_DB_HOST"); host = dotenSrv.obtenerValorVariableEntorno("MYSQL_SECURITY_DB_HOST");
port = dotenSrv.obtenerValorVariableEntorno("SQLSERVER_SECURITY_DB_PORT"); port = dotenSrv.obtenerValorVariableEntorno("MYSQL_SECURITY_DB_PORT");
databaseName = dotenSrv.obtenerValorVariableEntorno("SQLSERVER_SECURITY_DB_NAME"); databaseName = dotenSrv.obtenerValorVariableEntorno("MYSQL_SECURITY_DB_NAME");
userSgbd = dotenSrv.obtenerValorVariableEntorno("SQLSERVER_SECURITY_DB_USER"); userSgbd = dotenSrv.obtenerValorVariableEntorno("MYSQL_SECURITY_DB_USER");
passwordSgbd = dotenSrv.obtenerValorVariableEntorno("SQLSERVER_SECURITY_DB_PASS"); passwordSgbd = dotenSrv.obtenerValorVariableEntorno("MYSQL_SECURITY_DB_PASS");
String url = "jdbc:sqlserver://"+host+":"+port+";databaseName="+databaseName; String url = "jdbc:mysql://" + host + ":" + port + "/" + databaseName + "?characterEncoding=utf8&useSSL=false&zeroDateTimeBehavior=convertToNull";
// System.out.println("Conectando a la base de datos : "+url+ " con el usuario : "+userSgbd+ " y password : "+passwordSgbd);
try { try {
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver"); Class.forName("com.mysql.jdbc.Driver");/*Produccion*/
conexion = DriverManager.getConnection(url, userSgbd, passwordSgbd); conexion = DriverManager.getConnection(url, userSgbd, passwordSgbd);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); System.out.println("Error al conectarse a la bd : "+e.getMessage());
System.out.println("Error al conectarse a la bd");
} }
} }
return conexion; return conexion;
...@@ -48,21 +43,21 @@ public class SqlServerDAOFactory extends DAOFactory { ...@@ -48,21 +43,21 @@ public class SqlServerDAOFactory extends DAOFactory {
@Override @Override
public TipoUsuarioDAO getTipoUsuario() { public TipoUsuarioDAO getTipoUsuario() {
return new TipoUsuarioSqlServerDAO(); return new TipoUsuarioMYSQLDAO();
} }
@Override @Override
public ProyectoDAO getProyectoDAO() { public ProyectoDAO getProyectoDAO() {
return new ProyectoSqlServerDAO(); return new ProyectoMYSQLDAO();
} }
@Override @Override
public UsuarioDAO getUsuarioDAO() { public UsuarioDAO getUsuarioDAO() {
return new UsuarioSqlServerDAO(); return new UsuarioMYSQLDAO();
} }
@Override @Override
public MenuDAO getMenuDAO() { public MenuDAO getMenuDAO() {
return new MenuSqlServerDAO(); return new MenuMYSQLDAO();
} }
} }
\ No newline at end of file
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* To change this template file, choose Tools | Templates * To change this template file, choose Tools | Templates
* and open the template in the editor. * and open the template in the editor.
*/ */
package com.mycompany.moduloseguridad.sqlserverdao; package com.mycompany.moduloseguridad.mysqldao;
import java.sql.Connection; import java.sql.Connection;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
...@@ -18,7 +18,7 @@ import org.json.JSONObject; ...@@ -18,7 +18,7 @@ import org.json.JSONObject;
* *
* @author sistem17user * @author sistem17user
*/ */
public class ProyectoSqlServerDAO implements ProyectoDAO { public class ProyectoMYSQLDAO implements ProyectoDAO {
@Override @Override
public JSONObject listarProyecto(JSONObject datos, int vstart, int vlength, String draw) throws Exception { public JSONObject listarProyecto(JSONObject datos, int vstart, int vlength, String draw) throws Exception {
...@@ -43,13 +43,11 @@ public class ProyectoSqlServerDAO implements ProyectoDAO { ...@@ -43,13 +43,11 @@ public class ProyectoSqlServerDAO implements ProyectoDAO {
} else { } else {
busqueda += "and est = 1"; busqueda += "and est = 1";
} }
query = " select TOP " + vlength + " cod_proyecto, nom, est, url from proyecto " query = " select cod_proyecto, nom, est, url from proyecto "
+ " where cod_proyecto NOT IN " + " where true"
+ " ( "
+ " SELECT top " + vstart + " "
+ " cod_proyecto from proyecto ORDER BY cod_proyecto) "
+ " " + busqueda + " "; + " " + busqueda + " ";
con = SqlServerDAOFactory.getConnectionSQL(base); con = MySQLDAOFactory.getConnectionSQL(base);
System.out.println("query: " + query);
pst = con.prepareStatement(query); pst = con.prepareStatement(query);
rs = pst.executeQuery(); rs = pst.executeQuery();
while (rs.next()) { while (rs.next()) {
...@@ -69,7 +67,7 @@ public class ProyectoSqlServerDAO implements ProyectoDAO { ...@@ -69,7 +67,7 @@ public class ProyectoSqlServerDAO implements ProyectoDAO {
+ " " + busqueda + " "; + " " + busqueda + " ";
PreparedStatement pst2 = null; PreparedStatement pst2 = null;
ResultSet rs2 = null; ResultSet rs2 = null;
con = SqlServerDAOFactory.getConnectionSQL(base); con = MySQLDAOFactory.getConnectionSQL(base);
pst = con.prepareStatement(query2); pst = con.prepareStatement(query2);
rs = pst.executeQuery(); rs = pst.executeQuery();
rs.next(); rs.next();
...@@ -100,7 +98,7 @@ public class ProyectoSqlServerDAO implements ProyectoDAO { ...@@ -100,7 +98,7 @@ public class ProyectoSqlServerDAO implements ProyectoDAO {
+ " set nom = '" + nombre + "', " + " set nom = '" + nombre + "', "
+ " url = '" + url + "' " + " url = '" + url + "' "
+ " where cod_proyecto = " + codigo + ""; + " where cod_proyecto = " + codigo + "";
con = SqlServerDAOFactory.getConnectionSQL(base); con = MySQLDAOFactory.getConnectionSQL(base);
pst = con.prepareStatement(query); pst = con.prepareStatement(query);
rs = pst.executeUpdate(); rs = pst.executeUpdate();
} catch (Exception e) { } catch (Exception e) {
...@@ -123,7 +121,7 @@ public class ProyectoSqlServerDAO implements ProyectoDAO { ...@@ -123,7 +121,7 @@ public class ProyectoSqlServerDAO implements ProyectoDAO {
query = " update proyecto " query = " update proyecto "
+ " set est = 1 " + " set est = 1 "
+ " where cod_proyecto = " + codigo + ""; + " where cod_proyecto = " + codigo + "";
con = SqlServerDAOFactory.getConnectionSQL(base); con = MySQLDAOFactory.getConnectionSQL(base);
pst = con.prepareStatement(query); pst = con.prepareStatement(query);
rs = pst.executeUpdate(); rs = pst.executeUpdate();
} catch (Exception e) { } catch (Exception e) {
...@@ -146,7 +144,7 @@ public class ProyectoSqlServerDAO implements ProyectoDAO { ...@@ -146,7 +144,7 @@ public class ProyectoSqlServerDAO implements ProyectoDAO {
query = " update proyecto " query = " update proyecto "
+ " set est = 0 " + " set est = 0 "
+ " where cod_proyecto = " + codigo + ""; + " where cod_proyecto = " + codigo + "";
con = SqlServerDAOFactory.getConnectionSQL(base); con = MySQLDAOFactory.getConnectionSQL(base);
pst = con.prepareStatement(query); pst = con.prepareStatement(query);
rs = pst.executeUpdate(); rs = pst.executeUpdate();
} catch (Exception e) { } catch (Exception e) {
...@@ -169,7 +167,7 @@ public class ProyectoSqlServerDAO implements ProyectoDAO { ...@@ -169,7 +167,7 @@ public class ProyectoSqlServerDAO implements ProyectoDAO {
ResultSet rsLlave = null; ResultSet rsLlave = null;
String query = ""; String query = "";
try { try {
con = SqlServerDAOFactory.getConnectionSQL(base); con = MySQLDAOFactory.getConnectionSQL(base);
con.setAutoCommit(false); con.setAutoCommit(false);
query = " insert into proyecto_detalle (cod_proyecto, cod_tipo_usuario, est) " query = " insert into proyecto_detalle (cod_proyecto, cod_tipo_usuario, est) "
+ " values (" + proyecto + ", " + tipoUsuario + ", 1) "; + " values (" + proyecto + ", " + tipoUsuario + ", 1) ";
...@@ -212,15 +210,11 @@ public class ProyectoSqlServerDAO implements ProyectoDAO { ...@@ -212,15 +210,11 @@ public class ProyectoSqlServerDAO implements ProyectoDAO {
JSONArray lista = new JSONArray(); JSONArray lista = new JSONArray();
int conta = vstart; int conta = vstart;
try { try {
query = " select TOP " + vlength + " tu.nom, pd.est, pd.cod_proyecto_detalle from proyecto_detalle as pd " query = " select tu.nom, pd.est, pd.cod_proyecto_detalle from proyecto_detalle as pd "
+ " inner join tipo_usuario as tu " + " inner join tipo_usuario as tu "
+ " on tu.cod_tipo_usuario = pd.cod_tipo_usuario " + " on tu.cod_tipo_usuario = pd.cod_tipo_usuario "
+ " where cod_proyecto_detalle NOT IN " + " where cod_proyecto = " + filtro + " LIMIT " +vstart+", "+ vlength + ";";
+ " ( " con = MySQLDAOFactory.getConnectionSQL(base);
+ " SELECT top " + vstart + " "
+ " cod_proyecto_detalle from proyecto_detalle ORDER BY cod_proyecto_detalle) "
+ " and cod_proyecto = " + filtro + "";
con = SqlServerDAOFactory.getConnectionSQL(base);
pst = con.prepareStatement(query); pst = con.prepareStatement(query);
rs = pst.executeQuery(); rs = pst.executeQuery();
while (rs.next()) { while (rs.next()) {
...@@ -238,7 +232,7 @@ public class ProyectoSqlServerDAO implements ProyectoDAO { ...@@ -238,7 +232,7 @@ public class ProyectoSqlServerDAO implements ProyectoDAO {
+ " where cod_proyecto = " + filtro + " "; + " where cod_proyecto = " + filtro + " ";
PreparedStatement pst2 = null; PreparedStatement pst2 = null;
ResultSet rs2 = null; ResultSet rs2 = null;
con = SqlServerDAOFactory.getConnectionSQL(base); con = MySQLDAOFactory.getConnectionSQL(base);
pst = con.prepareStatement(query2); pst = con.prepareStatement(query2);
rs = pst.executeQuery(); rs = pst.executeQuery();
rs.next(); rs.next();
...@@ -267,7 +261,7 @@ public class ProyectoSqlServerDAO implements ProyectoDAO { ...@@ -267,7 +261,7 @@ public class ProyectoSqlServerDAO implements ProyectoDAO {
try { try {
query = " insert into proyecto (nom, url, est)" query = " insert into proyecto (nom, url, est)"
+ " values ('" + nombre + "', '" + url + "', 1) "; + " values ('" + nombre + "', '" + url + "', 1) ";
con = SqlServerDAOFactory.getConnectionSQL(base); con = MySQLDAOFactory.getConnectionSQL(base);
pst = con.prepareStatement(query); pst = con.prepareStatement(query);
rs = pst.executeUpdate(); rs = pst.executeUpdate();
} catch (Exception e) { } catch (Exception e) {
...@@ -290,7 +284,7 @@ public class ProyectoSqlServerDAO implements ProyectoDAO { ...@@ -290,7 +284,7 @@ public class ProyectoSqlServerDAO implements ProyectoDAO {
query = " update proyecto_detalle " query = " update proyecto_detalle "
+ " set est = 1 " + " set est = 1 "
+ " where cod_proyecto_detalle = " + codigo + ""; + " where cod_proyecto_detalle = " + codigo + "";
con = SqlServerDAOFactory.getConnectionSQL(base); con = MySQLDAOFactory.getConnectionSQL(base);
pst = con.prepareStatement(query); pst = con.prepareStatement(query);
rs = pst.executeUpdate(); rs = pst.executeUpdate();
} catch (Exception e) { } catch (Exception e) {
...@@ -313,7 +307,7 @@ public class ProyectoSqlServerDAO implements ProyectoDAO { ...@@ -313,7 +307,7 @@ public class ProyectoSqlServerDAO implements ProyectoDAO {
query = " update proyecto_detalle " query = " update proyecto_detalle "
+ " set est = 0 " + " set est = 0 "
+ " where cod_proyecto_detalle = " + codigo + ""; + " where cod_proyecto_detalle = " + codigo + "";
con = SqlServerDAOFactory.getConnectionSQL(base); con = MySQLDAOFactory.getConnectionSQL(base);
pst = con.prepareStatement(query); pst = con.prepareStatement(query);
rs = pst.executeUpdate(); rs = pst.executeUpdate();
} catch (Exception e) { } catch (Exception e) {
...@@ -338,7 +332,7 @@ public class ProyectoSqlServerDAO implements ProyectoDAO { ...@@ -338,7 +332,7 @@ public class ProyectoSqlServerDAO implements ProyectoDAO {
+ " not in (select pd.cod_tipo_usuario from proyecto_detalle as pd " + " not in (select pd.cod_tipo_usuario from proyecto_detalle as pd "
+ " where pd.cod_proyecto = " + proyecto + ") " + " where pd.cod_proyecto = " + proyecto + ") "
+ " and est = 1 "; + " and est = 1 ";
con = SqlServerDAOFactory.getConnectionSQL(base); con = MySQLDAOFactory.getConnectionSQL(base);
pst = con.prepareStatement(query); pst = con.prepareStatement(query);
rs = pst.executeQuery(); rs = pst.executeQuery();
while (rs.next()) { while (rs.next()) {
...@@ -366,7 +360,7 @@ public class ProyectoSqlServerDAO implements ProyectoDAO { ...@@ -366,7 +360,7 @@ public class ProyectoSqlServerDAO implements ProyectoDAO {
try { try {
query = " delete from proyecto_detalle " query = " delete from proyecto_detalle "
+ " where cod_proyecto_detalle = " + codigoDetalle + ""; + " where cod_proyecto_detalle = " + codigoDetalle + "";
con = SqlServerDAOFactory.getConnectionSQL(base); con = MySQLDAOFactory.getConnectionSQL(base);
pst = con.prepareStatement(query); pst = con.prepareStatement(query);
rs = pst.executeUpdate(); rs = pst.executeUpdate();
} catch (Exception e) { } catch (Exception e) {
...@@ -396,7 +390,7 @@ public class ProyectoSqlServerDAO implements ProyectoDAO { ...@@ -396,7 +390,7 @@ public class ProyectoSqlServerDAO implements ProyectoDAO {
+ "where p.cod_proyecto = " + codigo + "\n" + "where p.cod_proyecto = " + codigo + "\n"
+ "and ud.est = 1 "; + "and ud.est = 1 ";
System.out.println("QUERY " + query); System.out.println("QUERY " + query);
con = SqlServerDAOFactory.getConnectionSQL(base); con = MySQLDAOFactory.getConnectionSQL(base);
pst = con.prepareStatement(query); pst = con.prepareStatement(query);
rs = pst.executeQuery(); rs = pst.executeQuery();
while (rs.next()) { while (rs.next()) {
...@@ -427,7 +421,7 @@ public class ProyectoSqlServerDAO implements ProyectoDAO { ...@@ -427,7 +421,7 @@ public class ProyectoSqlServerDAO implements ProyectoDAO {
if (tipo == 1) { if (tipo == 1) {
query += " and nom != '" + nombreActual + "' "; query += " and nom != '" + nombreActual + "' ";
} }
con = SqlServerDAOFactory.getConnectionSQL(base); con = MySQLDAOFactory.getConnectionSQL(base);
pst = con.prepareStatement(query); pst = con.prepareStatement(query);
rs = pst.executeQuery(); rs = pst.executeQuery();
rs.next(); rs.next();
...@@ -457,7 +451,7 @@ public class ProyectoSqlServerDAO implements ProyectoDAO { ...@@ -457,7 +451,7 @@ public class ProyectoSqlServerDAO implements ProyectoDAO {
if (tipo == 1) { if (tipo == 1) {
query += " and url != '" + urlActual + "' "; query += " and url != '" + urlActual + "' ";
} }
con = SqlServerDAOFactory.getConnectionSQL(base); con = MySQLDAOFactory.getConnectionSQL(base);
pst = con.prepareStatement(query); pst = con.prepareStatement(query);
rs = pst.executeQuery(); rs = pst.executeQuery();
rs.next(); rs.next();
...@@ -483,7 +477,7 @@ public class ProyectoSqlServerDAO implements ProyectoDAO { ...@@ -483,7 +477,7 @@ public class ProyectoSqlServerDAO implements ProyectoDAO {
query = " select count(*) as cant from usuario_detalle " query = " select count(*) as cant from usuario_detalle "
+ " where cod_proyecto_detalle = " + codigo + " " + " where cod_proyecto_detalle = " + codigo + " "
+ " and est = 1 "; + " and est = 1 ";
con = SqlServerDAOFactory.getConnectionSQL(base); con = MySQLDAOFactory.getConnectionSQL(base);
pst = con.prepareStatement(query); pst = con.prepareStatement(query);
rs = pst.executeQuery(); rs = pst.executeQuery();
rs.next(); rs.next();
...@@ -508,7 +502,7 @@ public class ProyectoSqlServerDAO implements ProyectoDAO { ...@@ -508,7 +502,7 @@ public class ProyectoSqlServerDAO implements ProyectoDAO {
try { try {
query = " select count(*) as cant from titulo_configuracion " query = " select count(*) as cant from titulo_configuracion "
+ " where cod_proyecto_detalle = " + codigo + ""; + " where cod_proyecto_detalle = " + codigo + "";
con = SqlServerDAOFactory.getConnectionSQL(base); con = MySQLDAOFactory.getConnectionSQL(base);
pst = con.prepareStatement(query); pst = con.prepareStatement(query);
rsQuery = pst.executeQuery(); rsQuery = pst.executeQuery();
rsQuery.next(); rsQuery.next();
...@@ -531,7 +525,7 @@ public class ProyectoSqlServerDAO implements ProyectoDAO { ...@@ -531,7 +525,7 @@ public class ProyectoSqlServerDAO implements ProyectoDAO {
ResultSet rsQuery = null; ResultSet rsQuery = null;
String query = ""; String query = "";
try { try {
con = SqlServerDAOFactory.getConnectionSQL(base); con = MySQLDAOFactory.getConnectionSQL(base);
query = " delete from titulo_configuracion " query = " delete from titulo_configuracion "
+ " where cod_proyecto_detalle = " + codigo + ""; + " where cod_proyecto_detalle = " + codigo + "";
pst = con.prepareStatement(query); pst = con.prepareStatement(query);
...@@ -567,7 +561,7 @@ public class ProyectoSqlServerDAO implements ProyectoDAO { ...@@ -567,7 +561,7 @@ public class ProyectoSqlServerDAO implements ProyectoDAO {
String sql = ""; String sql = "";
ResponseHelper response = new ResponseHelper(); ResponseHelper response = new ResponseHelper();
try { try {
con = SqlServerDAOFactory.getConnectionSQL("security"); con = MySQLDAOFactory.getConnectionSQL("security");
// con.setAutoCommit(false); // con.setAutoCommit(false);
sql = " update usuario_detalle\n" sql = " update usuario_detalle\n"
+ "set est = 0\n" + "set est = 0\n"
......
...@@ -3,13 +3,11 @@ ...@@ -3,13 +3,11 @@
* To change this template file, choose Tools | Templates * To change this template file, choose Tools | Templates
* and open the template in the editor. * and open the template in the editor.
*/ */
package com.mycompany.moduloseguridad.sqlserverdao; package com.mycompany.moduloseguridad.mysqldao;
import java.sql.Connection; import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
import java.sql.ResultSet; import java.sql.ResultSet;
import com.mycompany.moduloseguridad.utilities.GeneralMethods;
import com.mycompany.moduloseguridad.dao.TipoUsuarioDAO; import com.mycompany.moduloseguridad.dao.TipoUsuarioDAO;
import com.mycompany.moduloseguridad.utilities.DAOHelper; import com.mycompany.moduloseguridad.utilities.DAOHelper;
...@@ -20,7 +18,7 @@ import org.json.JSONObject; ...@@ -20,7 +18,7 @@ import org.json.JSONObject;
* *
* @author sistem17user * @author sistem17user
*/ */
public class TipoUsuarioSqlServerDAO implements TipoUsuarioDAO { public class TipoUsuarioMYSQLDAO implements TipoUsuarioDAO {
@Override @Override
public JSONObject listarProyectos() throws Exception { public JSONObject listarProyectos() throws Exception {
...@@ -35,7 +33,7 @@ public class TipoUsuarioSqlServerDAO implements TipoUsuarioDAO { ...@@ -35,7 +33,7 @@ public class TipoUsuarioSqlServerDAO implements TipoUsuarioDAO {
try { try {
query = "select cod_proyecto, nom from proyecto where proyecto.est = 1;"; query = "select cod_proyecto, nom from proyecto where proyecto.est = 1;";
con = SqlServerDAOFactory.getConnectionSQL(base); con = MySQLDAOFactory.getConnectionSQL(base);
pst = con.prepareStatement(query); pst = con.prepareStatement(query);
rs = pst.executeQuery(); rs = pst.executeQuery();
while (rs.next()) { while (rs.next()) {
...@@ -74,7 +72,7 @@ public class TipoUsuarioSqlServerDAO implements TipoUsuarioDAO { ...@@ -74,7 +72,7 @@ public class TipoUsuarioSqlServerDAO implements TipoUsuarioDAO {
"inner join tipo_usuario on proyecto_detalle.cod_tipo_usuario = tipo_usuario.cod_tipo_usuario\n" + "inner join tipo_usuario on proyecto_detalle.cod_tipo_usuario = tipo_usuario.cod_tipo_usuario\n" +
"where proyecto_detalle.cod_proyecto = " + codigoProyecto; "where proyecto_detalle.cod_proyecto = " + codigoProyecto;
con = SqlServerDAOFactory.getConnectionSQL(base); con = MySQLDAOFactory.getConnectionSQL(base);
pst = con.prepareStatement(query); pst = con.prepareStatement(query);
rs = pst.executeQuery(); rs = pst.executeQuery();
while (rs.next()) { while (rs.next()) {
...@@ -96,7 +94,7 @@ public class TipoUsuarioSqlServerDAO implements TipoUsuarioDAO { ...@@ -96,7 +94,7 @@ public class TipoUsuarioSqlServerDAO implements TipoUsuarioDAO {
} }
@Override @Override
public JSONObject listadoPrincipal(String filtro, int filtrado, int proyecto, int vstart, int vlength, String draw) throws Exception { public JSONObject listadoPrincipal(String filtro, int filtrado, int proyecto, int vstart, int vlength, String draw, int estado) throws Exception {
String base = "security"; String base = "security";
Connection cnx = null; Connection cnx = null;
String query = ""; String query = "";
...@@ -106,8 +104,8 @@ public class TipoUsuarioSqlServerDAO implements TipoUsuarioDAO { ...@@ -106,8 +104,8 @@ public class TipoUsuarioSqlServerDAO implements TipoUsuarioDAO {
try { try {
cnx = SqlServerDAOFactory.getConnectionSQL(base); cnx = MySQLDAOFactory.getConnectionSQL(base);
String sql = "{CALL SP_TA_GESTIÓN_USUARIO(?,?,?,?,?,?,?,?,?,?)}"; String sql = "{CALL SP_TA_GESTIÓN_USUARIO(?,?,?,?,?,?,?,?,?,?,?)}";
JSONArray params = new JSONArray() JSONArray params = new JSONArray()
.put(1) .put(1)
...@@ -116,6 +114,7 @@ public class TipoUsuarioSqlServerDAO implements TipoUsuarioDAO { ...@@ -116,6 +114,7 @@ public class TipoUsuarioSqlServerDAO implements TipoUsuarioDAO {
.put(0) .put(0)
.put(0) .put(0)
.put(0) .put(0)
.put(estado)
.put(vstart) .put(vstart)
.put(vlength) .put(vlength)
.put(String.class) .put(String.class)
...@@ -146,8 +145,8 @@ public class TipoUsuarioSqlServerDAO implements TipoUsuarioDAO { ...@@ -146,8 +145,8 @@ public class TipoUsuarioSqlServerDAO implements TipoUsuarioDAO {
String mensaje = ""; String mensaje = "";
try { try {
cnx = SqlServerDAOFactory.getConnectionSQL(base); cnx = MySQLDAOFactory.getConnectionSQL(base);
String sql = "{CALL SP_TA_GESTIÓN_USUARIO(?,?,?,?,?,?,?,?,?,?)}"; String sql = "{CALL SP_TA_GESTIÓN_USUARIO(?,?,?,?,?,?,?,?,?,?,?)}";
JSONArray params = new JSONArray() JSONArray params = new JSONArray()
.put(3) .put(3)
...@@ -158,6 +157,7 @@ public class TipoUsuarioSqlServerDAO implements TipoUsuarioDAO { ...@@ -158,6 +157,7 @@ public class TipoUsuarioSqlServerDAO implements TipoUsuarioDAO {
.put(0) .put(0)
.put(0) .put(0)
.put(0) .put(0)
.put(0)
.put(String.class) .put(String.class)
.put(Integer.class); .put(Integer.class);
...@@ -177,17 +177,14 @@ public class TipoUsuarioSqlServerDAO implements TipoUsuarioDAO { ...@@ -177,17 +177,14 @@ public class TipoUsuarioSqlServerDAO implements TipoUsuarioDAO {
public JSONObject listarAcciones(JSONObject datos) throws Exception { public JSONObject listarAcciones(JSONObject datos) throws Exception {
String base = "security"; String base = "security";
Connection cnx = null; Connection cnx;
String query = ""; JSONArray arrayjson;
JSONArray arrayjson = new JSONArray();
JSONObject response = new JSONObject(); JSONObject response = new JSONObject();
int total = 0; int total;
try { try {
cnx = MySQLDAOFactory.getConnectionSQL(base);
cnx = SqlServerDAOFactory.getConnectionSQL(base); String sql = "{CALL SP_TA_GESTIÓN_USUARIO(?,?,?,?,?,?,?,?,?,?,?)}";
String sql = "{CALL SP_TA_GESTIÓN_USUARIO(?,?,?,?,?,?,?,?,?,?)}";
JSONArray params = new JSONArray() JSONArray params = new JSONArray()
.put(2) .put(2)
.put(0) .put(0)
...@@ -195,12 +192,12 @@ public class TipoUsuarioSqlServerDAO implements TipoUsuarioDAO { ...@@ -195,12 +192,12 @@ public class TipoUsuarioSqlServerDAO implements TipoUsuarioDAO {
.put(datos.getInt("proyectoDetalle")) .put(datos.getInt("proyectoDetalle"))
.put(0) .put(0)
.put(0) .put(0)
.put(0)
.put(datos.getInt("start")) .put(datos.getInt("start"))
.put(datos.getInt("length")) .put(datos.getInt("length"))
.put(String.class) .put(String.class)
.put(Integer.class); .put(Integer.class);
arrayjson = DAOHelper.queryProcedure(cnx, sql, params); arrayjson = DAOHelper.queryProcedure(cnx, sql, params);
total = params.getInt(1); total = params.getInt(1);
...@@ -227,8 +224,8 @@ public class TipoUsuarioSqlServerDAO implements TipoUsuarioDAO { ...@@ -227,8 +224,8 @@ public class TipoUsuarioSqlServerDAO implements TipoUsuarioDAO {
try { try {
cnx = SqlServerDAOFactory.getConnectionSQL(base); cnx = MySQLDAOFactory.getConnectionSQL(base);
String sql = "{CALL SP_TA_GESTIÓN_USUARIO(?,?,?,?,?,?,?,?,?,?)}"; String sql = "{CALL SP_TA_GESTIÓN_USUARIO(?,?,?,?,?,?,?,?,?,?,?)}";
JSONArray params = new JSONArray() JSONArray params = new JSONArray()
.put(4) .put(4)
...@@ -239,6 +236,7 @@ public class TipoUsuarioSqlServerDAO implements TipoUsuarioDAO { ...@@ -239,6 +236,7 @@ public class TipoUsuarioSqlServerDAO implements TipoUsuarioDAO {
.put(datos.getInt("codigoAccionDetalle")) .put(datos.getInt("codigoAccionDetalle"))
.put(0) .put(0)
.put(0) .put(0)
.put(0)
.put(String.class) .put(String.class)
.put(Integer.class); .put(Integer.class);
...@@ -263,8 +261,8 @@ public class TipoUsuarioSqlServerDAO implements TipoUsuarioDAO { ...@@ -263,8 +261,8 @@ public class TipoUsuarioSqlServerDAO implements TipoUsuarioDAO {
try { try {
cnx = SqlServerDAOFactory.getConnectionSQL(base); cnx = MySQLDAOFactory.getConnectionSQL(base);
String sql = "{CALL SP_TA_GESTIÓN_USUARIO(?,?,?,?,?,?,?,?,?,?)}"; String sql = "{CALL SP_TA_GESTIÓN_USUARIO(?,?,?,?,?,?,?,?,?,?,?)}";
JSONArray params = new JSONArray() JSONArray params = new JSONArray()
.put(5) .put(5)
...@@ -275,6 +273,7 @@ public class TipoUsuarioSqlServerDAO implements TipoUsuarioDAO { ...@@ -275,6 +273,7 @@ public class TipoUsuarioSqlServerDAO implements TipoUsuarioDAO {
.put(0) .put(0)
.put(0) .put(0)
.put(0) .put(0)
.put(0)
.put(String.class) .put(String.class)
.put(Integer.class); .put(Integer.class);
...@@ -302,7 +301,7 @@ public class TipoUsuarioSqlServerDAO implements TipoUsuarioDAO { ...@@ -302,7 +301,7 @@ public class TipoUsuarioSqlServerDAO implements TipoUsuarioDAO {
try { try {
query = "select *from accion;"; query = "select *from accion;";
con = SqlServerDAOFactory.getConnectionSQL(base); con = MySQLDAOFactory.getConnectionSQL(base);
pst = con.prepareStatement(query); pst = con.prepareStatement(query);
rs = pst.executeQuery(); rs = pst.executeQuery();
while (rs.next()) { while (rs.next()) {
...@@ -334,7 +333,7 @@ public class TipoUsuarioSqlServerDAO implements TipoUsuarioDAO { ...@@ -334,7 +333,7 @@ public class TipoUsuarioSqlServerDAO implements TipoUsuarioDAO {
query = " update tipo_usuario " query = " update tipo_usuario "
+ " set est = 1" + " set est = 1"
+ " where cod_tipo_usuario = " + codigo + " "; + " where cod_tipo_usuario = " + codigo + " ";
con = SqlServerDAOFactory.getConnectionSQL(base); con = MySQLDAOFactory.getConnectionSQL(base);
pst = con.prepareStatement(query); pst = con.prepareStatement(query);
rs = pst.executeUpdate(); rs = pst.executeUpdate();
} catch (Exception e) { } catch (Exception e) {
...@@ -357,7 +356,7 @@ public class TipoUsuarioSqlServerDAO implements TipoUsuarioDAO { ...@@ -357,7 +356,7 @@ public class TipoUsuarioSqlServerDAO implements TipoUsuarioDAO {
query = " update tipo_usuario " query = " update tipo_usuario "
+ " set est = 0" + " set est = 0"
+ " where cod_tipo_usuario = " + codigo + " "; + " where cod_tipo_usuario = " + codigo + " ";
con = SqlServerDAOFactory.getConnectionSQL(base); con = MySQLDAOFactory.getConnectionSQL(base);
pst = con.prepareStatement(query); pst = con.prepareStatement(query);
rs = pst.executeUpdate(); rs = pst.executeUpdate();
} catch (Exception e) { } catch (Exception e) {
...@@ -380,7 +379,7 @@ public class TipoUsuarioSqlServerDAO implements TipoUsuarioDAO { ...@@ -380,7 +379,7 @@ public class TipoUsuarioSqlServerDAO implements TipoUsuarioDAO {
query = " update tipo_usuario " query = " update tipo_usuario "
+ " set nom = '" + nombre + "'" + " set nom = '" + nombre + "'"
+ " where cod_tipo_usuario = " + codigo + " "; + " where cod_tipo_usuario = " + codigo + " ";
con = SqlServerDAOFactory.getConnectionSQL(base); con = MySQLDAOFactory.getConnectionSQL(base);
pst = con.prepareStatement(query); pst = con.prepareStatement(query);
rs = pst.executeUpdate(); rs = pst.executeUpdate();
} catch (Exception e) { } catch (Exception e) {
...@@ -404,7 +403,7 @@ public class TipoUsuarioSqlServerDAO implements TipoUsuarioDAO { ...@@ -404,7 +403,7 @@ public class TipoUsuarioSqlServerDAO implements TipoUsuarioDAO {
// ResultSet rst = metadata.getColumns(null, null, "titulo", "nom"); // ResultSet rst = metadata.getColumns(null, null, "titulo", "nom");
query = " insert into tipo_usuario (nom, est)" query = " insert into tipo_usuario (nom, est)"
+ " values ('" + nombre + "', 1) "; + " values ('" + nombre + "', 1) ";
con = SqlServerDAOFactory.getConnectionSQL(base); con = MySQLDAOFactory.getConnectionSQL(base);
pst = con.prepareStatement(query); pst = con.prepareStatement(query);
rs = pst.executeUpdate(); rs = pst.executeUpdate();
} catch (Exception e) { } catch (Exception e) {
...@@ -432,7 +431,7 @@ public class TipoUsuarioSqlServerDAO implements TipoUsuarioDAO { ...@@ -432,7 +431,7 @@ public class TipoUsuarioSqlServerDAO implements TipoUsuarioDAO {
+ " on p.cod_proyecto = pd.cod_proyecto " + " on p.cod_proyecto = pd.cod_proyecto "
+ " where tu.cod_tipo_usuario = " + codigo + " " + " where tu.cod_tipo_usuario = " + codigo + " "
+ " and p.est = 1 "; + " and p.est = 1 ";
con = SqlServerDAOFactory.getConnectionSQL(base); con = MySQLDAOFactory.getConnectionSQL(base);
pst = con.prepareStatement(query); pst = con.prepareStatement(query);
rs = pst.executeQuery(); rs = pst.executeQuery();
rs.next(); rs.next();
...@@ -461,7 +460,7 @@ public class TipoUsuarioSqlServerDAO implements TipoUsuarioDAO { ...@@ -461,7 +460,7 @@ public class TipoUsuarioSqlServerDAO implements TipoUsuarioDAO {
if (tipo == 1) { if (tipo == 1) {
query += " and nom != '" + nombreInicial + "' "; query += " and nom != '" + nombreInicial + "' ";
} }
con = SqlServerDAOFactory.getConnectionSQL(base); con = MySQLDAOFactory.getConnectionSQL(base);
pst = con.prepareStatement(query); pst = con.prepareStatement(query);
rs = pst.executeQuery(); rs = pst.executeQuery();
rs.next(); rs.next();
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* To change this template file, choose Tools | Templates * To change this template file, choose Tools | Templates
* and open the template in the editor. * and open the template in the editor.
*/ */
package com.mycompany.moduloseguridad.sqlserverdao; package com.mycompany.moduloseguridad.mysqldao;
import java.sql.Connection; import java.sql.Connection;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
...@@ -18,7 +18,7 @@ import org.json.JSONObject; ...@@ -18,7 +18,7 @@ import org.json.JSONObject;
* *
* @author sistem17user * @author sistem17user
*/ */
public class UsuarioSqlServerDAO implements UsuarioDAO { public class UsuarioMYSQLDAO implements UsuarioDAO {
@Override @Override
public JSONArray listarUsuario(JSONObject datos, int vstart, int vlength, int draw) throws Exception { public JSONArray listarUsuario(JSONObject datos, int vstart, int vlength, int draw) throws Exception {
...@@ -59,7 +59,7 @@ public class UsuarioSqlServerDAO implements UsuarioDAO { ...@@ -59,7 +59,7 @@ public class UsuarioSqlServerDAO implements UsuarioDAO {
+ " select cod_usuario, cod_trabajador, usu, est, cantidad from tablaOrdenada " + " select cod_usuario, cod_trabajador, usu, est, cantidad from tablaOrdenada "
+ " where cantidad BETWEEN "+vstart+" and "+vlength*draw + " where cantidad BETWEEN "+vstart+" and "+vlength*draw
+ " ORDER BY usu ASC"; + " ORDER BY usu ASC";
con = SqlServerDAOFactory.getConnectionSQL(base); con = MySQLDAOFactory.getConnectionSQL(base);
pst = con.prepareStatement(query); pst = con.prepareStatement(query);
rs = pst.executeQuery(); rs = pst.executeQuery();
...@@ -117,7 +117,7 @@ public class UsuarioSqlServerDAO implements UsuarioDAO { ...@@ -117,7 +117,7 @@ public class UsuarioSqlServerDAO implements UsuarioDAO {
+ " LEFT JOIN proyecto_detalle AS pd ON pd.cod_proyecto_detalle = ud.cod_proyecto_detalle " + " LEFT JOIN proyecto_detalle AS pd ON pd.cod_proyecto_detalle = ud.cod_proyecto_detalle "
+ " WHERE 1 = 1 " + busqueda + " " + " WHERE 1 = 1 " + busqueda + " "
+ " GROUP BY a.cod_usuario "; + " GROUP BY a.cod_usuario ";
con = SqlServerDAOFactory.getConnectionSQL(base); con = MySQLDAOFactory.getConnectionSQL(base);
pst = con.prepareStatement(query); pst = con.prepareStatement(query);
rs = pst.executeQuery(); rs = pst.executeQuery();
while (rs.next()) { while (rs.next()) {
...@@ -144,7 +144,7 @@ public class UsuarioSqlServerDAO implements UsuarioDAO { ...@@ -144,7 +144,7 @@ public class UsuarioSqlServerDAO implements UsuarioDAO {
+ " set usu = upper('" + usuario + "')," + " set usu = upper('" + usuario + "'),"
+ " con = '" + clave + "'" + " con = '" + clave + "'"
+ " where cod_usuario = " + codigo + ""; + " where cod_usuario = " + codigo + "";
con = SqlServerDAOFactory.getConnectionSQL(base); con = MySQLDAOFactory.getConnectionSQL(base);
pst = con.prepareStatement(query); pst = con.prepareStatement(query);
rs = pst.executeUpdate(); rs = pst.executeUpdate();
} catch (Exception e) { } catch (Exception e) {
...@@ -167,7 +167,7 @@ public class UsuarioSqlServerDAO implements UsuarioDAO { ...@@ -167,7 +167,7 @@ public class UsuarioSqlServerDAO implements UsuarioDAO {
query = " update usuario " query = " update usuario "
+ " set est = 1 " + " set est = 1 "
+ " where cod_usuario = " + codigo + ""; + " where cod_usuario = " + codigo + "";
con = SqlServerDAOFactory.getConnectionSQL(base); con = MySQLDAOFactory.getConnectionSQL(base);
pst = con.prepareStatement(query); pst = con.prepareStatement(query);
rs = pst.executeUpdate(); rs = pst.executeUpdate();
} catch (Exception e) { } catch (Exception e) {
...@@ -190,7 +190,7 @@ public class UsuarioSqlServerDAO implements UsuarioDAO { ...@@ -190,7 +190,7 @@ public class UsuarioSqlServerDAO implements UsuarioDAO {
query = " update usuario " query = " update usuario "
+ " set est = 0 " + " set est = 0 "
+ " where cod_usuario = " + codigo + ""; + " where cod_usuario = " + codigo + "";
con = SqlServerDAOFactory.getConnectionSQL(base); con = MySQLDAOFactory.getConnectionSQL(base);
pst = con.prepareStatement(query); pst = con.prepareStatement(query);
rs = pst.executeUpdate(); rs = pst.executeUpdate();
if (rs == 1) { if (rs == 1) {
...@@ -198,7 +198,7 @@ public class UsuarioSqlServerDAO implements UsuarioDAO { ...@@ -198,7 +198,7 @@ public class UsuarioSqlServerDAO implements UsuarioDAO {
+ " set est = 0 " + " set est = 0 "
+ " where cod_usuario = " + codigo; + " where cod_usuario = " + codigo;
} }
con = SqlServerDAOFactory.getConnectionSQL(base); con = MySQLDAOFactory.getConnectionSQL(base);
pst = con.prepareStatement(query); pst = con.prepareStatement(query);
rs = pst.executeUpdate(); rs = pst.executeUpdate();
} catch (Exception e) { } catch (Exception e) {
...@@ -220,7 +220,7 @@ public class UsuarioSqlServerDAO implements UsuarioDAO { ...@@ -220,7 +220,7 @@ public class UsuarioSqlServerDAO implements UsuarioDAO {
try { try {
query = " insert into usuario (cod_trabajador, usu, con, est) " query = " insert into usuario (cod_trabajador, usu, con, est) "
+ " values ('" + codigoTrabajador + "', upper('" + usuario + "'), '" + clave + "', 1) "; + " values ('" + codigoTrabajador + "', upper('" + usuario + "'), '" + clave + "', 1) ";
con = SqlServerDAOFactory.getConnectionSQL(base); con = MySQLDAOFactory.getConnectionSQL(base);
pst = con.prepareStatement(query); pst = con.prepareStatement(query);
rs = pst.executeUpdate(); rs = pst.executeUpdate();
} catch (Exception e) { } catch (Exception e) {
...@@ -244,7 +244,7 @@ public class UsuarioSqlServerDAO implements UsuarioDAO { ...@@ -244,7 +244,7 @@ public class UsuarioSqlServerDAO implements UsuarioDAO {
query = " select count(*) as cant " query = " select count(*) as cant "
+ " from usuario " + " from usuario "
+ " where cod_trabajador = '" + codigoTrabajador + "'"; + " where cod_trabajador = '" + codigoTrabajador + "'";
con = SqlServerDAOFactory.getConnectionSQL(base); con = MySQLDAOFactory.getConnectionSQL(base);
pst = con.prepareStatement(query); pst = con.prepareStatement(query);
rs = pst.executeQuery(); rs = pst.executeQuery();
rs.next(); rs.next();
...@@ -268,7 +268,7 @@ public class UsuarioSqlServerDAO implements UsuarioDAO { ...@@ -268,7 +268,7 @@ public class UsuarioSqlServerDAO implements UsuarioDAO {
try { try {
query = " delete from usuario " query = " delete from usuario "
+ " where cod_usuario = " + codigo + ""; + " where cod_usuario = " + codigo + "";
con = SqlServerDAOFactory.getConnectionSQL(base); con = MySQLDAOFactory.getConnectionSQL(base);
pst = con.prepareStatement(query); pst = con.prepareStatement(query);
rs = pst.executeUpdate(); rs = pst.executeUpdate();
} catch (Exception e) { } catch (Exception e) {
...@@ -299,7 +299,7 @@ public class UsuarioSqlServerDAO implements UsuarioDAO { ...@@ -299,7 +299,7 @@ public class UsuarioSqlServerDAO implements UsuarioDAO {
+ " inner join tipo_usuario as tu " + " inner join tipo_usuario as tu "
+ " on tu.cod_tipo_usuario = pd.cod_tipo_usuario " + " on tu.cod_tipo_usuario = pd.cod_tipo_usuario "
+ " where ud.cod_usuario = " + filtro + ""; + " where ud.cod_usuario = " + filtro + "";
con = SqlServerDAOFactory.getConnectionSQL(base); con = MySQLDAOFactory.getConnectionSQL(base);
pst = con.prepareStatement(query); pst = con.prepareStatement(query);
rs = pst.executeQuery(); rs = pst.executeQuery();
while (rs.next()) { while (rs.next()) {
...@@ -346,7 +346,7 @@ public class UsuarioSqlServerDAO implements UsuarioDAO { ...@@ -346,7 +346,7 @@ public class UsuarioSqlServerDAO implements UsuarioDAO {
try { try {
query = " delete from usuario_detalle " query = " delete from usuario_detalle "
+ " where cod_usuario_detalle = " + codigo + ""; + " where cod_usuario_detalle = " + codigo + "";
con = SqlServerDAOFactory.getConnectionSQL(base); con = MySQLDAOFactory.getConnectionSQL(base);
pst = con.prepareStatement(query); pst = con.prepareStatement(query);
rs = pst.executeUpdate(); rs = pst.executeUpdate();
} catch (Exception e) { } catch (Exception e) {
...@@ -369,7 +369,7 @@ public class UsuarioSqlServerDAO implements UsuarioDAO { ...@@ -369,7 +369,7 @@ public class UsuarioSqlServerDAO implements UsuarioDAO {
query = " update usuario_detalle " query = " update usuario_detalle "
+ " set est = 1 " + " set est = 1 "
+ " where cod_usuario_detalle = " + codigo + ""; + " where cod_usuario_detalle = " + codigo + "";
con = SqlServerDAOFactory.getConnectionSQL(base); con = MySQLDAOFactory.getConnectionSQL(base);
pst = con.prepareStatement(query); pst = con.prepareStatement(query);
rs = pst.executeUpdate(); rs = pst.executeUpdate();
} catch (Exception e) { } catch (Exception e) {
...@@ -392,7 +392,7 @@ public class UsuarioSqlServerDAO implements UsuarioDAO { ...@@ -392,7 +392,7 @@ public class UsuarioSqlServerDAO implements UsuarioDAO {
query = " update usuario_detalle " query = " update usuario_detalle "
+ " set est = 0 " + " set est = 0 "
+ " where cod_usuario_detalle = " + codigo + ""; + " where cod_usuario_detalle = " + codigo + "";
con = SqlServerDAOFactory.getConnectionSQL(base); con = MySQLDAOFactory.getConnectionSQL(base);
pst = con.prepareStatement(query); pst = con.prepareStatement(query);
rs = pst.executeUpdate(); rs = pst.executeUpdate();
} catch (Exception e) { } catch (Exception e) {
...@@ -415,7 +415,7 @@ public class UsuarioSqlServerDAO implements UsuarioDAO { ...@@ -415,7 +415,7 @@ public class UsuarioSqlServerDAO implements UsuarioDAO {
query = " insert into usuario_detalle " query = " insert into usuario_detalle "
+ " (cod_usuario, cod_proyecto_detalle, est) " + " (cod_usuario, cod_proyecto_detalle, est) "
+ " values(" + usuario + ", " + proyectoDetalle + ", 1) "; + " values(" + usuario + ", " + proyectoDetalle + ", 1) ";
con = SqlServerDAOFactory.getConnectionSQL(base); con = MySQLDAOFactory.getConnectionSQL(base);
pst = con.prepareStatement(query); pst = con.prepareStatement(query);
rs = pst.executeUpdate(); rs = pst.executeUpdate();
} catch (Exception e) { } catch (Exception e) {
...@@ -440,7 +440,7 @@ public class UsuarioSqlServerDAO implements UsuarioDAO { ...@@ -440,7 +440,7 @@ public class UsuarioSqlServerDAO implements UsuarioDAO {
+ "inner join proyecto as p " + "inner join proyecto as p "
+ "on p.cod_proyecto = pd.cod_proyecto " + "on p.cod_proyecto = pd.cod_proyecto "
+ "group by pd.cod_proyecto, p.nom "; + "group by pd.cod_proyecto, p.nom ";
con = SqlServerDAOFactory.getConnectionSQL(base); con = MySQLDAOFactory.getConnectionSQL(base);
pst = con.prepareStatement(query); pst = con.prepareStatement(query);
rs = pst.executeQuery(); rs = pst.executeQuery();
while (rs.next()) { while (rs.next()) {
...@@ -490,7 +490,7 @@ public class UsuarioSqlServerDAO implements UsuarioDAO { ...@@ -490,7 +490,7 @@ public class UsuarioSqlServerDAO implements UsuarioDAO {
+ " cod_proyecto = " + proyecto + " " + " cod_proyecto = " + proyecto + " "
+ valid; + valid;
System.out.println("LISTADO TIPO USUARIO ---> " + query); System.out.println("LISTADO TIPO USUARIO ---> " + query);
con = SqlServerDAOFactory.getConnectionSQL(base); con = MySQLDAOFactory.getConnectionSQL(base);
pst = con.prepareStatement(query); pst = con.prepareStatement(query);
rs = pst.executeQuery(); rs = pst.executeQuery();
while (rs.next()) { while (rs.next()) {
...@@ -519,7 +519,7 @@ public class UsuarioSqlServerDAO implements UsuarioDAO { ...@@ -519,7 +519,7 @@ public class UsuarioSqlServerDAO implements UsuarioDAO {
try { try {
query = " select count(*) as cant from usuario_detalle " query = " select count(*) as cant from usuario_detalle "
+ " where cod_usuario = " + codigo + " "; + " where cod_usuario = " + codigo + " ";
con = SqlServerDAOFactory.getConnectionSQL(base); con = MySQLDAOFactory.getConnectionSQL(base);
pst = con.prepareStatement(query); pst = con.prepareStatement(query);
rs = pst.executeQuery(); rs = pst.executeQuery();
rs.next(); rs.next();
...@@ -544,7 +544,7 @@ public class UsuarioSqlServerDAO implements UsuarioDAO { ...@@ -544,7 +544,7 @@ public class UsuarioSqlServerDAO implements UsuarioDAO {
try { try {
query = " select count(*) as cant from usuario " query = " select count(*) as cant from usuario "
+ " where upper(usu) = upper('" + nombre + "')"; + " where upper(usu) = upper('" + nombre + "')";
con = SqlServerDAOFactory.getConnectionSQL(base); con = MySQLDAOFactory.getConnectionSQL(base);
pst = con.prepareStatement(query); pst = con.prepareStatement(query);
rs = pst.executeQuery(); rs = pst.executeQuery();
rs.next(); rs.next();
...@@ -569,7 +569,7 @@ public class UsuarioSqlServerDAO implements UsuarioDAO { ...@@ -569,7 +569,7 @@ public class UsuarioSqlServerDAO implements UsuarioDAO {
try { try {
query = " select count(*) as cant from auditoria " query = " select count(*) as cant from auditoria "
+ " where cod_usuario_detalle = " + codigo + ""; + " where cod_usuario_detalle = " + codigo + "";
con = SqlServerDAOFactory.getConnectionSQL(GeneralVariables.nameDB); con = MySQLDAOFactory.getConnectionSQL(GeneralVariables.nameDB);
pst = con.prepareStatement(query); pst = con.prepareStatement(query);
rs = pst.executeQuery(); rs = pst.executeQuery();
rs.next(); rs.next();
...@@ -603,7 +603,7 @@ public class UsuarioSqlServerDAO implements UsuarioDAO { ...@@ -603,7 +603,7 @@ public class UsuarioSqlServerDAO implements UsuarioDAO {
condicion = " where a.est = 1"; condicion = " where a.est = 1";
} }
} }
con = SqlServerDAOFactory.getConnectionSQL(GeneralVariables.nameDB); con = MySQLDAOFactory.getConnectionSQL(GeneralVariables.nameDB);
sql = " SELECT a.cod_usuario, a.cod_trabajador, a.usu, a.est FROM usuario as a" + condicion; sql = " SELECT a.cod_usuario, a.cod_trabajador, a.usu, a.est FROM usuario as a" + condicion;
pst = con.prepareStatement(sql); pst = con.prepareStatement(sql);
rSet = pst.executeQuery(); rSet = pst.executeQuery();
......
...@@ -16,13 +16,13 @@ import org.json.JSONObject; ...@@ -16,13 +16,13 @@ import org.json.JSONObject;
*/ */
public class MenuService { public class MenuService {
DAOFactory fabrica = DAOFactory.getDAOFactory(DAOFactory.SQLSERVER); DAOFactory fabrica = DAOFactory.getDAOFactory(DAOFactory.MYSQL);
MenuDAO dao = fabrica.getMenuDAO(); MenuDAO dao = fabrica.getMenuDAO();
public JSONArray listarProyecto() { public JSONArray listarProyecto(int estado) {
JSONArray obj = null; JSONArray obj = null;
try { try {
obj = dao.listarProyecto(); obj = dao.listarProyecto(estado);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
......
...@@ -16,7 +16,7 @@ import org.json.JSONObject; ...@@ -16,7 +16,7 @@ import org.json.JSONObject;
*/ */
public class ProyectoService { public class ProyectoService {
DAOFactory fabrica = DAOFactory.getDAOFactory(DAOFactory.SQLSERVER); DAOFactory fabrica = DAOFactory.getDAOFactory(DAOFactory.MYSQL);
ProyectoDAO dao = fabrica.getProyectoDAO(); ProyectoDAO dao = fabrica.getProyectoDAO();
public JSONObject listarProyecto(JSONObject filtro, int vstart, int vlength, String draw) { public JSONObject listarProyecto(JSONObject filtro, int vstart, int vlength, String draw) {
......
...@@ -15,7 +15,7 @@ import org.json.JSONObject; ...@@ -15,7 +15,7 @@ import org.json.JSONObject;
*/ */
public class TipoUsuarioService { public class TipoUsuarioService {
DAOFactory fabrica = DAOFactory.getDAOFactory(DAOFactory.SQLSERVER); DAOFactory fabrica = DAOFactory.getDAOFactory(DAOFactory.MYSQL);
TipoUsuarioDAO dao = fabrica.getTipoUsuario(); TipoUsuarioDAO dao = fabrica.getTipoUsuario();
public JSONObject listarProyectos() { public JSONObject listarProyectos() {
...@@ -23,7 +23,7 @@ public class TipoUsuarioService { ...@@ -23,7 +23,7 @@ public class TipoUsuarioService {
try { try {
obj = dao.listarProyectos(); obj = dao.listarProyectos();
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); System.out.println("Error en listado principal service" + e.getMessage());
} }
return obj; return obj;
} }
...@@ -33,7 +33,7 @@ public class TipoUsuarioService { ...@@ -33,7 +33,7 @@ public class TipoUsuarioService {
try { try {
obj = dao.listarTiposUsuarios(codigoProyecto); obj = dao.listarTiposUsuarios(codigoProyecto);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); System.out.println("Error en listado principal service" + e.getMessage());
} }
return obj; return obj;
} }
...@@ -43,7 +43,7 @@ public class TipoUsuarioService { ...@@ -43,7 +43,7 @@ public class TipoUsuarioService {
try { try {
obj = dao.asignarAcciones(datos); obj = dao.asignarAcciones(datos);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); System.out.println("Error en listado principal service" + e.getMessage());
} }
return obj; return obj;
} }
...@@ -53,7 +53,7 @@ public class TipoUsuarioService { ...@@ -53,7 +53,7 @@ public class TipoUsuarioService {
try { try {
obj = dao.listarAcciones(datos); obj = dao.listarAcciones(datos);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); System.out.println("Error en listado principal service" + e.getMessage());
} }
return obj; return obj;
} }
...@@ -63,7 +63,7 @@ public class TipoUsuarioService { ...@@ -63,7 +63,7 @@ public class TipoUsuarioService {
try { try {
obj = dao.listarCboAcciones(); obj = dao.listarCboAcciones();
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); System.out.println("Error en listado principal service" + e.getMessage());
} }
return obj; return obj;
} }
...@@ -73,7 +73,7 @@ public class TipoUsuarioService { ...@@ -73,7 +73,7 @@ public class TipoUsuarioService {
try { try {
obj = dao.activarDesactivarAccion(datos); obj = dao.activarDesactivarAccion(datos);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); System.out.println("Error en listado principal service" + e.getMessage());
} }
return obj; return obj;
} }
...@@ -83,17 +83,17 @@ public class TipoUsuarioService { ...@@ -83,17 +83,17 @@ public class TipoUsuarioService {
try { try {
obj = dao.activarDesactivarTipoUsuario(datos); obj = dao.activarDesactivarTipoUsuario(datos);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); System.out.println("Error en listado principal service" + e.getMessage());
} }
return obj; return obj;
} }
public JSONObject listadoPrincipal(String filtro,int filtrado, int proyecto, int vstart, int vlength, String draw) { public JSONObject listadoPrincipal(String filtro,int filtrado, int proyecto, int vstart, int vlength, String draw, int estado) {
JSONObject obj = null; JSONObject obj = null;
try { try {
obj = dao.listadoPrincipal(filtro,filtrado, proyecto, vstart, vlength, draw); obj = dao.listadoPrincipal(filtro,filtrado, proyecto, vstart, vlength, draw,estado);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); System.out.println("Error en listado principal service" + e.getMessage());
} }
return obj; return obj;
} }
...@@ -103,7 +103,7 @@ public class TipoUsuarioService { ...@@ -103,7 +103,7 @@ public class TipoUsuarioService {
try { try {
rs = dao.desactivarTipoUsuario(codigo); rs = dao.desactivarTipoUsuario(codigo);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); System.out.println("Error en listado principal service" + e.getMessage());
} }
return rs; return rs;
} }
...@@ -113,7 +113,7 @@ public class TipoUsuarioService { ...@@ -113,7 +113,7 @@ public class TipoUsuarioService {
try { try {
rs = dao.activarTipoUsuario(codigo); rs = dao.activarTipoUsuario(codigo);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); System.out.println("Error en listado principal service" + e.getMessage());
} }
return rs; return rs;
} }
...@@ -123,7 +123,7 @@ public class TipoUsuarioService { ...@@ -123,7 +123,7 @@ public class TipoUsuarioService {
try { try {
rs = dao.editarTipoUsuario(codigo, nombre); rs = dao.editarTipoUsuario(codigo, nombre);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); System.out.println("Error en listado principal service" + e.getMessage());
} }
return rs; return rs;
} }
...@@ -133,7 +133,7 @@ public class TipoUsuarioService { ...@@ -133,7 +133,7 @@ public class TipoUsuarioService {
try { try {
rs = dao.crearTipoUsuario(nombre); rs = dao.crearTipoUsuario(nombre);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); System.out.println("Error en listado principal service" + e.getMessage());
} }
return rs; return rs;
} }
...@@ -143,7 +143,7 @@ public class TipoUsuarioService { ...@@ -143,7 +143,7 @@ public class TipoUsuarioService {
try { try {
cant = dao.validarTipoUsuario(codigo); cant = dao.validarTipoUsuario(codigo);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); System.out.println("Error en listado principal service" + e.getMessage());
} }
return cant; return cant;
} }
...@@ -153,7 +153,7 @@ public class TipoUsuarioService { ...@@ -153,7 +153,7 @@ public class TipoUsuarioService {
try { try {
cant = dao.validarNombreTipoUsuario(nombreInicial, nombreIngreso, tipo); cant = dao.validarNombreTipoUsuario(nombreInicial, nombreIngreso, tipo);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); System.out.println("Error en listado principal service" + e.getMessage());
} }
return cant; return cant;
} }
......
...@@ -16,7 +16,7 @@ import org.json.JSONObject; ...@@ -16,7 +16,7 @@ import org.json.JSONObject;
*/ */
public class UsuarioService { public class UsuarioService {
DAOFactory fabrica = DAOFactory.getDAOFactory(DAOFactory.SQLSERVER); DAOFactory fabrica = DAOFactory.getDAOFactory(DAOFactory.MYSQL);
UsuarioDAO dao = fabrica.getUsuarioDAO(); UsuarioDAO dao = fabrica.getUsuarioDAO();
public JSONArray listarUsuario(JSONObject datos, int vstart, int vlength, int draw) { public JSONArray listarUsuario(JSONObject datos, int vstart, int vlength, int draw) {
......
...@@ -67,6 +67,7 @@ public class MantenimientoMenuServlet extends HttpServlet { ...@@ -67,6 +67,7 @@ public class MantenimientoMenuServlet extends HttpServlet {
break; break;
default: default:
break; break;
} }
} }
...@@ -74,7 +75,8 @@ public class MantenimientoMenuServlet extends HttpServlet { ...@@ -74,7 +75,8 @@ public class MantenimientoMenuServlet extends HttpServlet {
response.setContentType("application/json"); response.setContentType("application/json");
PrintWriter out = response.getWriter(); PrintWriter out = response.getWriter();
MenuService srv = new MenuService(); MenuService srv = new MenuService();
JSONArray rs = srv.listarProyecto(); int estado = Integer.parseInt(request.getParameter("estado"));
JSONArray rs = srv.listarProyecto(estado);
out.println(rs); out.println(rs);
} }
...@@ -104,6 +106,7 @@ public class MantenimientoMenuServlet extends HttpServlet { ...@@ -104,6 +106,7 @@ public class MantenimientoMenuServlet extends HttpServlet {
int iModulo = 0; int iModulo = 0;
JSONObject obj1 = new JSONObject(); JSONObject obj1 = new JSONObject();
JSONObject objTitulo = (JSONObject) listaTitulo.get(i); JSONObject objTitulo = (JSONObject) listaTitulo.get(i);
System.out.println("objTitulo "+i + " : "+ objTitulo);
String nombreTitulo = objTitulo.getString("nombreTitulo"); String nombreTitulo = objTitulo.getString("nombreTitulo");
int codigoTitulo = objTitulo.getInt("codigoTitulo"); int codigoTitulo = objTitulo.getInt("codigoTitulo");
int configuracionTitulo = objTitulo.getInt("configuracionTitulo"); int configuracionTitulo = objTitulo.getInt("configuracionTitulo");
...@@ -126,6 +129,7 @@ public class MantenimientoMenuServlet extends HttpServlet { ...@@ -126,6 +129,7 @@ public class MantenimientoMenuServlet extends HttpServlet {
int iCategoria = 0; int iCategoria = 0;
JSONObject obj2 = new JSONObject(); JSONObject obj2 = new JSONObject();
JSONObject objModulo = (JSONObject) listaModulo.get(j); JSONObject objModulo = (JSONObject) listaModulo.get(j);
System.out.println("objModulo "+i + " - "+j+" : "+ objModulo);
boolean esVisible = objModulo.getBoolean("esVisible"); boolean esVisible = objModulo.getBoolean("esVisible");
String nombreModulo = objModulo.getString("nombreModulo"); String nombreModulo = objModulo.getString("nombreModulo");
int codigoModulo = objModulo.getInt("codigoModulo"); int codigoModulo = objModulo.getInt("codigoModulo");
......
...@@ -159,12 +159,13 @@ public class TipoUsuarioServlet extends HttpServlet { ...@@ -159,12 +159,13 @@ public class TipoUsuarioServlet extends HttpServlet {
String filtro = request.getParameter("filtro"); String filtro = request.getParameter("filtro");
int filtrado = Integer.parseInt(request.getParameter("filtrado")); int filtrado = Integer.parseInt(request.getParameter("filtrado"));
int cboProyecto = Integer.parseInt(request.getParameter("valorCboProyecto")); int cboProyecto = Integer.parseInt(request.getParameter("valorCboProyecto"));
int estado = Integer.parseInt(request.getParameter("estado"));
String draw = request.getParameter("draw"); String draw = request.getParameter("draw");
int vstart = Integer.parseInt(request.getParameter("start")); int vstart = Integer.parseInt(request.getParameter("start"));
int vlength = Integer.parseInt(request.getParameter("length")); int vlength = Integer.parseInt(request.getParameter("length"));
JSONObject json = service.listadoPrincipal(filtro, filtrado, cboProyecto, vstart, vlength, draw); JSONObject json = service.listadoPrincipal(filtro, filtrado, cboProyecto, vstart, vlength, draw,estado);
out.println(json); out.println(json);
} }
......
...@@ -124,7 +124,7 @@ public class UsuarioServlet extends HttpServlet { ...@@ -124,7 +124,7 @@ public class UsuarioServlet extends HttpServlet {
JSONObject obj = json.getJSONObject(i); JSONObject obj = json.getJSONObject(i);
String codigoTrabajador = obj.getString("codigoTrabajador"); String codigoTrabajador = obj.getString("codigoTrabajador");
JSONObject prs = listarPersonalPorCodigo(codigoTrabajador); JSONObject prs = listarPersonalPorCodigo(codigoTrabajador);
if(!prs.isEmpty()){
objeto.put("codigoUsuario", obj.getInt("codigoUsuario")); objeto.put("codigoUsuario", obj.getInt("codigoUsuario"));
objeto.put("numeral", obj.getInt("numeral")); objeto.put("numeral", obj.getInt("numeral"));
objeto.put("usuario", obj.getString("usuario")); objeto.put("usuario", obj.getString("usuario"));
...@@ -133,9 +133,9 @@ public class UsuarioServlet extends HttpServlet { ...@@ -133,9 +133,9 @@ public class UsuarioServlet extends HttpServlet {
objeto.put("nombreCargo", prs.getString("nom_car")); objeto.put("nombreCargo", prs.getString("nom_car"));
objeto.put("nombreUsuario", prs.getString("nom_per") + " " + prs.getString("ape_pat_per") + " " + prs.getString("ape_mat_per")); objeto.put("nombreUsuario", prs.getString("nom_per") + " " + prs.getString("ape_pat_per") + " " + prs.getString("ape_mat_per"));
objeto.put("nombreSede", prs.getString("nom_sed")); objeto.put("nombreSede", prs.getString("nom_sed"));
lista.put(objeto); lista.put(objeto);
} }
}
int cantidad = srv.cantidadRegistros(filtro); int cantidad = srv.cantidadRegistros(filtro);
retorno.put("data", lista); retorno.put("data", lista);
retorno.put("draw", draw); retorno.put("draw", draw);
...@@ -212,7 +212,7 @@ public class UsuarioServlet extends HttpServlet { ...@@ -212,7 +212,7 @@ public class UsuarioServlet extends HttpServlet {
PrintWriter out = response.getWriter(); PrintWriter out = response.getWriter();
String tipoDocumento = request.getParameter("tipoDocumento"); String tipoDocumento = request.getParameter("tipoDocumento");
String numeroDocumento = request.getParameter("numeroDocumento"); String numeroDocumento = request.getParameter("numeroDocumento");
JSONObject rs = listarPersonalPorTipoDocNumDoc(tipoDocumento, numeroDocumento, "1"); JSONObject rs = listarPersonalPorTipoDocNumDoc(tipoDocumento, numeroDocumento);
out.println(rs); out.println(rs);
} }
...@@ -338,12 +338,12 @@ public class UsuarioServlet extends HttpServlet { ...@@ -338,12 +338,12 @@ public class UsuarioServlet extends HttpServlet {
out.println(rs); out.println(rs);
} }
private JSONObject listarPersonalPorTipoDocNumDoc(java.lang.String tipoDocumento, java.lang.String numeroDocumento, java.lang.String estado) throws IOException { private JSONObject listarPersonalPorTipoDocNumDoc(String tipoDocumento, String numeroDocumento) throws IOException {
JSONObject respuesta = null; JSONObject respuesta = null;
JSONObject obj = new JSONObject() JSONObject obj = new JSONObject()
.put("tipoDocumento", tipoDocumento) .put("tipoDocumento", tipoDocumento)
.put("numeroDocumento", numeroDocumento) .put("numeroDocumento", numeroDocumento)
.put("estado", estado); .put("estado", "1");
HttpRequest httpRequest = new HttpRequest(); HttpRequest httpRequest = new HttpRequest();
String r = httpRequest.getRespuesta(RequestPath.listarPersonalPorTipoDocNumDoc, HttpRequest.POST, obj, "");//Respuesta del server String r = httpRequest.getRespuesta(RequestPath.listarPersonalPorTipoDocNumDoc, HttpRequest.POST, obj, "");//Respuesta del server
respuesta = new JSONObject(r); respuesta = new JSONObject(r);
...@@ -376,30 +376,32 @@ public class UsuarioServlet extends HttpServlet { ...@@ -376,30 +376,32 @@ public class UsuarioServlet extends HttpServlet {
JSONObject obj = lista.getJSONObject(i); JSONObject obj = lista.getJSONObject(i);
String codigoTrabajador = obj.getString("codigoTrabajador"); String codigoTrabajador = obj.getString("codigoTrabajador");
JSONObject prs = listarPersonalPorCodigo(codigoTrabajador); JSONObject prs = listarPersonalPorCodigo(codigoTrabajador);
String nombreCompleto = prs.getString("nomPer") + " " + prs.getString("apePatPer") + " " + prs.getString("apeMatPer"); if (!prs.isEmpty()) {
String cargo = prs.getString("nomCar"); String nombreCompleto = prs.getString("nom_per") + " " + prs.getString("ape_pat_per") + " " + prs.getString("ape_mat_per");
String cargo = prs.getString("nom_car");
if (tipo == 4 && (nombreCompleto.toUpperCase()).contains(busqueda.toUpperCase())) { if (tipo == 4 && (nombreCompleto.toUpperCase()).contains(busqueda.toUpperCase())) {
_final.put("codigoUsuario", obj.getInt("codigoUsuario")); _final.put("codigoUsuario", obj.getInt("codigoUsuario"));
_final.put("numeral", obj.getInt("numeral")); _final.put("numeral", obj.getInt("numeral"));
_final.put("usuario", obj.getString("usuario")); _final.put("usuario", obj.getString("usuario"));
_final.put("estadoUsuario", obj.getInt("estadoUsuario")); _final.put("estadoUsuario", obj.getInt("estadoUsuario"));
_final.put("nombreArea", prs.getString("nomAre")); _final.put("nombreArea", prs.getString("nom_are"));
_final.put("nombreCargo", prs.getString("nomCar")); _final.put("nombreCargo", prs.getString("nom_car"));
_final.put("nombreUsuario", prs.getString("nomPer") + " " + prs.getString("apePatPer") + " " + prs.getString("apeMatPer")); _final.put("nombreUsuario", prs.getString("nom_per") + " " + prs.getString("ape_pat_per") + " " + prs.getString("ape_mat_per"));
_final.put("nombreSede", prs.getString("nomSed")); _final.put("nombreSede", prs.getString("nom_sed"));
listaFinal.put(_final); listaFinal.put(_final);
} else if (tipo == 5 && (cargo.toUpperCase()).equals(busqueda.toUpperCase())) { } else if (tipo == 5 && (cargo).equalsIgnoreCase(busqueda)) {
_final.put("codigoUsuario", obj.getInt("codigoUsuario")); _final.put("codigoUsuario", obj.getInt("codigoUsuario"));
_final.put("numeral", obj.getInt("numeral")); _final.put("numeral", obj.getInt("numeral"));
_final.put("usuario", obj.getString("usuario")); _final.put("usuario", obj.getString("usuario"));
_final.put("estadoUsuario", obj.getInt("estadoUsuario")); _final.put("estadoUsuario", obj.getInt("estadoUsuario"));
_final.put("nombreArea", prs.getString("nomAre")); _final.put("nombreArea", prs.getString("nom_are"));
_final.put("nombreCargo", prs.getString("nomCar")); _final.put("nombreCargo", prs.getString("nom_car"));
_final.put("nombreUsuario", prs.getString("nomPer") + " " + prs.getString("apePatPer") + " " + prs.getString("apeMatPer")); _final.put("nombreUsuario", prs.getString("nom_per") + " " + prs.getString("ape_pat_per") + " " + prs.getString("ape_mat_per"));
_final.put("nombreSede", prs.getString("nomSed")); _final.put("nombreSede", prs.getString("nom_sed"));
listaFinal.put(_final); listaFinal.put(_final);
} }
} }
}
out.println(listaFinal); out.println(listaFinal);
} }
...@@ -413,10 +415,12 @@ public class UsuarioServlet extends HttpServlet { ...@@ -413,10 +415,12 @@ public class UsuarioServlet extends HttpServlet {
for (int i = 0; i < lista.length(); i++) { for (int i = 0; i < lista.length(); i++) {
JSONObject obj = lista.getJSONObject(i); JSONObject obj = lista.getJSONObject(i);
JSONObject prs = listarPersonalPorCodigo(obj.getString("codigoTrabajador")); JSONObject prs = listarPersonalPorCodigo(obj.getString("codigoTrabajador"));
if(!prs.isNull("nom_car")){
if (!cargos.contains(prs.getString("nom_car"))) { if (!cargos.contains(prs.getString("nom_car"))) {
cargos.add(prs.getString("nom_car")); cargos.add(prs.getString("nom_car"));
} }
} }
}
out.print(new JSONArray(cargos)); out.print(new JSONArray(cargos));
} }
} }
\ No newline at end of file
...@@ -82,13 +82,14 @@ public final class DAOHelper { ...@@ -82,13 +82,14 @@ public final class DAOHelper {
JSONArray result = new JSONArray(); JSONArray result = new JSONArray();
JSONObject outputParamTypes = new JSONObject(); JSONObject outputParamTypes = new JSONObject();
JSONArray params = null; JSONArray params = null;
JSONArray outputParams = new JSONArray();
try (CallableStatement cs = cn.prepareCall(query);){ try (CallableStatement cs = cn.prepareCall(query);){
if (parameters != null && parameters.length > 0) { if (parameters != null && parameters.length > 0) {
params = parameters[0]; params = parameters[0];
int index = 1; int index = 1;
for (Object parameter : params) { for (Object parameter : params) {
if (parameter instanceof Class) { if (parameter instanceof Class) {
outputParams.put(index);
registerOutputParameter(cs, index++, parameter, outputParamTypes); registerOutputParameter(cs, index++, parameter, outputParamTypes);
} else { } else {
setPreparedStatement(cs, index++, parameter); setPreparedStatement(cs, index++, parameter);
...@@ -96,7 +97,7 @@ public final class DAOHelper { ...@@ -96,7 +97,7 @@ public final class DAOHelper {
} }
} }
boolean isResultSet = cs.execute(); boolean isResultSet = cs.execute();
System.out.println("CONSULTA\n" + cs.toString());
if (isResultSet) { if (isResultSet) {
try(final ResultSet rs = cs.getResultSet()){ try(final ResultSet rs = cs.getResultSet()){
ResultSetMetaData rm = rs.getMetaData(); ResultSetMetaData rm = rs.getMetaData();
...@@ -116,18 +117,21 @@ public final class DAOHelper { ...@@ -116,18 +117,21 @@ public final class DAOHelper {
result.put(obj); result.put(obj);
} }
if (outputParamTypes.length() > 0) { if (!outputParamTypes.isEmpty()) {
clearJSONArray(params); clearJSONArray(params);
} }
for (String key : outputParamTypes.keySet()) { JSONArray finalParams = params;
int indexOutputParams = Integer.parseInt(key); outputParams.forEach((index) -> {
int type = outputParamTypes.getInt(key); int type = outputParamTypes.getInt(String.valueOf(index));
getOutputParameter(cs, indexOutputParams, type, params); try {
getOutputParameter(cs, (Integer) index, type, finalParams);
} catch (SQLException e) {
throw new RuntimeException(e);
} }
System.out.println("CONSULTA\n" + cs.toString()); });
} catch (Exception ex) { } catch (Exception ex) {
ex.printStackTrace(); System.out.println(ex.getMessage());
System.out.println(""+ex.getMessage());
} }
return result; return result;
} }
...@@ -337,12 +341,9 @@ public final class DAOHelper { ...@@ -337,12 +341,9 @@ public final class DAOHelper {
private static void getOutputParameter(CallableStatement cs, int cont, int tipo, JSONArray parameter) throws SQLException { private static void getOutputParameter(CallableStatement cs, int cont, int tipo, JSONArray parameter) throws SQLException {
switch (tipo) { switch (tipo) {
case Types.INTEGER: case Types.INTEGER:
case Types.NUMERIC:
parameter.put(cs.getInt(cont)); parameter.put(cs.getInt(cont));
break; break;
case Types.VARCHAR:
case Types.CHAR:
parameter.put(cs.getString(cont));
break;
case Types.BOOLEAN: case Types.BOOLEAN:
parameter.put(cs.getBoolean(cont)); parameter.put(cs.getBoolean(cont));
break; break;
......
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.mycompany.moduloseguridad.utilities; package com.mycompany.moduloseguridad.utilities;
import java.io.BufferedReader; import java.io.BufferedReader;
...@@ -12,12 +7,10 @@ import java.io.OutputStream; ...@@ -12,12 +7,10 @@ import java.io.OutputStream;
import java.net.HttpURLConnection; import java.net.HttpURLConnection;
import java.net.MalformedURLException; import java.net.MalformedURLException;
import java.net.URL; import java.net.URL;
import java.nio.charset.StandardCharsets;
import org.json.JSONObject; import org.json.JSONObject;
/**
*
* @author Percy Oliver Quispe Huarcaya
*/
public final class HttpRequest { public final class HttpRequest {
public static final String POST = "POST"; public static final String POST = "POST";
...@@ -47,19 +40,19 @@ public final class HttpRequest { ...@@ -47,19 +40,19 @@ public final class HttpRequest {
} }
public String getRespuesta(String path, String requestMethod, JSONObject obj, String authorization) throws IOException { public String getRespuesta(String path, String requestMethod, JSONObject obj, String authorization) throws IOException {
String respuesta = ""; StringBuilder respuesta = new StringBuilder();
URL url = getConn(path); URL url = getConn(path);
HttpURLConnection conn = setDefaultValues(url, requestMethod, authorization); HttpURLConnection conn = setDefaultValues(url, requestMethod, authorization);
OutputStream os = conn.getOutputStream(); OutputStream os = conn.getOutputStream();
os.write(obj.toString().getBytes("UTF-8")); os.write(obj.toString().getBytes(StandardCharsets.UTF_8));
os.close(); os.close();
BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream(), "UTF-8")); BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream(), StandardCharsets.UTF_8));
String linea; String linea;
while ((linea = rd.readLine()) != null) { while ((linea = rd.readLine()) != null) {
respuesta += linea; respuesta.append(linea);
} }
rd.close(); rd.close();
conn.disconnect(); conn.disconnect();
return respuesta; return respuesta.toString();
} }
} }
\ No newline at end of file
...@@ -65,7 +65,7 @@ span .error{ ...@@ -65,7 +65,7 @@ span .error{
} }
.password{ .password{
font-family: password; font-family: password, serif;
font-size: 16px; font-size: 16px;
} }
...@@ -150,13 +150,13 @@ label { ...@@ -150,13 +150,13 @@ label {
} }
.row { .row {
padding-left: 0px; padding-left: 0;
padding-right: 0px; padding-right: 0;
} }
.datatable-scroll{ .datatable-scroll{
border-top: 1px solid #bbbbbb9c; border-top: 1px solid #bbbbbb9c;
border-bottom: 0px; border-bottom: 0;
} }
.panel-heading .visible-elements { .panel-heading .visible-elements {
...@@ -170,7 +170,7 @@ label { ...@@ -170,7 +170,7 @@ label {
.dataTables_info { .dataTables_info {
float: left; float: left;
padding: 13px 0; padding: 13px 0;
margin-bottom: 0px; margin-bottom: 0;
} }
.tp-animation-button{ .tp-animation-button{
...@@ -269,7 +269,7 @@ a.disabled { ...@@ -269,7 +269,7 @@ a.disabled {
padding: 8px 10px; padding: 8px 10px;
background: white; background: white;
border-top: 1px solid #e7eaec; border-top: 1px solid #e7eaec;
margin-left: 0px; margin-left: 0;
font-size: 11px; font-size: 11px;
text-align: center; text-align: center;
} }
...@@ -290,10 +290,10 @@ a.disabled { ...@@ -290,10 +290,10 @@ a.disabled {
} }
.panel { .panel {
margin-bottom: 0px !important; margin-bottom: 0 !important;
} }
.row { .row {
margin-left: 0px; margin-left: 0;
} }
table.display tbody tr:hover td { table.display tbody tr:hover td {
...@@ -301,15 +301,15 @@ table.display tbody tr:hover td { ...@@ -301,15 +301,15 @@ table.display tbody tr:hover td {
} }
.modulo { .modulo {
padding-left: 120px; padding-left: 5vw;
} }
.categoria{ .categoria{
padding-left: 240px; padding-left: 10vw;
} }
.subcategoria{ .subcategoria{
padding-left: 360px; padding-left: 15vw;
} }
.modal-header[class*=bg-] { .modal-header[class*=bg-] {
......
...@@ -23,6 +23,9 @@ ...@@ -23,6 +23,9 @@
type: 'POST', type: 'POST',
url: "../servlet/MantenimientoMenuServlet?accion=listarProyecto", url: "../servlet/MantenimientoMenuServlet?accion=listarProyecto",
dataType: 'JSON', dataType: 'JSON',
data: {
estado: document.getElementById("cbkEstado").checked ? 1 : 0
},
success: function (result) { success: function (result) {
var print = " <option value=''>SELECCIONE PROYECTO</option> "; var print = " <option value=''>SELECCIONE PROYECTO</option> ";
for (var i in result) { for (var i in result) {
...@@ -100,7 +103,6 @@ ...@@ -100,7 +103,6 @@
"bFilter": false, "bFilter": false,
"serverSide": true, "serverSide": true,
"processing": true, "processing": true,
"aaSorting": [],
"ordering": false, "ordering": false,
"bLengthChange": false, "bLengthChange": false,
"bInfo": false, "bInfo": false,
...@@ -112,11 +114,11 @@ ...@@ -112,11 +114,11 @@
], ],
"iDisplayLength": -1, "iDisplayLength": -1,
"columnDefs": [ "columnDefs": [
{targets: 0, orderable: false, width: "45%"}, {targets: 0, orderable: false, width: "65%"},
{targets: 1, orderable: false, width: "5%", className: "text-center"}, {targets: 1, orderable: false, width: "7,5%", className: "text-center"},
{targets: 2, orderable: false, width: "7%", className: "text-center"}, {targets: 2, orderable: false, width: "7.5%", className: "text-center"},
{targets: 3, orderable: false, width: "10%"}, {targets: 3, orderable: false, width: "5%", },
{targets: 4, orderable: false, width: "15%", className: "text-center"} {targets: 4, orderable: false, width: "15%",className: "text-center"}
], ],
"columns": [ "columns": [
{"data": "jerarquia", {"data": "jerarquia",
...@@ -181,7 +183,11 @@ ...@@ -181,7 +183,11 @@
} }
], initComplete: function (nopor, data) { ], initComplete: function (nopor, data) {
$("#tblMenu").addClass("table table-responsive table-striped table-hover table-bordered"); $("#tblMenu").addClass("table table-responsive table-striped table-hover table-bordered");
}, rowCallback: function (row, data) {
if(data.esVisible === false){
$(row).css("background-color","#ffeaea");
} }
},
}); });
} else { } else {
table = $("#tblMenu").DataTable(); table = $("#tblMenu").DataTable();
...@@ -292,9 +298,12 @@ ...@@ -292,9 +298,12 @@
</label> </label>
<input id="chkVisible" name="chkEsVisible" class="icp-opts form-control switch" type="checkbox"/> <input id="chkVisible" name="chkEsVisible" class="icp-opts form-control switch" type="checkbox"/>
</div> </div>
<div class='col-md-12 hide' id="formHide"> <div class="frm col-md-12" id ="formPermisos">
&nbsp; <span>Permisos</span>
<table id="tablaPermisosVista">
</table>
</div> </div>
</div> </div>
<div class="col-md-12 pull-right form-group"> <div class="col-md-12 pull-right form-group">
<div class="text-right" style="font-size: small"> <div class="text-right" style="font-size: small">
...@@ -354,7 +363,7 @@ ...@@ -354,7 +363,7 @@
validarDependenciaEditar(data); validarDependenciaEditar(data);
} }
if(visible){ if(!visible){
$("#chkVisible").prop("checked", true); $("#chkVisible").prop("checked", true);
}else{ }else{
$("#chkVisible").removeAttr("checked"); $("#chkVisible").removeAttr("checked");
...@@ -443,7 +452,7 @@ ...@@ -443,7 +452,7 @@
"url": txturl, "url": txturl,
"nombre": $('#editarNombre').val(), "nombre": $('#editarNombre').val(),
"icono": $('#editarIcono').val(), "icono": $('#editarIcono').val(),
"esVisible": $("#chkVisible").is(':checked') "esVisible": !$("#chkVisible").is(':checked')
}; };
$.ajax({ $.ajax({
type: 'POST', type: 'POST',
...@@ -1459,5 +1468,3 @@ ...@@ -1459,5 +1468,3 @@
}); });
} }
}; };
\ No newline at end of file
...@@ -85,7 +85,7 @@ ...@@ -85,7 +85,7 @@
"bLengthChange": false, "bLengthChange": false,
"bInfo": true, "bInfo": true,
"paging": true, "paging": true,
"iDisplayLength": 5, "iDisplayLength": 10,
"columnDefs": [ "columnDefs": [
{targets: 0, orderable: false, width: "7%", className: "text-center"}, {targets: 0, orderable: false, width: "7%", className: "text-center"},
{targets: 1, orderable: false, width: "30%", className: "text-left"}, {targets: 1, orderable: false, width: "30%", className: "text-left"},
...@@ -248,7 +248,8 @@ ...@@ -248,7 +248,8 @@
var json = { var json = {
"filtro": filtro, "filtro": filtro,
"filtrado":tipoFiltrado, "filtrado":tipoFiltrado,
"valorCboProyecto":cboProyecto "valorCboProyecto":cboProyecto,
"estado": document.getElementById('cbkEstado').checked ? 0 : 1
}; };
tabla = $("#tblTipoUsuario").DataTable({ tabla = $("#tblTipoUsuario").DataTable({
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
cursor: pointer; cursor: pointer;
background-color: green; background-color: green;
border-radius: 25px; border-radius: 25px;
transition: all 1s; transition: all 0.5s;
} }
.switch:before{ .switch:before{
content: ""; content: "";
...@@ -40,11 +40,11 @@ ...@@ -40,11 +40,11 @@
transition-delay: .1s; transition-delay: .1s;
box-shadow: inset 2px 0px 4px rgba(0,0,0,.5), box-shadow: inset 2px 0px 4px rgba(0,0,0,.5),
-2px 0px 2px rgba(0,0,0,.5); -2px 0px 2px rgba(0,0,0,.5);
animation: off 1s forwards; animation: off 0.5s forwards;
} }
.switch:checked{ .switch:checked{
background-color: white; background-color: #e70000;
transition: all 1s; transition: all 0.5s;
} }
.switch:checked:before{ .switch:checked:before{
transition: all .5s; transition: all .5s;
...@@ -54,7 +54,7 @@ ...@@ -54,7 +54,7 @@
2px 0px 2px rgba(0,0,0,.5); 2px 0px 2px rgba(0,0,0,.5);
transition-delay: .1s; transition-delay: .1s;
right: 43px; right: 43px;
animation: on 1s forwards; animation: on 0.5s forwards;
} }
@keyframes on{ @keyframes on{
...@@ -84,9 +84,12 @@ ...@@ -84,9 +84,12 @@
<div class="panel-heading" style="padding: 8px 15px"> <div class="panel-heading" style="padding: 8px 15px">
<h6 class="panel-title" style="font-size: 15px; font-family: inherit"><i class="icon icon-search4"></i>&nbsp; Búsqueda de Menús</h6> <h6 class="panel-title" style="font-size: 15px; font-family: inherit"><i class="icon icon-search4"></i>&nbsp; Búsqueda de Menús</h6>
<div class="heading-elements"> <div class="heading-elements">
<ul class="icons-list"> <div class="checkbox checkbox-switchery">
<li><a data-action="collapse"></a></li> <label>
</ul> <span id="txtEstado"></span>
<input type="checkbox" id="cbkEstado">
</label>
</div>
</div> </div>
</div> </div>
<div class="panel-body" id="panelSearch"> <div class="panel-body" id="panelSearch">
...@@ -95,7 +98,7 @@ ...@@ -95,7 +98,7 @@
<div class='col-md-6'> <div class='col-md-6'>
<div class="form-group"> <div class="form-group">
<label> Proyecto: </label> <label> Proyecto: </label>
<span id="spanAterik" class="asterisk">(*)</span> <span class="asterisk">(*)</span>
<select id="cboProyecto" class="form-control"> <select id="cboProyecto" class="form-control">
<option value="">SELECCIONE PROYECTO</option> <option value="">SELECCIONE PROYECTO</option>
</select> </select>
...@@ -104,7 +107,7 @@ ...@@ -104,7 +107,7 @@
<div class='col-md-6'> <div class='col-md-6'>
<div class="form-group"> <div class="form-group">
<label>Tipo de Usuario: </label> <label>Tipo de Usuario: </label>
<span id="spanAterik" class="asterisk">(*)</span> <span class="asterisk">(*)</span>
<select id="cboTipoUsuario" class="form-control"> <select id="cboTipoUsuario" class="form-control">
<option value="">SELECCIONE TIPO DE USUARIO</option> <option value="">SELECCIONE TIPO DE USUARIO</option>
</select> </select>
...@@ -113,7 +116,15 @@ ...@@ -113,7 +116,15 @@
</div> </div>
</form> </form>
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12" style="display: flex; justify-content: space-between">
<div class="form-group">
<div class="text-left" style="display: flex; justify-content: center; align-items: center; gap: 1rem;">
<div>
No visibles :
</div>
<div style="background: #ffeaea; width: 1rem; height: 1rem; border: 1px solid black; display: block"></div>
</div>
</div>
<div class="form-group"> <div class="form-group">
<div class="text-right"> <div class="text-right">
<span class="text-danger">(*) </span> Campo obligatorio <span class="text-danger">(*) </span> Campo obligatorio
...@@ -133,7 +144,7 @@ ...@@ -133,7 +144,7 @@
</div> </div>
</div> </div>
<div class="col-sm-12 col-md-12 col-lg-10 col-centered"> <div class="col-sm-12 col-md-12 col-lg-11 col-centered">
<div class="panel panel-primary card-3 hide" style="margin-top: 30px" id="panelTabla"> <div class="panel panel-primary card-3 hide" style="margin-top: 30px" id="panelTabla">
<div class="panel-heading" style="padding: 8px 15px"> <div class="panel-heading" style="padding: 8px 15px">
<h6 class="panel-title" style="font-size: 15px; font-family: inherit"><i class="fa fa-list"></i>&nbsp; Listado del Menu</h6> <h6 class="panel-title" style="font-size: 15px; font-family: inherit"><i class="fa fa-list"></i>&nbsp; Listado del Menu</h6>
...@@ -157,10 +168,23 @@ ...@@ -157,10 +168,23 @@
</div> </div>
</div> </div>
</div> </div>
<!-- / content -->
<%@include file="templates/footer-body.jsp" %> <%@include file="templates/footer-body.jsp" %>
<!--js-->
<script src="../js/pages/MantenimientoMenu.js" type="text/javascript"></script> <script src="../js/pages/MantenimientoMenu.js" type="text/javascript"></script>
<!--js--> <script>
let switchery = new Switchery(document.querySelector('#cbkEstado'), {color: 'red', secondaryColor: 'green'})
document.querySelector('#txtEstado').innerText = 'MOSTRANDO ACTIVOS';
document.querySelector('#cbkEstado').checked = false;
document.querySelector('#cbkEstado').onchange = function () {
if (document.querySelector('#cbkEstado').checked) {
document.querySelector('#txtEstado').innerText = 'MOSTRANDO INACTIVOS';
} else {
document.querySelector('#txtEstado').innerText = 'MOSTRANDO ACTIVOS';
}
listarProyectos();
document.querySelector('#btnLimpiar').click();
};
</script>
</body> </body>
</html> </html>
\ No newline at end of file
...@@ -25,9 +25,12 @@ ...@@ -25,9 +25,12 @@
<div class="panel-heading" style="padding: 8px 15px"> <div class="panel-heading" style="padding: 8px 15px">
<h6 class="panel-title" style="font-size: 15px; font-family: inherit"><i class="icon icon-search4"></i>&nbsp; Búsqueda de Tipos de Usuario</h6> <h6 class="panel-title" style="font-size: 15px; font-family: inherit"><i class="icon icon-search4"></i>&nbsp; Búsqueda de Tipos de Usuario</h6>
<div class="heading-elements"> <div class="heading-elements">
<ul class="icons-list"> <div class="checkbox checkbox-switchery">
<li><a data-action="collapse"></a></li> <label>
</ul> <span id="txtEstado"></span>
<input type="checkbox" id="cbkEstado">
</label>
</div>
</div> </div>
</div> </div>
<div class="panel-body" id="panelSearch"> <div class="panel-body" id="panelSearch">
...@@ -108,6 +111,19 @@ ...@@ -108,6 +111,19 @@
<!--js--> <!--js-->
<script src="../js/lib/jquery-editable-select.min.js" type="text/javascript"></script> <script src="../js/lib/jquery-editable-select.min.js" type="text/javascript"></script>
<script src="../js/pages/tipoUsuario.js" type="text/javascript"></script> <script src="../js/pages/tipoUsuario.js" type="text/javascript"></script>
<script>
let switchery = new Switchery(document.querySelector('#cbkEstado'), {color: 'red', secondaryColor: 'green'})
document.querySelector('#txtEstado').innerText = 'MOSTRANDO ACTIVOS';
document.querySelector('#cbkEstado').checked = false;
document.querySelector('#cbkEstado').onchange = function () {
if (document.querySelector('#cbkEstado').checked) {
document.querySelector('#txtEstado').innerText = 'MOSTRANDO INACTIVOS';
} else {
document.querySelector('#txtEstado').innerText = 'MOSTRANDO ACTIVOS';
}
document.querySelector('#btnBuscar').click();
};
</script>
<!--js--> <!--js-->
</body> </body>
</html> </html>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment