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; }
/** * Filtrar Cliente por datos * * @author Jonathan Sandoval <*****@*****.**> * @param Cliente $Cliente Objeto del tipo Cliente con los datos que deben de filtrar * @return Array(Cliente) Regresa un Arreglo con el conjunto de Clientes filtrados */ static function filtrarClientes($Cliente = NULL) { $nombreTabla = constant('TABLA_CLIENTE'); $rfc = $Cliente->getRFC(); $nombre = $Cliente->getNombre(); $sexo = $Cliente->getSexo(); $regimen = $Cliente->getRegimen(); $calle = $Cliente->getCalle(); $edificio = $Cliente->getNoEdificio(); $Cliente->getCiudad() !== NULL ? $tipo = $Cliente->getCiudad()->getAbreviatura() : ($tipo = ""); $Clientes = array(); $consult_cad = "SELECT * \n FROM {$nombreTabla}\n WHERE ID LIKE \"%{$id}%\" AND\n RFC LIKE \"%{$rfc}%\" AND\n Nombre LIKE \"%{$nombre}%\" AND\n Sexo LIKE \"%{$sexo}%\" AND\n Regimen LIKE \"%{$regimen}%\" AND\n Calle LIKE \"%{$calle}%\" AND\n Ciudad LIKE \"%{$ciudad}%\" AND\n NoEdificio LIKE \"%{$edificio}%\""; $res = ControladorBaseDatos::query($consult_cad); while ($row = $res->fetch_assoc()) { $Clientes[] = self::array_Cliente($row); } return $Clientes; }