Package sn.unitech.stock.bean

Source Code of sn.unitech.stock.bean.SysRangmntBean

package sn.unitech.stock.bean;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;
import javax.faces.model.DataModel;
import javax.faces.model.ListDataModel;

import sn.unitech.common.dao.ReadProperties;
import sn.unitech.stock.entity.SysGroupProd;
import sn.unitech.stock.entity.SysRangmnt;
import sn.unitech.stock.metier.SysRangmntM;
import sn.unitech.stock.metier.iface.ISysRangmntM;

@ManagedBean
@ViewScoped
public class SysRangmntBean implements Serializable{

    ISysRangmntM  sysRangmntM  =new SysRangmntM<SysRangmnt>();
  private ReadProperties readProperties=ReadProperties.getReadProperties();
  private SysRangmnt sysRangmnt=new SysRangmnt();
  private AllRefs allRefs=new AllRefs() ;
  private CMessages cmessages =new CMessages();
  private CItems citems=new CItems();
  private Cproperties cproperties = citems;

  public SysRangmntBean(){
   
  }

  ParamsUser getParamsUser(){ //alias
    return   ((ParamsUser)ToolsBean.getToolsBean().getAttribute(ToolsBean.idParamUser));
  }

  public void saveRangmnt(){
    this.sysRangmnt.setSysAdherent(getParamsUser().adherent);
    if(this.sysRangmntM.saveRangmnt(sysRangmnt)){
      this.setSysRangmnt(new SysRangmnt());
      this.cmessages.setSaveMessage(ToolsBean.getToolsBean().getBundleMessage("msgSucces"));
    }else this.cmessages.setSaveMessage(ToolsBean.getToolsBean().getBundleMessage("msgEchec"));
  }
 
  public class AllRefs implements Serializable{

  }
 
  public class CMessages implements Serializable{
      public String saveMessage;

  public String getSaveMessage() {
    return saveMessage;
  }

  public void setSaveMessage(String saveMessage) {
    this.saveMessage = saveMessage;
  }
  }

  public class Cproperties implements Serializable{

  }

  public class CItems extends Cproperties implements  Serializable{
   
        DataModel<SysRangmnt>   dataListRangement=new ListDataModel<SysRangmnt>(new ArrayList<SysRangmnt>());

    public DataModel<SysRangmnt> getDataListRangement() {
      Map<Integer,String> param=new HashMap<Integer,String>();
      param.put(0,getParamsUser().adherent.getIdAdherent());
      this.dataListRangement.setWrappedData((List<SysRangmnt>) sysRangmntM.listRangmnt(readProperties.read("Rangement.jpqlAllRangmnt"), param));
      return dataListRangement;
    }

    public void setDataListRangement(DataModel<SysRangmnt> dataListRangement) {
      this.dataListRangement = dataListRangement;
    }


  }

  public SysRangmnt getSysRangmnt() {
    return sysRangmnt;
  }

  public void setSysRangmnt(SysRangmnt sysRangmnt) {
    this.sysRangmnt = sysRangmnt;
  }

  public AllRefs getAllRefs() {
    return allRefs;
  }

  public void setAllRefs(AllRefs allRefs) {
    this.allRefs = allRefs;
  }

  public CMessages getCmessages() {
    return cmessages;
  }

  public void setCmessages(CMessages cmessages) {
    this.cmessages = cmessages;
  }

  public CItems getCitems() {
    return citems;
  }

  public void setCitems(CItems citems) {
    this.citems = citems;
  }

  public Cproperties getCproperties() {
    return cproperties;
  }

  public void setCproperties(Cproperties cproperties) {
    this.cproperties = cproperties;
  }

}
TOP

Related Classes of sn.unitech.stock.bean.SysRangmntBean

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.