function Delete($param)
 {
     // obtém o parâmetro $key
     $key = $param['key'];
     // inicia transação com o banco 'sq_livro'
     TTransaction::open('sq_livro');
     // instancia objeto Cidade
     $cidade = new Cidade($key);
     // deleta objeto do banco de dados
     $cidade->delete();
     // finaliza a transação
     TTransaction::close();
     // recarrega a datagrid
     $this->onReload();
     // exibe mensagem de sucesso
     new TMessage('info', "Registro excluído com sucesso");
 }
Ejemplo n.º 2
0
 /**
  * method Delete()
  * Delete a record
  */
 function Delete($param)
 {
     try {
         // get the parameter $key
         $key = $param['key'];
         // open a transaction with database 'permission'
         TTransaction::open('liger');
         // instantiates object SystemProgram
         $object = new Cidade($key);
         // deletes the object from the database
         $object->delete();
         // close the transaction
         TTransaction::close();
         // reload the listing
         $this->onReload($param);
         // shows the success message
         new TMessage('info', TAdiantiCoreTranslator::translate('Record deleted'));
     } catch (Exception $e) {
         // shows the exception error message
         new TMessage('error', '<b>Error</b> ' . $e->getMessage());
         // undo all pending operations
         TTransaction::rollback();
     }
 }