Beispiel #1
0
        private void researchersListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (e.AddedItems.Count > 0)
            {
                researcher = (Researcher)e.AddedItems[0];
                researcher = rc.LoadResearcherDetails(researcher);
                ResearcherDetailsPanel.DataContext = researcher;
                //Show past positions
                positionsListView.Items.Clear();
                foreach (var p in researcher.positions)
                {
                    if (researcher.position.Level != EmploymentLevel.Student && p.End != default(DateTime))
                    {
                        positionsListView.Items.Add(p.Start + "\t" + p.End + "\t" + p.Title() + Environment.NewLine);
                    }
                }


                staff = new Staff(researcher);
                rc.GetViewableStudents();
                students = rc.VisibleStudents.ToList();
                if (researcher.position.Level != EmploymentLevel.Student)
                {
                    threeYear.Content    = staff.ThreeYearAverage;
                    performance.Content  = staff.PerformancePercentage;
                    supervisions.Content = staff.Supervisions;
                }
                else
                {
                    threeYear.Content    = null;
                    performance.Content  = null;
                    supervisions.Content = null;
                }

                if (researcher.position.Level == EmploymentLevel.Student)
                {
                    Student student = (from s in students
                                       where researcher.ID == s.ID
                                       select s).SingleOrDefault();
                    degree.Content = student.Degree;

                    researchers = rc.VisibleResearchers.ToList();

                    var supervisor = (from s in researchers
                                      where s.ID == student.SupervisorID
                                      select s).SingleOrDefault();
                    supervisors.Content = supervisor.GivenName + " " + supervisor.FamilyName;
                }
                else
                {
                    degree.Content      = null;
                    supervisors.Content = null;
                }

                //Show publications
                pc = new PublicationsController(researcher);
                pc.SortPublicationList();
                publications = pc.VisiblePublications.ToList();
                publicationsListView.ItemsSource = publications;
            }
        }