public void Match(Teacher teacher, int uren, string type)
 {
     string query = "INSERT INTO docent_has_stageopdracht VALUES(" + teacher.TeacherNo + "," + _stagenr + ",'" + type + "');";
     MySqlCommand mycommand = new MySqlCommand(query);
     ModelFactory.Database.setData(mycommand);
     query = "UPDATE `docent` SET `Uren`= ((SELECT `Uren`)-"+ uren + ") WHERE `docentnr` = " + teacher.TeacherNo;
     mycommand = new MySqlCommand(query);
     ModelFactory.Database.setData(mycommand);
 }
        private void UpdateTeacherKnowledgeAreas(Teacher teacher)
        {
            MySqlCommand cmd = new MySqlCommand("SELECT * FROM kennisgebieden WHERE KennisNr IN (SELECT Kennisgebieden_KennisNr FROM docent_has_kennisgebieden WHERE Docent_Docentnr = " + teacher.TeacherNo + ")");
            DataTable table = new DataTable();
            MySqlDataAdapter adapter = ModelFactory.Database.getData(cmd);
            adapter.Fill(table);

            int NumRows = table.Rows.Count;

            if (NumRows >= 1)
            {
                teacher.KnowledgeAreas[0] = table.Rows[0][1].ToString();
                teacher.Knowledge += table.Rows[0][1].ToString() + ", ";
            }
            else
                teacher.KnowledgeAreas[0] = "";
            if (NumRows >= 2)
            {
                teacher.KnowledgeAreas[1] = table.Rows[1][1].ToString();
                teacher.Knowledge += table.Rows[1][1].ToString();
            }
            else
                teacher.KnowledgeAreas[1] = "";
            if (NumRows >= 3)
            {
                teacher.KnowledgeAreas[2] = table.Rows[2][1].ToString();
                teacher.Knowledge += ", " + table.Rows[2][1].ToString();
            }
            else
                teacher.KnowledgeAreas[2] = "";
            if (NumRows >= 4)
            {
                teacher.KnowledgeAreas[3] = table.Rows[3][1].ToString();
                teacher.Knowledge += ", " + table.Rows[0][1].ToString();
            }
            else
                teacher.KnowledgeAreas[3] = "";
            if (NumRows >= 5)
            {
                teacher.KnowledgeAreas[4] = table.Rows[4][1].ToString();
                teacher.Knowledge += ", " + table.Rows[0][1].ToString();
            }
            else
                teacher.KnowledgeAreas[4] = "";
        }