Example #1
0
        public MainWindow()
        {
            InitializeComponent();
            errorMessage();


            researcher = (ResearcherController)(Application.Current.FindResource(RESEARCHER_LIST_KEY) as ObjectDataProvider).ObjectInstance;
        }
Example #2
0
 public void errorMessage()
 {
     if (ResearcherController.LoadResearchers().Count == 0)
     {
         MessageBox.Show("ERROR: Database could not connect.\nPlease check your connection.\nPress ok to quit the program.");
         Environment.Exit(1);
     }
 }
Example #3
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            string content = SearchBox.Text;

            ResearcherListView.ItemsSource = ResearcherController.FilterSearch(content);
        }
Example #4
0
 private void ButtonReset_Click(object sender, RoutedEventArgs e)
 {
     ResearcherListView.ItemsSource = ResearcherController.LoadResearchers();
     SearchBox.Text = "";
 }
Example #5
0
 private void FilterClickAll(object sender, RoutedEventArgs e)
 {
     ResearcherListView.ItemsSource = ResearcherController.LoadResearchers();
 }
Example #6
0
 private void FilterClickStudent(object sender, RoutedEventArgs e)
 {
     ResearcherListView.ItemsSource = ResearcherController.Students();
 }
Example #7
0
 private void FilterClickE(object sender, RoutedEventArgs e)
 {
     ResearcherListView.ItemsSource = ResearcherController.FilterBy(EmploymentLevel.E);
 }
        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;
            }
        }
Example #9
0
 public Supervisions(Staff s)
 {
     InitializeComponent();
     SupervisiorsList.ItemsSource = ResearcherController.GetSupervisions(s);
 }