public void updateStageStatus()
        {
            stagemanagerEntities smE = new stagemanagerEntities();
            List<students> students = smE.students.ToList();

            for (int i = 0; i < List.Keys.Count; i++)
            {

                if ((bool)List.Keys.ElementAt(i).GetType().GetProperty("MailTo").GetMethod.Invoke(List.Keys.ElementAt(i), null))
                {
                    students s;
                    List.TryGetValue(List.Keys.ElementAt(i), out s);

                    if (s == null)
                        return;

                    try
                    {
                        switch (s.students_internships.First().internships.approved)
                        {
                            case "0":
                                s.students_internships.First().internships.approved = "2";
                                break;

                            case "1":
                                s.students_internships.First().internships.approved = "3";
                                break;

                            case "2":
                                s.students_internships.First().internships.approved = "1";
                                break;

                            case "3":
                                s.students_internships.First().internships.approved = "0";
                                break;

                        }
                    }
                    catch (Exception e)
                    {
                        System.Diagnostics.Debug.WriteLine("Kan niet");
                    }

                    foreach (students st in students)
                    {
                        if (s.users.email == st.users.email)
                        {
                            if (st.students_internships.Count > 0)
                            {
                                st.students_internships.First().internships.approved = s.students_internships.First().internships.approved;
                            }
                        }
                    }
                }
            }
            smE.SaveChanges();
            refresh();
        }
        public void MailStageSelectie()
        {
            String stageData = "";
            List<String> mails = new List<string>();
            for (int i = 0; i < List.Keys.Count; i++)
            {
                if ((bool)List.Keys.ElementAt(i).GetType().GetProperty("MailTo").GetMethod.Invoke(List.Keys.ElementAt(i), null))
                {
                    students s;
                    List.TryGetValue(List.Keys.ElementAt(i), out s);
                    stageData = s.students_internships.First().internships.description + "\n Van " + s.students_internships.First().internships.start_date + " Tot " + s.students_internships.First().internships.end_date;

                    stagemanagerEntities smE = new stagemanagerEntities();
                    List<students> students = smE.students.ToList();

                    foreach (students st in students)
                    {
                        if (s.users.email == st.users.email)
                        {
                            if (st.students_internships.Count > 0)
                            {
                                st.students_internships.First().internships.approved = "2";
                            }
                        }
                    }
                    smE.SaveChanges();
                }
            }

            Main.ChangeButton("Mail", this, new List<object>() { mails, MailViewModel.mailType.beoordeling, stageData }, Clear.No);
        }