예제 #1
0
 public function verificaTelefone()
 {
     $this->idTelefone = ultimoId::ultimoId('idTelefone', 'telefone');
     $sqlVerificaTelefone = "SELECT * FROM telefone WHERE telefone = '" . $this->telefone . "' AND codUsuario = " . $this->codUsuario;
     try {
         $resultVerifica = mysql_query($sqlVerificaTelefone) or die(RETURN_SQL . mysql_error());
         if (mysql_num_rows($resultVerifica) > 0) {
             //Verifica se a quantidade é maior que 0
             $this->editTelefone();
             //Vai para alteração
         } else {
             $this->novoTelefone();
             //Vai para inclusão
         }
     } catch (Exception $ex) {
         echo EXCEPTION_VERIF . $ex->getMessage();
     }
 }
예제 #2
0
 public function novaParagem()
 {
     $this->idParagem = ultimoId::ultimoId('idParagem', 'paragem');
     $sqlNovaParagem = "INSERT INTO paragem (idParagem, paragem, anoRuv, mesRuv, mes, dia, diaSemana, hora, duracao, nivel, dataAlteracao, codUsuario) VALUES (" . $this->idParagem . ", '" . $this->paragem . "', " . $this->anoRuv . ", " . $this->mesRuv . ", " . $this->mes . ", " . $this->dia . ", " . $this->diaSemana . ", " . $this->hora . ", " . $this->nivel . ", " . $this->dataAlteracao . ", " . $this->codUsuario . ")";
     //        $sqlNovaParagem = "INSERE_PARAGEM(".$this->idParagem.", ".$this->paragem.", ".$this->tipoTelefone.", ".$this->codUsuario.")";
     try {
         $resultNovo = mysql_query($sqlNovaParagem) or die(RETURN_SQL . mysql_error());
         if (!$resultNovo) {
             echo "Não foi inserido. " . VER_ANALISTA;
         }
         mysql_close($resultNovo);
     } catch (Exception $ex) {
         echo EXCEPTION_INC . $ex->getMessage();
     }
 }
예제 #3
0
 public function novoUsuario()
 {
     $this->idUsuario = ultimoId::ultimoIdBanco('idUsuario', 'tblusuario');
     $sqlNovoUsuario = "INSERT INTO tblusuario(idUsuario, nomeUsuario, email, senha, dataCadastro, dataAlteracao, codTipoUsuario) VALUES (" . $this->idUsuario . ", '" . $this->nomeUsuario . "', '" . $this->email . "', '" . $this->senha . "', '" . $this->dataCadastro . "', '" . $this->dataAlteracao . "', " . $this->codTipoUsuario . ")";
     //        echo "SQL Usuário: ".$sqlNovoUsuario."<br>";
     try {
         $resultadoNovoUsuario = mysql_query($sqlNovoUsuario) or die("Novo Usuário. " . RETURN_SQL . mysql_error());
         if ($resultadoNovoUsuario) {
             $perfil = new perfil();
             $perfil->setNome($this->nomeUsuario);
             $perfil->setCodUsuario($this->idUsuario);
             $perfil->setDataAlteracao($this->dataAlteracao);
             $perfil->setCodSetenio(0);
             $perfil->setDataNascimento("0000-00-00");
             $perfil->setDescricao("");
             $perfil->setEstadoCivil("");
             $perfil->setMotivacao("");
             $perfil->setProfissao("");
             $perfil->novoPerfil();
         }
         //            mysql_close($resultadoNovoUsuario);
     } catch (Exception $ex) {
         echo "Erro na execução do novo usuário. Descrição: " . $ex->getMessage();
     }
 }
예제 #4
0
 public function novoPerfil()
 {
     $this->idperfil = ultimoId::ultimoIdBanco('idPerfil', 'perfil');
     if ($this->dataNascimento === "0000-00-00") {
         $this->setCodSetenio(1);
     }
     $sqlNovoPerfil = "INSERT INTO perfil(idPerfil, nome, descricao, dataAlteracao, dataNascimento, profissao, estadoCivil, motivacao, codUsuario, codSetenio) VALUES (" . $this->idperfil . ", '" . $this->nome . "', '" . $this->descricao . "', '" . $this->dataAlteracao . "', '" . $this->dataNascimento . "', '" . $this->profissao . "', '" . $this->estadoCivil . "', '" . $this->motivacao . "', " . $this->codUsuario . ", " . $this->codSetenio . ")";
     //        echo "";
     try {
         $resultadoNovoPerfil = mysql_query($sqlNovoPerfil) or die("Novo Perfil. " . RETURN_SQL . mysql_error());
         if ($resultadoNovoPerfil) {
             echo "Sucesso!";
         }
     } catch (Exception $ex) {
         echo "Erro na execução do novo perfil do usuário. Descrição: " . $ex->getMessage();
     }
 }
예제 #5
0
 public function novoBalancete()
 {
     //$this->ultimoId();
     $this->idBalancete = ultimoId::ultimoId('idBalancete', 'balancete');
     $sqlNovoBalancete = "INSERT INTO balancete (idBalancete, anoMes, mes, data, descricao, entrada, saida, saldo, codUsuario) VALUES (" . $this->idBalancete . ", '" . $this->anoMes . "', '" . $this->mes . "', '" . $this->data . "', '" . $this->descricao . "', " . $this->entrada . ", " . $this->saida . ", " . $this->saldo . ", " . $this->codUsuario . ")";
     //        $sqlNovoBalancete = "INSERE_BALANCETE(".$this->idBalancete.", ".$this->anoMes.", ".$this->mes.", ".$this->data.", ".$this->descricao.", ".$this->entrada.", ".$this->saida.", ".$this->saldo.", ".$this->codUsuario.")";
     try {
         $resultNovoBalancete = mysql_query($sqlNovoBalancete) or die(RETURN_SQL . mysql_error());
         if (!$resultNovoBalancete) {
             echo "Não foi inserido. " . VER_ANALISTA;
         }
         mysql_close($resultNovoBalancete);
     } catch (Exception $ex) {
         echo EXCEPTION_INC . $ex->getMessage();
     }
 }
예제 #6
0
 public function cadastraUsuario()
 {
     $enviado = false;
     $conecta = new conectaBanco();
     $conecta->conecta();
     $this->idUsuario = ultimoId::ultimoId("idUsuario", "tblusuario");
     //$this->ultimoRegistro();
     $this->dataUltimaAlteracao = $this->dataCadastro;
     try {
         $sql = "INSERT INTO tblusuario (idUsuario, nomeUsuario, email, senha, dataCadastro, dataAlteracao, codTipoUsuario) " . "VALUES (" . $this->idUsuario . ", " . "'" . $this->usuario . "', " . "'" . $this->email . "', " . "'" . $this->senha . "', " . "'" . $this->dataCadastro . "', " . "'" . $this->dataCadastro . "', " . $this->codTipoUsuario . ")";
         echo $sql;
         $resultado = mysql_query($sql) or die("<br>Erro: " . mysql_error());
         if ($resultado) {
             $enviado = true;
         } else {
             $enviado = false;
         }
     } catch (Exception $ex) {
         echo "Problemas ao inserir os dados. Erro: " . $ex->getMessage();
     }
 }