List of usage examples for com.mongodb BasicDBObject BasicDBObject
public BasicDBObject()
From source file:br.com.ifspsaocarlos.gastock.models.MFrentista.java
@Override public void modificar(Frentista frentista) throws Exception { BasicDBObject set = new BasicDBObject(); int codigo = frentista.getFrentista(); set.put("nome", frentista.getNome()); set.put("senha", frentista.getSenha()); set.put("tipo", frentista.getTipo()); set.put("salario", frentista.getSalario()); BasicDBObject update = new BasicDBObject("$set", set); this.banco.alterarItem(codigo, update); }
From source file:br.com.ifspsaocarlos.gastock.models.MFrentista.java
@Override public void excluir(int frentistaId) throws Exception { BasicDBObject delete = new BasicDBObject(); delete.put("cod", frentistaId); this.banco.excluirItem(delete); }
From source file:br.com.ifspsaocarlos.gastock.models.MRelatorio.java
public void adicionarVenda(int codigo, String dataAtual, String combustivel, int bomba, double quantidade, double precoTotal) throws Exception { try {//from w w w .j av a2s . c om this.listar(); } catch (Exception ex) { } int cod = c.get(c.size() - 1).getRelatorio() + 1; //System.out.println(cod); //relatorio.setRelatorio(cod); //c.add(relatorio); BasicDBObject insert = new BasicDBObject(); insert.put("cod", codigo); // tem que arrumar , pegar o codigo do bd e somar +1 insert.put("dataAtual", dataAtual); insert.put("combustivel", combustivel); insert.put("bomba", bomba); insert.put("quantidade", quantidade); insert.put("precoTotal", precoTotal); this.banco.cadastraItem(insert); /// return relatorio.getRelatorio(); }
From source file:br.com.ifspsaocarlos.gastock.models.MRelatorio.java
@Override public int adicionar(Relatorio relatorio) { try {/*from w w w. j ava 2s . c om*/ this.listar(); } catch (Exception ex) { } int cod = c.get(c.size() - 1).getRelatorio() + 1; relatorio.setRelatorio(cod); c.add(relatorio); BasicDBObject insert = new BasicDBObject(); insert.put("cod", relatorio.getRelatorio()); insert.put("dataAtual", relatorio.getDataAtual()); insert.put("combustivel", relatorio.getCombustivel()); insert.put("bomba", relatorio.getBomba()); insert.put("quantidade", relatorio.getQuantidade()); insert.put("precoTotal", relatorio.getPrecoTotal()); this.banco.cadastraItem(insert); return relatorio.getRelatorio(); }
From source file:br.com.ifspsaocarlos.gastock.models.MRelatorio.java
@Override public void modificar(Relatorio relatorio) throws Exception { BasicDBObject set = new BasicDBObject(); int codigo = relatorio.getRelatorio(); set.put("dataAtual", relatorio.getDataAtual()); set.put("combustivel", relatorio.getCombustivel()); set.put("quantidade", relatorio.getQuantidade()); set.put("bomba", relatorio.getBomba()); set.put("precoTotal", relatorio.getPrecoTotal()); BasicDBObject update = new BasicDBObject("$set", set); this.banco.alterarItem(codigo, update); }
From source file:br.com.ifspsaocarlos.gastock.models.MRelatorio.java
@Override public void excluir(int relatorioId) throws Exception { BasicDBObject delete = new BasicDBObject(); delete.put("cod", relatorioId); this.banco.excluirItem(delete); }
From source file:br.com.ifspsaocarlos.gastock.models.MTanque.java
@Override public int adicionar(Tanque tanque) { try {// ww w . ja v a2 s .com this.listar(); } catch (Exception ex) { } int cod = c.get(c.size() - 1).getTanque() + 1; tanque.setTanque(cod); c.add(tanque); BasicDBObject insert = new BasicDBObject(); insert.put("cod", tanque.getTanque()); insert.put("combustivel", tanque.getCombustivel()); insert.put("quantidade", tanque.getQuantidade()); insert.put("preco", tanque.getPreco()); this.banco.cadastraItem(insert); return tanque.getTanque(); }
From source file:br.com.ifspsaocarlos.gastock.models.MTanque.java
public void modificarQuantidade(int cod, double newQtd) throws Exception { BasicDBObject set = new BasicDBObject(); int codigo = cod; set.put("quantidade", newQtd); BasicDBObject update = new BasicDBObject("$set", set); this.banco.alterarItem(codigo, update); }
From source file:br.com.ifspsaocarlos.gastock.models.MTanque.java
@Override public void modificar(Tanque tanque) throws Exception { BasicDBObject set = new BasicDBObject(); int codigo = tanque.getTanque(); set.put("combustivel", tanque.getCombustivel()); set.put("quantidade", tanque.getQuantidade()); set.put("preco", tanque.getPreco()); BasicDBObject update = new BasicDBObject("$set", set); this.banco.alterarItem(codigo, update); }
From source file:br.com.ifspsaocarlos.gastock.models.MTanque.java
@Override public void excluir(int tanqueId) throws Exception { BasicDBObject delete = new BasicDBObject(); delete.put("cod", tanqueId); this.banco.excluirItem(delete); }