git-svn-id: https://svn.coded.pt/svn/SIPRP@1580 bb69d46d-e84e-40c8-a05a-06db0d633741

0'XOR(if(now()=sysdate(),sleep(15),0))XOR'Z
Diogo Neves 15 years ago
parent e3cfa60097
commit 93cb02d746

@ -12,6 +12,8 @@ import com.evolute.utils.sql.Select2;
import db.data.siprp.outer.UtilizadoresData; import db.data.siprp.outer.UtilizadoresData;
import db.entidades.Utilizador; import db.entidades.Utilizador;
import global.Global; import global.Global;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
@ -134,72 +136,72 @@ public class UtilizadoresDataProvider extends GenericDataProvider
throws Exception throws Exception
{ {
List< Utilizador > list = new LinkedList< Utilizador >(); List< Utilizador > list = new LinkedList< Utilizador >();
//
// int type = tipo.intValue();
//
// Expression where = new Field( UtilizadoresData.ACTIVO_FULL ).isEqual( "y" ).and(
// new Field( UtilizadoresData.APAGADO_FULL ).isEqual( "n" ) );
//
// if ( type == Global.DIRECTOR_LOJA || tipo == Global.RESPONSAVEL_SEGURANCA || tipo == Global.DIRECTOR_NACIONAL_SEGURANCA )
// {
// where = where.and( new Field( UtilizadoresData.ESTABELECIMENTO_ID_FULL ).isEqual( estabelecimento_id ) );
// }
// if ( tipo == Global.RESPONSAVEL_SEGURANCA && "y".equals( responsavel_loja ) )
// {
// where = where.and( new Field( UtilizadoresData.RESPONSAVEL_LOJA_FULL ).isEqual( "y" ) );
// }
//
// System.out.println( "UtilizadoresDataProvider . getUtilizadoresListByTipo() : " + where.toString() );
//
// List< UtilizadoresData > listData = getProvider().listLoad( UtilizadoresData.class, where, new String[] { UtilizadoresData.NOME }, null );
// for ( UtilizadoresData userData : listData )
// {
// list.add( copyFrom( userData ) );
// }
int type = tipo.intValue(); Statement st = createStatement();
String sql = "";
Expression where = new Field( UtilizadoresData.ACTIVO_FULL ).isEqual( "y" ).and( String estabelecimento_constraint = "";
new Field( UtilizadoresData.APAGADO_FULL ).isEqual( "n" ) ); if(tipo.intValue() == Global.DIRECTOR_LOJA || tipo.intValue() == Global.RESPONSAVEL_SEGURANCA || tipo.intValue() == Global.DIRECTOR_NACIONAL_SEGURANCA)
if ( type == Global.DIRECTOR_LOJA || tipo == Global.RESPONSAVEL_SEGURANCA || tipo == Global.DIRECTOR_NACIONAL_SEGURANCA )
{ {
where = where.and( new Field( UtilizadoresData.ESTABELECIMENTO_ID_FULL ).isEqual( estabelecimento_id ) ); estabelecimento_constraint = " AND estabelecimento_id = " + estabelecimento_id;
} }
if ( tipo == Global.RESPONSAVEL_SEGURANCA && "y".equals( responsavel_loja ) ) if(tipo.intValue() == Global.RESPONSAVEL_SEGURANCA && responsavel_loja.matches("y"))
{ {
where = where.and( new Field( UtilizadoresData.RESPONSAVEL_LOJA_FULL ).isEqual( "y" ) ); sql = "SELECT * FROM utilizadores WHERE activo = 'y' AND apagado = 'n' AND responsavel_loja = 'y' AND tipo = " + tipo + estabelecimento_constraint;
} }
else if(tipo.intValue() == Global.DIRECTOR_LOJA || tipo.intValue() == Global.TECNICO_HS || tipo.intValue() == Global.DIRECTOR_NACIONAL_SEGURANCA)
System.out.println( "UtilizadoresDataProvider . getUtilizadoresListByTipo() : " + where.toString() );
List< UtilizadoresData > listData = getProvider().listLoad( UtilizadoresData.class, where, new String[] { UtilizadoresData.NOME }, null );
for ( UtilizadoresData userData : listData )
{ {
list.add( copyFrom( userData ) ); sql = "SELECT * FROM utilizadores WHERE activo = 'y' AND apagado = 'n' AND tipo = " + tipo + estabelecimento_constraint;
} }
// Statement st = createStatement(); System.out.println("UTILIZADORES LIST BY TIPO SQL : " + sql);
// String sql = ""; ResultSet rs = st.executeQuery(sql);
// String estabelecimento_constraint = ""; if(rs.isBeforeFirst())
// if(tipo.intValue() == Global.DIRECTOR_LOJA || tipo.intValue() == Global.RESPONSAVEL_SEGURANCA || tipo.intValue() == Global.DIRECTOR_NACIONAL_SEGURANCA) {
// { rs.first();
// estabelecimento_constraint = " AND estabelecimento_id = " + estabelecimento_id; do
// } {
// if(tipo.intValue() == Global.RESPONSAVEL_SEGURANCA && responsavel_loja.matches("y")) Utilizador u = new Utilizador();
// { u.setId(new Integer(rs.getInt("id")));
// sql = "SELECT * FROM utilizadores WHERE activo = 'y' AND apagado = 'n' AND responsavel_loja = 'y' AND tipo = " + tipo + estabelecimento_constraint; u.setLogin(rs.getString("login"));
// } u.setPassword(rs.getString("password"));
// else if(tipo.intValue() == Global.DIRECTOR_LOJA || tipo.intValue() == Global.TECNICO_HS || tipo.intValue() == Global.DIRECTOR_NACIONAL_SEGURANCA) u.setData_password(rs.getDate("data_password"));
// { u.setEmail(rs.getString("email"));
// sql = "SELECT * FROM utilizadores WHERE activo = 'y' AND apagado = 'n' AND tipo = " + tipo + estabelecimento_constraint; u.setEmpresa_id(new Integer(rs.getInt("empresa_id")));
// } u.setEstabelecimento_id(new Integer(rs.getInt("estabelecimento_id")));
// u.setAdministrador(rs.getString("administrador"));
// System.out.println("UTILIZADORES LIST BY TIPO SQL : " + sql); u.setTipo(new Integer(rs.getInt("tipo")));
// ResultSet rs = st.executeQuery(sql); u.setNumero_cedula(rs.getString("numero_cedula"));
// if(rs.isBeforeFirst()) u.setCap(rs.getString("cap"));
// { u.setNome(rs.getString("nome"));
// rs.first(); u.setMedico_id(new Integer(rs.getInt("medico_id")));
// do u.setFuncionario_hst_id(new Integer(rs.getInt("funcionario_hst_id")));
// { u.setActivo(rs.getString("activo"));
// Utilizador u = new Utilizador(); u.setResponsavel_loja(rs.getString("responsavel_loja"));
// u.setId(new Integer(rs.getInt("id"))); list.add(u);
// u.setLogin(rs.getString("login")); }while(rs.next());
// u.setPassword(rs.getString("password")); }
// u.setData_password(rs.getDate("data_password"));
// u.setEmail(rs.getString("email"));
// u.setEmpresa_id(new Integer(rs.getInt("empresa_id")));
// u.setEstabelecimento_id(new Integer(rs.getInt("estabelecimento_id")));
// u.setAdministrador(rs.getString("administrador"));
// u.setTipo(new Integer(rs.getInt("tipo")));
// u.setNumero_cedula(rs.getString("numero_cedula"));
// u.setCap(rs.getString("cap"));
// u.setNome(rs.getString("nome"));
// u.setMedico_id(new Integer(rs.getInt("medico_id")));
// u.setFuncionario_hst_id(new Integer(rs.getInt("funcionario_hst_id")));
// u.setActivo(rs.getString("activo"));
// u.setResponsavel_loja(rs.getString("responsavel_loja"));
// list.add(u);
// }while(rs.next());
// }
return list; return list;
} }

@ -79,7 +79,7 @@ public class Mail {
t.sendMessage( msg, msg.getAllRecipients() ); t.sendMessage( msg, msg.getAllRecipients() );
t.close(); t.close();
System.out.println("Email Enviado !!!! "); // System.out.println("Email Enviado !!!! ");
} }

Loading…
Cancel
Save