Exemple #1
0
  /**
   * Updates the image URI for a team member
   *
   * @param teamMember Team member to change image URI to
   */
  public void updateTeamMemberImageURI(TeamMember teamMember) {
    Debug.logDebug(
        "Updating team member " + teamMember.getId() + " imageURI: " + teamMember.getImageURI());
    SQLiteDatabase db = mDbHelper.getWritableDatabase();

    ContentValues args = new ContentValues();

    args.put(IMAGE_URI_COLUMN, teamMember.getImageURI());

    db.update(TEAM_MEMBER_TABLE_NAME, args, ID_COLUMN + "=" + "'" + teamMember.getId() + "'", null);

    db.close();
  }
Exemple #2
0
  /**
   * Saves a list of team members into the database
   *
   * @param teamMembers List of team members to save
   */
  public void saveTeamMembers(List<TeamMember> teamMembers) {
    Debug.logDebug("Saving team members in the database");
    SQLiteDatabase db = mDbHelper.getWritableDatabase();

    db.beginTransaction();

    db.execSQL(SQL_REMOVE_ALL);

    for (TeamMember teamMember : teamMembers) {
      ContentValues teamMemberValues = new ContentValues();
      teamMemberValues.put(ID_COLUMN, teamMember.getId());
      teamMemberValues.put(NAME_COLUMN, teamMember.getName());
      teamMemberValues.put(JOB_TITLE_COLUMN, teamMember.getJobTitle());
      teamMemberValues.put(BIOGRAPHY_COLUMN, teamMember.getBiography());
      teamMemberValues.put(IMAGE_URI_COLUMN, teamMember.getImageURI());

      db.insert(TEAM_MEMBER_TABLE_NAME, null, teamMemberValues);
    }

    db.setTransactionSuccessful();
    db.endTransaction();
    db.close();
  }