public function alterar(Pedido $p) { $where = "WHERE " . self::ID . " = '" . $p->getId() . "'"; $this->con->alterar(Sistema::$BDPrefixo . $this->tabela, self::QUANTIDADE, $p->quantidade, $where); $this->con->alterar(Sistema::$BDPrefixo . $this->tabela, self::OBSERVACOES, $p->observacoes, $where); $this->con->alterar(Sistema::$BDPrefixo . $this->tabela, self::TIPOPAGAMENTO, $p->getTipoPagamento(), $where); $this->con->alterar(Sistema::$BDPrefixo . $this->tabela, self::DATA, $p->getData()->mostrar("YmdHi"), $where); $this->con->alterar(Sistema::$BDPrefixo . $this->tabela, self::STATUS, $p->getStatus()->getStatus(), $where); $this->con->alterar(Sistema::$BDPrefixo . $this->tabela, self::VALOR, $p->getValor()->formatar(), $where); $this->con->alterar(Sistema::$BDPrefixo . $this->tabela, self::DESCONTO, $p->getDesconto()->num, $where); $this->con->alterar(Sistema::$BDPrefixo . $this->tabela, self::ESTOQUE, $p->estoque, $where); $this->con->alterar(Sistema::$BDPrefixo . $this->tabela, self::VENDEDOR, $p->getVendedor(), $where); $lPEE = new ListaPedidoEnderecoEntregas(); $lPEE->condicoes('', $p->getId(), ListaPedidoEnderecoEntregas::IDSESSAO); if ($lPEE->getTotal() > 0) { $lPEE->alterar($p->getEndereco(), $p); } else { $lPEE->inserir($p->getEndereco(), $p); } parent::alterar($p); }
public function alterar(PedidoEnderecoEntrega $end, Pedido $ligacao) { //parent::alterar($end); $where = "WHERE " . self::IDSESSAO . " = '" . $ligacao->getId() . "'"; $e = $end->getEstado(); if ($e->getId() <= 0) { $lE = new ListaEstados(); $lE->inserir($e); $end->setEstado($e); } $c = $end->getCidade(); if ($c->getId() <= 0) { $lC = new ListaCidades(); $lC->inserir($c); $end->setCidade($c); } else { $lC = new ListaCidades(); $lC->condicoes('', $c->getId(), ListaCidades::ID); if ($lC->getTotal() <= 0) { if ($c->getPais()->getId() <= 0) { $c->setPais($end->getPais()); } if ($c->getEstado()->getId() <= 0) { $c->setEstado($end->getEstado()); } $this->con->executar("INSERT INTO " . Sistema::$BDPrefixo . $lC->getTabela() . "(" . ListaCidades::ID . ", " . ListaCidades::PAIS . ", " . ListaCidades::ESTADO . ", " . ListaCidades::NOME . ", " . ListaCidades::DDD . ") VALUES('" . $c->getId() . "','" . $c->getPais()->getId() . "','" . $c->getEstado()->getId() . "','" . $c->nome . "','" . $c->ddd . "')"); $id = $this->con->getId(); $end->setCidade(new Cidade($id)); } } $this->con->alterar(Sistema::$BDPrefixo . $this->tabela, self::LOGRADOURO, $end->logradouro, $where); $this->con->alterar(Sistema::$BDPrefixo . $this->tabela, self::NUMERO, $end->numero, $where); $this->con->alterar(Sistema::$BDPrefixo . $this->tabela, self::COMPLEMENTO, $end->complemento, $where); $this->con->alterar(Sistema::$BDPrefixo . $this->tabela, self::BAIRRO, $end->bairro, $where); $this->con->alterar(Sistema::$BDPrefixo . $this->tabela, self::CIDADE, $end->getCidade()->getId(), $where); $this->con->alterar(Sistema::$BDPrefixo . $this->tabela, self::ESTADO, $end->getEstado()->getId(), $where); $this->con->alterar(Sistema::$BDPrefixo . $this->tabela, self::PAIS, $end->getPais()->getId(), $where); $this->con->alterar(Sistema::$BDPrefixo . $this->tabela, self::CEP, $end->getCep(), $where); $this->con->alterar(Sistema::$BDPrefixo . $this->tabela, self::TIPO, $end->tipo, $where); $this->con->alterar(Sistema::$BDPrefixo . $this->tabela, self::PRAZO, $end->prazo, $where); $this->con->alterar(Sistema::$BDPrefixo . $this->tabela, self::VALOR, $end->getValor()->formatar(), $where); }
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); }