public PublicationsDetailsView(Publication p) { InitializeComponent(); publication_title.Text = p.Title; publication_authors.Content = p.Authors; publication_type.Content = PublicationsController.ParsePublicationType(p.Type); publication_cite.Text = p.CiteAs; publication_available.Content = p.Available.ToString("dd/MM/yyyy"); publication_age.Content = p.Age() + " year(s) old"; publication_doi.Content = p.DOI; }
public ResearcherDetailsView(Researcher r) { InitializeComponent(); if (r.EmployeeType == EmployeeType.Staff) { Staff researcher = ResearcherController.LoadStaff(r); staffmember = researcher; label_name.Content = researcher.GivenName + " " + researcher.FamilyName; label_title.Content = researcher.Title; label_campus.Content = ResearcherController.ParseCampus(researcher.Campus); label_positionCurrent.Content = researcher.CurrentJobTitle(); label_school.Content = researcher.Unit; //PositionorStudent.Content = "Current Position:"; label_email.Content = researcher.Email; label_commenced.Content = researcher.Start; label_current.Content = researcher.CurrentJobStart(); supervisions.Content = "Supervisions:"; if (researcher.Positions.Count > 1) { PositionView.ItemsSource = researcher.GetPositions(); } else { ObservableCollection <string> noPositions = new ObservableCollection <string>(); noPositions.Add("No previous positions"); PositionView.ItemsSource = noPositions; } ObservableCollection <Publication> publications = PublicationsController.LoadPublicationsFor(researcher); if (publications.Count != 0) { PublicationView.ItemsSource = publications; } else { ObservableCollection <string> noPositions = new ObservableCollection <string>(); noPositions.Add("No publications"); } label_tenure.Content = researcher.Tenure() + " Years"; label_average.Content = Staff.ThreeYearAverage(r.ID); label_performance.Content = researcher.calcPerformance() + "%"; label_publications.Content = publications.Count(); label_supervisions.Content = (Staff.SupervisionsCount(r.ID) > 0) ? Staff.SupervisionsCount(r.ID) : "None"; if (Staff.SupervisionsCount(r.ID) == 0) { OpenSupervisions.Visibility = System.Windows.Visibility.Hidden; } String photo = researcher.Photo; var fullFilePath = @photo; BitmapImage bitmap = new BitmapImage(); bitmap.BeginInit(); bitmap.UriSource = new Uri(fullFilePath, UriKind.Absolute); bitmap.EndInit(); pic_researcher.Source = bitmap; } else { Student researcher = ResearcherController.LoadStudent(r); label_name.Content = researcher.GivenName + " " + researcher.FamilyName; label_title.Content = researcher.Title; label_campus.Content = researcher.Campus; label_positionCurrent.Content = researcher.Degree; label_school.Content = researcher.Unit; conditional_job.Content = "Degree:"; label_email.Content = researcher.Email; label_commenced.Content = researcher.Start; label_current.Content = researcher.CurrentJobStart(); PositionView.Visibility = System.Windows.Visibility.Hidden; label_tenure.Content = researcher.Tenure() + " Years"; label_average.Content = "N/A"; label_performance.Content = "N/A"; label_supervisions.Content = "N/A"; OpenSupervisions.Visibility = System.Windows.Visibility.Collapsed; supervisions.Content = "Supervisor Name:"; label_supervisions.Content = researcher.Supervisor; OpenSupervisions.Visibility = Visibility.Hidden; ObservableCollection <Publication> publications = PublicationsController.LoadPublicationsFor(researcher); label_publications.Content = publications.Count(); if (publications.Count != 0) { PublicationView.ItemsSource = publications; } else { ObservableCollection <string> noPositions = new ObservableCollection <string>(); noPositions.Add("No publications"); } String photo = researcher.Photo; var fullFilePath = @photo; BitmapImage bitmap = new BitmapImage(); bitmap.BeginInit(); bitmap.UriSource = new Uri(fullFilePath, UriKind.Absolute); bitmap.EndInit(); pic_researcher.Source = bitmap; } }