public static void deleteStudent(Student student)
 {
     executeSql(""
         + "DELETE FROM "
             + "`" + tableName + "` "
         + "WHERE "
             + "`" + field_studentId + " = " + student.StudentId + " "
         + "LIMIT 1"
     );
 }
 public SportsFestivalSubscription(
     int sportsFestivalSubscriptionId,
     SportsFestival sportsFestival,
     Student student,
     string classShortcut
 )
 {
     this.sportsFestivalSubscriptionId = sportsFestivalSubscriptionId;
     this.sportsFestival = sportsFestival;
     this.student = student;
     this.classShortcut = classShortcut;
 }
        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;
        }
 public static void updateStudent(Student student)
 {
     executeSql(""
         + "UPDATE "
             + "`" + tableName + "` "
         + "SET "
             + "`" + field_firstName + "` = '" + student.FirstName + "', "
             + "`" + field_lastName + "` = '" + student.LastName + "', "
             + "`" + field_birthday + "` = '" + student.Birthday.ToString("yyyy-MM-dd") + "', "
             + "`" + field_gender + "` = " + student.Gender + ", "
             + "`" + field_street + "` = " + student.Street + ", "
             + "`" + field_zip + "` = " + student.Zip + ", "
             + "`" + field_city + "` = '" + student.City + "', "
             + "`" + field_classId + "` = " + student.ClassObject.ClassId + ", "
             + "`" + field_active + "` = " + student.Active + " "
         + "WHERE "
             + "`" + field_studentId + " = " + student.StudentId
     );
 }
        public static Student getStudentById(int studentId)
        {
            Dictionary<string, object> result = querySingleSql(""
                + "SELECT "
                    + "* "
                + "FROM "
                    + "`" + tableName + "` "
                + "WHERE "
                    + "`" + field_studentId + "` = " + studentId
            );

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

            Class classObject = ClassProvider.getClassById(Convert.ToInt32(result[field_classId]));

            Student student = new Student(
                    Convert.ToInt32(result[field_studentId]),
                    Convert.ToString(result[field_firstName]),
                    Convert.ToString(result[field_lastName]),
                    Convert.ToDateTime(result[field_birthday]),
                    Convert.ToChar(result[field_gender]),
                    Convert.ToString(result[field_street]),
                    Convert.ToInt32(result[field_zip]),
                    Convert.ToString(result[field_city]),
                    classObject,
                    Convert.ToBoolean(result[field_active])
            );

            return student;
        }