コード例 #1
0
        public void OpenResultsGUI(SportsFestival pSportsFestival)
        {
            ResultsGUIForm = new ResultsGUI(this, pSportsFestival);

            ResultsGUIForm.updateSubscriptions();

            ResultsGUIForm.ShowDialog();
        }
コード例 #2
0
 public static void deleteSportsFestival(SportsFestival sportsFestival)
 {
     executeSql(""
         + "DELETE FROM "
             + "`" + tableName + "` "
         + "WHERE "
             + "`" + field_sportsFestivalId + " = " + sportsFestival.SportsFestivalId + " "
         + "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"
     );
 }
コード例 #4
0
 public SportsFestivalSubscription(
     int sportsFestivalSubscriptionId,
     SportsFestival sportsFestival,
     Student student,
     string classShortcut
     )
 {
     this.sportsFestivalSubscriptionId = sportsFestivalSubscriptionId;
     this.sportsFestival = sportsFestival;
     this.student        = student;
     this.classShortcut  = classShortcut;
 }
 public SportsFestivalSubscription(
     int sportsFestivalSubscriptionId,
     SportsFestival sportsFestival,
     Student student,
     string classShortcut
 )
 {
     this.sportsFestivalSubscriptionId = sportsFestivalSubscriptionId;
     this.sportsFestival = sportsFestival;
     this.student = student;
     this.classShortcut = classShortcut;
 }
 public static void createSportsFestivalCompetitionRelation(SportsFestival sportsFestival, Competition competition)
 {
     executeSql(""
         + "INSERT INTO `" + tableName + "` "
         + "("
             + "`" + field_sportsFestivalId + "`,"
             + "`" + field_competitionId + "`"
         + ") VALUES ("
             + sportsFestival.SportsFestivalId + ","
             + competition.CompetitionId
         + ")"
     );
 }
        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<SportsFestivalSubscription> getSportsFestivalSubscriptionsBySportsFestival(SportsFestival sportsFestival)
        {
            List<Dictionary<string, object>> results = querySql(""
                + "SELECT "
                    + "* "
                + "FROM "
                    + "`" + tableName + "` "
                + "WHERE "
                    + "`" + field_sportsFestivalId + "` = " + sportsFestival.SportsFestivalId
            );

            List<SportsFestivalSubscription> sportsFestivalSubscriptions = new List<SportsFestivalSubscription>();

            foreach (var row in results)
            {
                sportsFestivalSubscriptions.Add(getSportsFestivalSubscriptionById(Convert.ToInt32(row[field_sportsFestivalSubscriptionId])));
            }

            return sportsFestivalSubscriptions;
        }
        public static int createSportsFestivalSubscription(
            SportsFestival sportsFestival,
            Student student
        )
        {
            executeSql(""
                + "INSERT INTO `" + tableName + "` "
                + "("
                    + "`" + field_sportsFestivalId + "`, "
                    + "`" + field_studentId + "`, "
                    + "`" + field_classShortcut + "`"
                + ") VALUES ("
                    + sportsFestival.SportsFestivalId + ", "
                    + student.StudentId + ", "
                    + "'" + student.ClassObject.Shortcut + "'"
                + ")"
            );

            Dictionary<string, object> result = querySingleSql("SELECT MAX(`" + field_sportsFestivalSubscriptionId + "`) AS `insertionId` FROM `" + tableName + "`");

            int insertionId = Convert.ToInt32(result["insertionId"]);

            return insertionId;
        }
コード例 #10
0
        public static List<Class> getClassesBySportsFestival(SportsFestival sportsFestival)
        {
            List<Dictionary<string, object>> results = querySql(""
                + "SELECT "
                    + "* "
                + "FROM "
                    + "`sportsfestivalSubscription` "
                + "WHERE "
                    + "`" + field_sportsFestivalId + "` = " + sportsFestival.SportsFestivalId
            );

            List<Class> classes = new List<Class>();

            foreach (var row in results)
            {
                classes.Add(ClassProvider.getClassByShortcutSimplified(row["classShortcut"].ToString()));
            }

            return classes;
        }
コード例 #11
0
 internal ResultsGUI(ResultsController controller, SportsFestival curSportsFestival)
 {
     m_SportsFestivalRef = curSportsFestival;
     InitializeComponent();
 }
コード例 #12
0
 public static List<Competition> getCompetitionsBySportsFestival(SportsFestival sportsFestival)
 {
     return SportsFestivalCompetitionProvider.getCompetitionsBySportsFestival(sportsFestival);
 }
コード例 #13
0
        public static List<Student> getStudentsBySportsFestival(SportsFestival sportsFestival)
        {
            List<Dictionary<string, object>> results = querySql(""
                + "SELECT "
                    + "* "
                + "FROM "
                    + "`" + tableName + "` "
                + "WHERE "
                    + "`" + field_sportsFestivalId + "` = " + sportsFestival.SportsFestivalId
            );

            List<Student> students = new List<Student>();

            foreach (var row in results)
            {
                students.Add(StudentProvider.getStudentById((int)row[field_studentId]));
            }

            return students;
        }
コード例 #14
0
        public static SportsFestival getSportsFestivalById(int sportsFestivalId)
        {
            Dictionary<string, object> result = querySingleSql(""
                + "SELECT "
                    + "* "
                + "FROM "
                    + "`" + tableName + "` "
                + "WHERE "
                    + "`" + field_sportsFestivalId + "` = " + sportsFestivalId
            );

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

            SportsFestival sportsFestival = new SportsFestival(
                Convert.ToInt32(result[field_sportsFestivalId]),
                Convert.ToDateTime(result[field_sportsFestivalDate])
            );

            foreach (Competition competition in CompetitionProvider.getCompetitionsBySportsFestival(sportsFestival))
            {
                sportsFestival.addCompetition(competition);
            }

            return sportsFestival;
        }
コード例 #15
0
        public static void updateSportsFestival(SportsFestival sportsFestival)
        {
            executeSql(""
                + "UPDATE "
                    + "`" + tableName + "` "
                + "SET "
                    + "`" + field_sportsFestivalDate + "` = '" + sportsFestival.Date.ToString("yyyy-MM-dd") + "' "
                + "WHERE "
                    + "`" + field_sportsFestivalId + "` = " + sportsFestival.SportsFestivalId
            );

            foreach (Competition competition in sportsFestival.getCompetitions())
            {
                if (SportsFestivalCompetitionProvider.relationExists(sportsFestival, competition) == false)
                {
                    SportsFestivalCompetitionProvider.createSportsFestivalCompetitionRelation(sportsFestival, competition);
                }
            }
        }