Exemplo n.º 1
0
  public GameInfoDTO getGameInfoDTO(Context context) {
    GameInfoDTO gameInfo = new GameInfoDTO();
    DatabaseHelper dbHelper = new DatabaseHelper(context);
    dbHelper.open();
    Cursor cursor = null;
    cursor = dbHelper.fetchGameInfo();
    cursor.moveToFirst();

    while (cursor.isAfterLast() == false) {
      gameInfo.setPlayerInfoStatus((cursor.getInt(cursor.getColumnIndex("playerInfoStatus"))));
      gameInfo.setTime((cursor.getString(cursor.getColumnIndex("time"))));
      gameInfo.setVenue((cursor.getString(cursor.getColumnIndex("venue"))));

      gameInfo.setTeam1Id((cursor.getInt(cursor.getColumnIndex("team1Id"))));
      gameInfo.setTeam1Name((cursor.getString(cursor.getColumnIndex("team1Name"))));
      gameInfo.setTeam1Flag((cursor.getString(cursor.getColumnIndex("team1Flag"))));
      gameInfo.setTeam1Group((cursor.getString(cursor.getColumnIndex("team1Group"))));

      gameInfo.setTeam2Id((cursor.getInt(cursor.getColumnIndex("team2Id"))));
      gameInfo.setTeam2Name((cursor.getString(cursor.getColumnIndex("team2Name"))));
      gameInfo.setTeam2Group((cursor.getString(cursor.getColumnIndex("team2Group"))));
      gameInfo.setTeam2Flag((cursor.getString(cursor.getColumnIndex("team2Flag"))));

      cursor.moveToNext();
    }
    dbHelper.close();
    return gameInfo;
  }
Exemplo n.º 2
0
 public GameDTO getGame(Context context) {
   DatabaseHelper dbHelper = new DatabaseHelper(context);
   dbHelper.open();
   Cursor cursor = null;
   cursor = dbHelper.fetchGameDTO();
   cursor.moveToFirst();
   GameDTO currentGame = new GameDTO();
   while (cursor.isAfterLast() == false) {
     currentGame.setTeam1Id(cursor.getInt(cursor.getColumnIndex("team_1_id")));
     currentGame.setTeam2Id(cursor.getInt(cursor.getColumnIndex("team_2_id")));
     cursor.moveToNext();
   }
   dbHelper.close();
   return currentGame;
 }
Exemplo n.º 3
0
 public void updateGameFinal(Context context) {
   DatabaseHelper dbHelper = new DatabaseHelper(context);
   dbHelper.open();
   dbHelper.updateTableGame();
   dbHelper.close();
 }
Exemplo n.º 4
0
 public void deleteTableGame(Context context) {
   DatabaseHelper dbHelper = new DatabaseHelper(context);
   dbHelper.open();
   dbHelper.deleteTableGame();
   dbHelper.close();
 }
Exemplo n.º 5
0
 public boolean isTablePlayerFill(Context context) {
   DatabaseHelper db = new DatabaseHelper(context);
   Boolean isTableFill = db.isTablePlayerFill();
   return isTableFill;
 }
Exemplo n.º 6
0
 public void insertGameData(Context context, GameDTO gameDTO) {
   DatabaseHelper dbHelper = new DatabaseHelper(context);
   dbHelper.open();
   dbHelper.addGameInfo(gameDTO);
   dbHelper.close();
 }