Skip to content

Commit

Permalink
feat: add HistoricoClientes entidade
Browse files Browse the repository at this point in the history
  • Loading branch information
elfiservice committed Apr 13, 2018
1 parent f5b709f commit 194c679
Show file tree
Hide file tree
Showing 6 changed files with 182 additions and 4 deletions.
45 changes: 45 additions & 0 deletions classes/controller/CRUDAbstractCtrl.class.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?php

/**
* CRUDAbstractCtrl.class [ ABSTRACT ]
* Responsavel por Padronizar o CRUD do sistema para cada Controller
* @copyright (c) 2018
* @author Armando JR. ELFISERVICE
*/
abstract class CRUDAbstractCtrl {
//put your code here

/**
* Fazer INSERT no BD na tabela = logs
* @param Log $obj = passar uma Instancia deste tipo para inserir no BD
* @return boolean = TRUE se Sucesso ao inserir dados no BD e FALSE se houver algum problema na INSERÇÃO ou se o OBJETO não foi passado corretamente
*/
public function inserirBD($obj, $dao) {
$nomeDaClasse = get_class($obj);
if ($obj instanceof $nomeDaClasse) {

foreach ((array) $obj as $campo => $valor) {
$campo = str_replace("\0{$nomeDaClasse}\0", "", $campo);
$campoArr[$campo] = $campo;
}
// var_dump($campoArr);
//unset($campoArr['id']);
$arrObj = array_values((array) $obj);

//unset($arrObj[0]);

$campoArr = implode(', ', array_keys($campoArr));
$valores = " '" . implode("','", array_values($arrObj)) . "' ";
//var_dump($campoArr,$valores);
//$logDao = new LogDAO();

if ($dao->insert($campoArr, $valores)) {
return TRUE;
} else {
return FALSE;
}
} else {
return FALSE;
}
}
}
26 changes: 26 additions & 0 deletions classes/controller/HistoricoClientes.class.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php

/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/

/**
* Description of HistoricoClientes
*
* @author armandojunior
*/
class HistoricoClientes extends CRUDAbstractCtrl {

private $clienteDao;

public function HistoricoClientes() {
$this->clienteDao = new HistoricoClientesDAO();
}

public function inserirBD($obj) {
return parent::inserirBD($obj, $this->clienteDao);
}

}
32 changes: 32 additions & 0 deletions classes/dao/CRUDAbstract.class.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php

/**
* CRUDAbstract.class [ ABSTRACT ]
* Responsavel por Padronizar o CRUD do sistema para cada Entidade
* @copyright (c) 2018, Armando JR. ELFISERVICE
*/
abstract class CRUDAbstract {


public function delete($termos, $tabela = self::Tabela) {

}

public function insert($camposBd, $valores, $tabela = self::Tabela) {
$insert = new Insert();
$insert->ExecInsert($tabela, $camposBd, $valores);
return $insert->getResultado();
}

public function select($campos, $termos, $tabela = self::Tabela) {
$read = new Read();
$read->ExecRead($campos, $tabela, $termos);
return $read->getResultado();
}

public function update($camposDados, $termos, $tabela = self::Tabela) {
$update = new Update();
$update->ExecUpdate($tabela, $camposDados, $termos);
return $update->getResultado();
}
}
21 changes: 21 additions & 0 deletions classes/dao/HistoricoClientesDAO.class.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

/**
* HistoricoClientesDAO.class [ DAO ]
* Responsavel gerencia a PErsistencia para Tabela historico_clientes
* @copyright (c) 2018, Armando JR. ELFISERVICE
*/
class HistoricoClientesDAO extends CRUDAbstract {

const Tabela = 'historico_clientes';

public function insert($camposBd, $valores, $tabela = self::Tabela) {
return parent::insert($camposBd, $valores, $tabela);
}

public function select($campos, $termos, $tabela = self::Tabela) {
return parent::select($campos, $termos, $tabela);
}


}
56 changes: 56 additions & 0 deletions classes/model/HistoricoClientes.class.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<?php
echo 'aqui';

/**
* HistoricoClientes.class [ MODEL ]
* Modelar dados da Tablea historico_clientes
* @copyright (c) 2018, Armando JR. ELFISERVICE
*/
class HistoricoClientes {
private $id;
private $id_cliente;
private $alteracao;
private $data;

public function __construct($id, $id_cliente, $alteracao, $data) {
$this->id = $id;
$this->id_cliente = $id_cliente;
$this->alteracao = $alteracao;
$this->data = $data;
}

public function getId() {
return $this->id;
}

public function getId_cliente() {
return $this->id_cliente;
}

public function getAlteracao() {
return $this->alteracao;
}

public function getData() {
return $this->data;
}

public function setId($id) {
$this->id = $id;
}

public function setId_cliente($id_cliente) {
$this->id_cliente = $id_cliente;
}

public function setAlteracao($alteracao) {
$this->alteracao = $alteracao;
}

public function setData($data) {
$this->data = $data;
}



}
6 changes: 2 additions & 4 deletions nbproject/private/private.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="0"/>
<open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2">
<group>
<file>file:/Applications/XAMPP/htdocs/elfi/modulos/tecnico/orcamento/editar_orcamento.php</file>
<file>file:/Applications/XAMPP/htdocs/elfi/modulos/tecnico/orcamento/alterar/salvar_editar_orc.php</file>
<file>file:/Applications/XAMPP/htdocs/elfi/modulos/tecnico/orcamento/novo_orcamento.php</file>
<file>file:/Applications/XAMPP/htdocs/elfi/modulos/tecnico/orcamento/incluir/salvar_novo_orc.php</file>
<file>file:/Applications/XAMPP/htdocs/elfi/index.php</file>
<file>file:/Applications/XAMPP/htdocs/elfi/modulos/tecnico/index.php</file>
</group>
</open-files>
</project-private>

0 comments on commit 194c679

Please sign in to comment.