public function cadCliente(Cliente $objCliente)
 {
     $conexao = $this->abreConexao();
     $sql = "INSERT INTO " . TBL_CLIENTES . " SET\n                nome = '" . $objCliente->getNome() . "',\n                email = '" . $objCliente->getEmail() . "',\n                senha = '" . $objCliente->getSenha() . "',\n                telefone = '" . $objCliente->getTelefone() . "',\n                dataNascimento = '" . $objCliente->getDataNascimento() . "',\n                cpf = '" . $objCliente->getCpf() . "',\n                sexo = '" . $objCliente->getSexo() . "',\n                status = 1\n                dataCadastro = NOW()\n               ";
     $conexao->query($sql) or die($conexao->error);
     $idCliente = $conexao->insert_id;
     return $idCliente;
 }
Exemple #2
0
 /**
  * Realiza atualização dos dados do cliente
  * @param Cliente $cliente
  */
 public function atualizar(Cliente $cliente)
 {
     $query = "UPDATE clientes SET " . "nome = :nome, " . "email = :email, " . "ddd_telefone =:ddd_telefone, " . "telefone = :telefone, " . "ddd_celular = : ddd_celular, " . "celular = :celular " . "WHERE id_cliente = :id_cliente";
     $stmt = $this->conexao->prepare($query);
     $stmt->bindValue(":nome", $cliente->getNome(), PDO::PARAM_STR);
     $stmt->bindValue(":email", $cliente->getEmail(), PDO::PARAM_STR);
     $stmt->bindValue(":ddd_telefone", $cliente->getDddTelefone(), PDO::PARAM_STR);
     $stmt->bindValue(":telefone", $cliente->getTelefone(), PDO::PARAM_STR);
     $stmt->bindValue(":ddd_celular", $cliente->getDddCelular(), PDO::PARAM_STR);
     $stmt->bindValue(":celular", $cliente->getCelular(), PDO::PARAM_STR);
     $stmt->execute();
 }
 public function persist(Cliente $cliente)
 {
     try {
         $stmt = $this->pdo->prepare("INSERT INTO Cliente(nome,endereco, telefone, tipo, grau_importancia, endereco_cobranca)\n                                        VALUES (:nome, :endereco, :telefone, :tipo, :grau_importancia, :endereco_cobraca)");
         $stmt->bindParam(':nome', $cliente->getNome());
         $stmt->bindParam(':endereco', $cliente->getEndereco());
         $stmt->bindParam(':telefone', $cliente->getTelefone());
         $stmt->bindParam(':tipo', $cliente->getTipo());
         $stmt->bindParam(':grau_importancia', $cliente->getGrauImportancia());
         $stmt->bindParam(':endereco_cobraca', $cliente->getEnderecoCobranca());
         $stmt->execute();
     } catch (\PDOException $e) {
         return $e->getMessage();
     }
 }