public static Variant getVariantById(int variantId)
        {
            Dictionary <string, object> result = querySingleSql(""
                                                                + "SELECT "
                                                                + "* "
                                                                + "FROM "
                                                                + "`" + tableName + "` "
                                                                + "WHERE "
                                                                + "`" + field_variantId + "` = " + variantId
                                                                );

            if (result == null)
            {
                return(null);
            }

            Discipline discipline = DisciplineProvider.getDisciplineById(Convert.ToInt32(result[field_disciplineId]));

            Variant variant = new Variant(
                Convert.ToInt32(result[field_variantId]),
                Convert.ToString(result[field_variantName]),
                Convert.ToInt32(result[field_ageFrom]),
                Convert.ToInt32(result[field_ageUntil]),
                discipline
                );

            return(variant);
        }
Ejemplo n.º 2
0
        public static List <Subscription> getAllSubscriptions()
        {
            List <Dictionary <string, object> > results = querySql(""
                                                                   + "SELECT "
                                                                   + "* "
                                                                   + "FROM "
                                                                   + "`" + tableName + "`"
                                                                   );

            List <Subscription> subscriptions = new List <Subscription>();

            foreach (var row in results)
            {
                Competition competition = CompetitionProvider.getCompetitionById(Convert.ToInt32(row[field_competitionId]));

                Discipline discipline = DisciplineProvider.getDisciplineById(Convert.ToInt32(row[field_disciplineId]));

                subscriptions.Add(getSubscriptionByPrimaryKey(
                                      Convert.ToInt32(row[field_sportsFestivalSubscriptionId]),
                                      competition,
                                      discipline
                                      ));
            }

            return(subscriptions);
        }
Ejemplo n.º 3
0
        public static List <Benchmark> getAllBenchmarks()
        {
            List <Dictionary <string, object> > results = querySql(""
                                                                   + "SELECT "
                                                                   + "`" + field_disciplineId + "`, "
                                                                   + "`" + field_ageFrom + "`, "
                                                                   + "`" + field_ageUntil + "`, "
                                                                   + "`" + field_gender + "`, "
                                                                   + "`" + field_rank + "` "
                                                                   + "FROM "
                                                                   + "`" + tableName + "`"
                                                                   );

            List <Benchmark> benchmarks = new List <Benchmark>();

            foreach (var row in results)
            {
                Discipline discipline = DisciplineProvider.getDisciplineById(Convert.ToInt32(row[field_disciplineId]));

                benchmarks.Add(getBenchmarkByPrimaryKey(
                                   discipline,
                                   Convert.ToInt32(row[field_ageFrom]),
                                   Convert.ToInt32(row[field_ageUntil]),
                                   Convert.ToChar(row[field_gender]),
                                   Convert.ToString(row[field_rank])
                                   ));
            }

            return(benchmarks);
        }
Ejemplo n.º 4
0
        public static List <Discipline> getDisciplinesByDisciplineSet(DisciplineSet disciplineSet)
        {
            List <Dictionary <string, object> > results = querySql(""
                                                                   + "SELECT "
                                                                   + "* "
                                                                   + "FROM "
                                                                   + "`" + tableName + "` "
                                                                   + "WHERE "
                                                                   + "`" + field_disciplineSetId + "` = " + disciplineSet.DisciplineSetId
                                                                   );

            List <Discipline> disciplines = new List <Discipline>();

            foreach (var row in results)
            {
                disciplines.Add(DisciplineProvider.getDisciplineById(Convert.ToInt32(row[field_disciplineId])));
            }

            return(disciplines);
        }