/*
 * DesmarcadoTrabalhadorAction.java
 *
 * Created on January 31, 2007, 6:21 PM
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package siprp.medicina.presencas.actions;

import com.evolute.utils.ui.DialogException;
import java.awt.event.ActionEvent;
import javax.swing.AbstractAction;
import siprp.medicina.presencas.Presenca;
import siprp.medicina.presencas.PresencasDataProvider;

/**
 *
 * @author fpalma
 */
public class DesmarcadoTrabalhadorAction extends AbstractAction
{
	protected Presenca presenca;
	
	/** Creates a new instance of DesmarcadoTrabalhadorAction */
	public DesmarcadoTrabalhadorAction( Presenca presenca )
	{
		super( "Desmarcou" );
		this.presenca = presenca;
	}

	public void actionPerformed(ActionEvent e)
	{
		try
		{
			PresencasDataProvider provider = PresencasDataProvider.getProvider();
			provider.marcarDesmarcadoTrabalhador( presenca.getID() );
			setEnabled( false );
		}
		catch( Exception ex )
		{
			DialogException.showExceptionMessage( ex, "Erro a marcar", true );
		}
	}
	
}
