예제 #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 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();
     }
 }
예제 #4
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();
     }
 }