<?php 



class DaoCurriculo extends conexao {

public function Atualizar(curriculo $curriculo) {

try {

if ($curriculo->getCur_id() != '') {

$sql = " UPDATE curriculo SET
cur_nome_candidato = ?,
cur_email_candidato = ?,
cur_telefone_candidato = ?,
cur_curriculo = ?
WHERE cur_id = ? ";

$stmt = self::conectar()->prepare($sql);
$stmt->bindValue(1, $curriculo->getCur_nome_candidato());
$stmt->bindValue(2, $curriculo->getCur_email_candidato());
$stmt->bindValue(3, $curriculo->getCur_telefone_candidato());
$stmt->bindValue(4, $curriculo->getCur_curriculo());
$stmt->bindValue(5, $curriculo->getCur_id());


} else {

$sql = " INSERT INTO curriculo (cur_nome_candidato,cur_email_candidato,cur_telefone_candidato,cur_curriculo)
VALUES (?,?,?,?)";


$stmt = self::conectar()->prepare($sql);
$stmt->bindValue(1, $curriculo->getCur_nome_candidato());
$stmt->bindValue(2, $curriculo->getCur_email_candidato());
$stmt->bindValue(3, $curriculo->getCur_telefone_candidato());
$stmt->bindValue(4, $curriculo->getCur_curriculo());


}
if ($stmt->execute()){
return true;
} else
return false;

} catch (Exception $e) {
print "Erro ao tentar atualizar: ".$e;
}

}

public function PesquisarCurriculo($codigo){
$sql = " SELECT * FROM curriculo WHERE cur_id = ? ";
$stmt = self::conectar()->prepare($sql);
$stmt->bindValue(1, $codigo);
$stmt->execute();
$result = $stmt->fetchAll(PDO::FETCH_ASSOC);
return $result;
}

public function ListarCurriculo(){
$sql = " SELECT * FROM curriculo ORDER BY cur_id ";
$stmt = self::conectar()->prepare($sql);
$stmt->execute();
$result = $stmt->fetchAll(PDO::FETCH_ASSOC);
return $result;
}



	
public function deletar($car_id){		
$sql = " DELETE FROM curriculo WHERE cur_id = ? ";
$stmt = self::conectar()->prepare($sql);
$stmt->bindValue(1, $car_id); 
$stmt->execute();
}


 
}
