Package Controle

Source Code of Controle.ControleMetaItemPainelDeBordo

package Controle;

import DAO.MetaItemPainelDeBordoDao;
import Entidade.ItemPainelDeBordo;
import Entidade.MetaItemPainelDeBordo;
import javax.faces.application.FacesMessage;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;
import javax.faces.bean.ViewScoped;
import javax.faces.context.FacesContext;
import org.primefaces.event.SelectEvent;

@ManagedBean
@ViewScoped
public class ControleMetaItemPainelDeBordo {
    private MetaItemPainelDeBordo mipdb = new MetaItemPainelDeBordo();
    private ItemPainelDeBordo ipbSelecionado = new ItemPainelDeBordo();
    private boolean renderizar = false;
    public MetaItemPainelDeBordo getMipdb() {
        return mipdb;
    }

    public void setMipdb(MetaItemPainelDeBordo mipdb) {
        this.mipdb = mipdb;
    }

    public boolean isRenderizar() {
        return renderizar;
    }

    public void setRenderizar(boolean renderizar) {
        this.renderizar = renderizar;
    }

    public ItemPainelDeBordo getIpbSelecionado() {
        return ipbSelecionado;
    }

    public void setIpbSelecionado(ItemPainelDeBordo ipbSelecionado) {
        this.ipbSelecionado = ipbSelecionado;
    }
   
    public void insereMeta() {
        MetaItemPainelDeBordo pesquisa = new MetaItemPainelDeBordo();
        this.mipdb.setIpbCodigo(ipbSelecionado.getIpbCodigo());
        MetaItemPainelDeBordoDao mipdbDao = new MetaItemPainelDeBordoDao();
        pesquisa = mipdbDao.buscaMeta(this.mipdb);
        if (pesquisa == null) {
            mipdbDao.salvar(this.mipdb);
        }
        else {
           pesquisa.setMipbNumMeta(this.mipdb.getMipbNumMeta());
            mipdbDao.salvar(pesquisa);
        }
        FacesMessage msg = new FacesMessage("Meta cadastrada para o mês de " + this.mipdb.getMipbDscMes() + "" , "");
        FacesContext.getCurrentInstance().addMessage("msgUpdate", msg);
    }
   
    public void onRowSelect(SelectEvent event) {
       renderizar = false;
    }
}
TOP

Related Classes of Controle.ControleMetaItemPainelDeBordo

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.