コード例 #1
0
  @Override
  public long inserir(ClienteTipo clienteTipo) throws RepositorioException {
    ContentValues values = new ContentValues();

    values = clienteTipo.carregarValues();

    try {
      return super.getDb().insert(clienteTipo.getNomeTabela(), "", values);

    } catch (SQLException sqe) {
      Log.e(ConstantesSistema.LOG_TAG, sqe.getMessage() + " " + sqe.getCause());
      sqe.printStackTrace();
      throw new RepositorioException(
          context.getResources().getString(R.string.db_error_insert_record));
    }
  }
コード例 #2
0
  @Override
  public void remover(ClienteTipo clienteTipo) throws RepositorioException {
    String _id = String.valueOf(clienteTipo.getId());

    String where = ClienteTipoColunas.ID + "=?";

    String[] whereArgs = new String[] {_id};

    try {
      super.getDb().delete(clienteTipo.getNomeTabela(), where, whereArgs);
    } catch (SQLException sqe) {
      Log.e(ConstantesSistema.LOG_TAG, sqe.getMessage() + " " + sqe.getCause());
      sqe.printStackTrace();
      throw new RepositorioException(context.getResources().getString(R.string.db_error));
    }
  }
コード例 #3
0
  @Override
  public void atualizar(SetorComercial setorComercial) throws RepositorioException {
    ContentValues values = setorComercial.carregarValues();

    String _id = String.valueOf(setorComercial.getId());

    String where = SetorComercialColunas.ID + "=?";
    String[] whereArgs = new String[] {_id};

    try {
      super.getDb().update(setorComercial.getNomeTabela(), values, where, whereArgs);
    } catch (SQLException sqe) {
      Log.e(ConstantesSistema.LOG_TAG, sqe.getMessage() + " " + sqe.getCause());
      sqe.printStackTrace();
      throw new RepositorioException(context.getResources().getString(R.string.db_error));
    }
  }