示例#1
0
 public function addItem(PedidoItem $vPI)
 {
     if ($this->getId() != '') {
         $lPI = new ListaPedidoItens();
         $a[1] = array('campo' => ListaPedidoItens::ID, 'valor' => $vPI->getId());
         $a[2] = array('campo' => ListaPedidoItens::IDSESSAO, 'valor' => $this->getId());
         $lPI->condicoes($a);
         if ($lPI->getTotal() == 0) {
             $lPI->inserir($vPI, $this);
         } else {
             $lPI->alterar($vPI, $this);
         }
         $this->calcular();
         $this->getEndereco()->setValor(0);
     }
 }
 public function deletar(PedidoItem $p, Pedido $pe)
 {
     $where = "WHERE " . self::ID . " = '" . $p->getId() . "' AND " . self::IDSESSAO . " = '" . $pe->getId() . "'";
     $this->con->deletar(Sistema::$BDPrefixo . $this->tabela, $where);
 }