public static void deleteCompetition(Competition competition) { executeSql("" + "DELETE FROM " + "`" + tableName + "` " + "WHERE " + "`" + field_competitionId + " = " + competition.CompetitionId + " " + "LIMIT 1" ); }
public static void deleteSportsFestival(SportsFestival sportsFestival, Competition competition) { executeSql("" + "DELETE FROM " + "`" + tableName + "` " + "WHERE " + "`" + field_sportsFestivalId + " = " + sportsFestival.SportsFestivalId + " " + "AND `" + field_competitionId + " = " + competition.CompetitionId + " " + "LIMIT 1" ); }
public static void deleteCompetitionDisciplineSetRelation(Competition competition, DisciplineSet disciplineSet) { executeSql("" + "DELETE FROM " + "`" + tableName + "` " + "WHERE " + "`" + field_competitionId + " = " + competition.CompetitionId + " " + "AND `" + field_disciplineSetId + " = " + disciplineSet.DisciplineSetId + " " + "LIMIT 1" ); }
public Subscription( int sportsFestivalSubscriptionId, Competition competition, Discipline discipline, double result ) { this.sportsFestivalSubscriptionId = sportsFestivalSubscriptionId; this.competition = competition; this.discipline = discipline; this.result = result; }
public static void createSportsFestivalCompetitionRelation(SportsFestival sportsFestival, Competition competition) { executeSql("" + "INSERT INTO `" + tableName + "` " + "(" + "`" + field_sportsFestivalId + "`," + "`" + field_competitionId + "`" + ") VALUES (" + sportsFestival.SportsFestivalId + "," + competition.CompetitionId + ")" ); }
public static void createCompetitionDisciplineSetRelation(Competition competition, DisciplineSet disciplineSet) { executeSql("" + "INSERT INTO " + "`" + tableName + "` " + "(" + "`" + field_competitionId + "`," + "`" + field_disciplineSetId + "`" + ") VALUES (" + competition.CompetitionId + "," + disciplineSet.DisciplineSetId + ")" ); }
public static bool relationExists(SportsFestival sportsFestival, Competition competition) { Dictionary<string, object> result = querySingleSql("" + "SELECT " + "* " + "FROM " + "`" + tableName + "` " + "WHERE " + "`" + field_sportsFestivalId + "` = " + sportsFestival.SportsFestivalId + " " + "AND `" + field_competitionId + "` = " + competition.CompetitionId ); if (result.Count == 1) { return true; } return false; }
public static List<DisciplineSet> getDisciplineSetsByCompetition(Competition competition) { List<Dictionary<string, object>> results = querySql("" + "SELECT " + "* " + "FROM " + "`" + tableName + "` " + "WHERE " + "`" + field_competitionId + "` = " + competition.CompetitionId ); List<DisciplineSet> disciplineSets = new List<DisciplineSet>(); foreach (var row in results) { disciplineSets.Add(DisciplineSetProvider.getDisciplineSetById(Convert.ToInt32(row[field_disciplineSetId]))); } return disciplineSets; }
public static void createSubscription( int sportsFestivalSubscriptionId, Competition competition, Discipline discipline, double result ) { executeSql("" + "INSERT INTO " + "`" + tableName + "` " + "(" + "`" + field_sportsFestivalSubscriptionId + "`, " + "`" + field_competitionId + "`, " + "`" + field_disciplineId + "`, " + "`" + field_result + "`" + ") VALUES (" + sportsFestivalSubscriptionId + ", " + competition.CompetitionId + ", " + discipline.DisciplineId + ", " + result + ")" ); }
public static Subscription getSubscriptionByPrimaryKey( int sportsFestivalSubscriptionId, Competition competition, Discipline discipline ) { Dictionary<string, object> result = querySingleSql("" + "SELECT " + "* " + "FROM " + "`" + tableName + "` " + "WHERE " + "`" + field_sportsFestivalSubscriptionId + "` = " + sportsFestivalSubscriptionId + " " + "AND `" + field_competitionId + "` = " + competition.CompetitionId + " " + "AND `" + field_disciplineId + "` = " + discipline.DisciplineId ); if (result == null) { return null; } Subscription subscription = new Subscription( Convert.ToInt32(result[field_sportsFestivalSubscriptionId]), competition, discipline, Convert.ToDouble(result[field_result]) ); return subscription; }
public static Competition getCompetitionById(int competitionId) { Dictionary<string, object> result = querySingleSql("" + "SELECT " + "* " + "FROM " + "`" + tableName + "` " + "WHERE " + "`" + field_competitionId + "` = " + competitionId ); if (result == null) { return null; } Competition competition = new Competition( Convert.ToInt32(result[field_competitionId]), Convert.ToString(result[field_competitionName]) ); foreach (DisciplineSet disciplineSet in DisciplineSetProvider.getDisciplineSetsByCompetition(competition)) { competition.addDisciplineSet(disciplineSet); } return competition; }
public static void updateCompetition(Competition competition) { executeSql("" + "UPDATE " + "`" + tableName + "` " + "SET " + "`" + field_competitionName + "` = " + competition.CompetitionName + " " + "WHERE " + "`" + field_competitionId + " = " + competition.CompetitionId ); foreach (DisciplineSet disciplineSet in competition.getDisciplineSets()) { if (CompetitionDisciplineSetProvider.relationExists(competition, disciplineSet) == false) { CompetitionDisciplineSetProvider.createCompetitionDisciplineSetRelation(competition, disciplineSet); } } }
public static List<DisciplineSet> getDisciplineSetsByCompetition(Competition competition) { return CompetitionDisciplineSetProvider.getDisciplineSetsByCompetition(competition); }
public static bool relationExists(Competition competition, DisciplineSet disciplineSet) { Dictionary<string, object> result = querySingleSql("" + "SELECT " + "* " + "FROM " + "`" + tableName + "` " + "WHERE " + "`" + field_competitionId + "` = " + competition.CompetitionId + " " + "AND `" + field_disciplineSetId + "` = " + disciplineSet.DisciplineSetId ); if (result.Count == 1) { return true; } return false; }
public void removeCompetition(Competition competition) { this.competitions.Remove(competition); }
public void addCompetition(Competition competition) { this.competitions.Add(competition); }