diff --git a/trunk/siprp/lembretes/LembretesDataProvider.java b/trunk/siprp/lembretes/LembretesDataProvider.java new file mode 100644 index 00000000..a0bf722f --- /dev/null +++ b/trunk/siprp/lembretes/LembretesDataProvider.java @@ -0,0 +1,90 @@ +/* + * LembretesDataProvider.java + * + * Created on February 5, 2007, 6:09 PM + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.lembretes; + +import com.evolute.utils.Singleton; +import com.evolute.utils.arrays.Virtual2DArray; +import com.evolute.utils.db.DBManager; +import com.evolute.utils.db.Executer; +import com.evolute.utils.sql.Field; +import com.evolute.utils.sql.Select; +import java.util.Date; + +/** + * + * @author lflores + */ +public class LembretesDataProvider +{ + private static final Object LOCK = new Object(); + private static LembretesDataProvider instance = null; + + private Executer EXECUTER; + + /** Creates a new instance of LembretesDataProvider */ + public LembretesDataProvider() + throws Exception + { + DBManager dbm = ( DBManager ) Singleton.getInstance( Singleton.DEFAULT_DBMANAGER ); + EXECUTER = dbm.getSharedExecuter( this ); + } + + public static LembretesDataProvider getProvider() + throws Exception + { + synchronized( LOCK ) + { + if( instance == null ) + { + instance = new LembretesDataProvider(); + } + } + return instance; + } + + public TipoLembrete[] getTiposLembrete() + throws Exception + { + Select select = + new Select( new String[]{ "lembretes_tipos" }, + new String[]{ "id", "codigo", "descricao", "ordem" }, + new Field( "activo" ).isEqual( "y" ), + new String[]{ "ordem" }, + null ); + Virtual2DArray array = EXECUTER.executeQuery( select ); + TipoLembrete tipos[] = new TipoLembrete[ array.columnLength() ]; + for( int n = 0; n < tipos.length; n++ ) + { + Integer id = ( Integer ) array.get( n, 0 ); + String codigo = ( String ) array.get( n, 1 ); + String descricao = ( String ) array.get( n, 2 ); + Integer ordem = ( Integer ) array.get( n, 3 ); + tipos[ n ] = new TipoLembrete( id, codigo, descricao, ordem ); + } + return tipos; + } + + public void criarLembretes( Integer tipoID, + Date data, + String descricao, + String texto, + Integer empresaID, + Integer estabelecimentoID, + Integer trabalhadorID, + Integer marcacaoEstabelecimentoID, + Integer marcacaoTrabalhadorID, + boolean enviarEmail, + Integer periodicidadeDias, + Integer periodicidade_meses ) + throws Exception + { + + } +} diff --git a/trunk/siprp/lembretes/TipoLembrete.java b/trunk/siprp/lembretes/TipoLembrete.java new file mode 100644 index 00000000..e5564393 --- /dev/null +++ b/trunk/siprp/lembretes/TipoLembrete.java @@ -0,0 +1,65 @@ +/* + * TipoLembrete.java + * + * Created on February 5, 2007, 6:28 PM + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.lembretes; + +import com.evolute.utils.data.IDObject; + +/** + * + * @author lflores + */ +public class TipoLembrete + implements IDObject, Comparable +{ + protected Integer id; + protected String codigo; + protected String descricao; + protected Integer ordem; + + /** Creates a new instance of TipoLembrete */ + public TipoLembrete( Integer id, String codigo, String descricao, + Integer ordem ) + { + this.id = id; + this.codigo = codigo; + this.descricao = descricao; + this.ordem = ordem; + } + + public Integer getID() + { + return id; + } + + protected String getCodigo() + { + return codigo; + } + + protected String getDescricao() + { + return descricao; + } + + protected Integer getOrdem() + { + return ordem; + } + + public int compareTo( Object other ) + { + if( !( other instanceof TipoLembrete ) ) + { + return 0; + } + TipoLembrete otl = ( TipoLembrete ) other; + return getOrdem().compareTo( otl.getOrdem() ); + } +} diff --git a/trunk/siprp/medicina/MedicinaConstants.java b/trunk/siprp/medicina/MedicinaConstants.java index 81181e28..702d8523 100644 --- a/trunk/siprp/medicina/MedicinaConstants.java +++ b/trunk/siprp/medicina/MedicinaConstants.java @@ -23,4 +23,11 @@ public interface MedicinaConstants public static final Integer MOTIVO_OCASIONAL_INTEGER = new Integer( MOTIVO_OCASIONAL ); public static final int MOTIVO_PERIODICO_INICIAL = 5; public static final Integer MOTIVO_PERIODICO_INICIAL_INTEGER = new Integer( MOTIVO_PERIODICO_INICIAL ); + + public static final int ESTADO_POR_REALIZAR = 0; + public static final int ESTADO_PARCIALMENTE_REALIZADO = 1; + public static final int ESTADO_REALIZADO = 2; + public static final int ESTADO_DESMARCADO_TRABALHADOR = 3; + public static final int ESTADO_DESMARCADO_EMPRESA = 4; + public static final int ESTADO_FALTOU = 5; } diff --git a/trunk/siprp/medicina/MedicinaDataProvider.java b/trunk/siprp/medicina/MedicinaDataProvider.java index 0af414df..1498cf5f 100644 --- a/trunk/siprp/medicina/MedicinaDataProvider.java +++ b/trunk/siprp/medicina/MedicinaDataProvider.java @@ -29,12 +29,7 @@ import siprp.data.*; public class MedicinaDataProvider extends MetaProvider implements MedicinaConstants { - public static final int ESTADO_POR_REALIZAR = 0; - public static final int ESTADO_PARCIALMENTE_REALIZADO = 1; - public static final int ESTADO_REALIZADO = 2; - public static final int ESTADO_DESMARCADO_TRABALHADOR = 3; - public static final int ESTADO_DESMARCADO_EMPRESA = 4; - public static final int ESTADO_FALTOU = 5; + public static final String TIPOS_CONSULTAS[] = new String[]{ "", "Admiss\u00e3o", "Peri\u00f3dico", "Ocasional", "", "Peri\u00f3dico inicial" }; diff --git a/trunk/siprp/medicina/presencas/PresencasDataProvider.java b/trunk/siprp/medicina/presencas/PresencasDataProvider.java new file mode 100644 index 00000000..ac83da39 --- /dev/null +++ b/trunk/siprp/medicina/presencas/PresencasDataProvider.java @@ -0,0 +1,63 @@ +/* + * PresencasDataProvider.java + * + * Created on February 5, 2007, 5:51 PM + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.medicina.presencas; + +import com.evolute.utils.Singleton; +import com.evolute.utils.db.DBManager; +import com.evolute.utils.db.Executer; +import com.evolute.utils.sql.Assignment; +import com.evolute.utils.sql.Field; +import com.evolute.utils.sql.Update; +import siprp.medicina.MedicinaConstants; + +/** + * + * @author lflores + */ +public class PresencasDataProvider + implements MedicinaConstants +{ + private static final Object LOCK = new Object(); + private static PresencasDataProvider instance = null; + + private Executer EXECUTER; + + /** Creates a new instance of PresencasDataProvider */ + public PresencasDataProvider() + throws Exception + { + DBManager dbm = ( DBManager ) Singleton.getInstance( Singleton.DEFAULT_DBMANAGER ); + EXECUTER = dbm.getSharedExecuter( this ); + } + + public static PresencasDataProvider getProvider() + throws Exception + { + synchronized( LOCK ) + { + if( instance == null ) + { + instance = new PresencasDataProvider(); + } + } + return instance; + } + + public void marcarFaltou( Integer id ) + throws Exception + { + Update update = + new Update( "marcacoes_trabalhador", + new Assignment[]{ + }, + new Field( "id" ).isEqual( id ) ); + EXECUTER.executeQuery( update ); + } +} diff --git a/trunk/siprp/medicina/presencas/actions/FaltouAction.java b/trunk/siprp/medicina/presencas/actions/FaltouAction.java index bccd568a..39e02c3d 100644 --- a/trunk/siprp/medicina/presencas/actions/FaltouAction.java +++ b/trunk/siprp/medicina/presencas/actions/FaltouAction.java @@ -37,4 +37,5 @@ public class FaltouAction extends AbstractAction { } + }