/////////Methods///////// /// <summary> /// Adds each staff member to their respective performance list /// </summary> /// <param name="researchers">List of all researchers</param> public void Generate(List <Model.Researcher> researchers) { foreach (Model.Researcher a in researchers) { if (a.Type == "Staff") { Model.Staff i = (Model.Staff)a; i.Publications = new List <Model.Publication>(pubController.LoadPublicationsFor(i)); float performance = i.Performance(); if (performance <= 70f) { poor.Add(i); } else if (performance > 70f && performance < 110f) { below.Add(i); } else if (performance >= 100f && performance < 200f) { meeting.Add(i); } else if (performance >= 200f) { star.Add(i); } } } }
} //Current Window //////////Methods////////////// /// <summary> /// Adds the details of a given researcher to the view /// </summary> /// <param name="researcher">The researhcer details being added to the screen</param> public void SetDetails(Model.Researcher researcher) { //add data to text boxes ResearcherDetailsView_Name_Value.Text = researcher.GivenName + " " + researcher.FamilyName; ResearcherDetailsView_Title_Value.Text = researcher.Title; ResearcherDetailsView_Unit_Value.Text = researcher.School; ResearcherDetailsView_Campus_Value.Text = researcher.Campus; ResearcherDetailsView_Email_Value.Text = researcher.Email; ResearcherDetailsView_CurrentJob_Value.Text = researcher.CurrentJobTitle(); ResearcherDetailsView_ComInst_Value.Text = researcher.GetEarliestJob().Start.ToString("dd/MM/yyyy"); ResearcherDetailsView_ComPos_Value.Text = researcher.GetCurrentJob().Start.ToString("dd/MM/yyyy"); ResearcherDetailsView_Tenure_Value.Text = researcher.Tenure().ToString() + " years"; ResearcherDetailsView_Publications_Value.Text = researcher.PublicationsCount().ToString(); ResearcherDetailsView_ProfileImage.Source = new BitmapImage(researcher.Photo); PublicationsListView.PublicationsListView_Display_Box.ItemsSource = new ObservableCollection <Model.Publication>(researcher.Publications); //Staff only details if (researcher.Type == "Staff") { int count = 0; //Supervised students count Model.Staff staffCast = (Model.Staff)researcher; //Current researcher object //Get count of supervised students foreach (Model.Student i in staffCast.Supervisions) { count++; } ResearcherDetailsView_3YAv_Value.Text = staffCast.ThreeYearAverage().ToString(); ResearcherDetailsView_Supervisions_Value.Text = count.ToString(); Window.SupervisionsListView.SupervisionsListView_Display_Box.ItemsSource = new ObservableCollection <Model.Researcher>(staffCast.Supervisions as List <Model.Student>); ResearcherDetailsView_Performance_Value.Text = staffCast.Performance().ToString() + "%"; ResearcherDetailsView_PrevPos_Data.ItemsSource = researcher.Positions; //Reset any set student details ResearcherDetailsView_Degree_Value.Text = ""; ResearcherDetailsView_Supervisor_Value.Text = ""; } //Students only details else { Model.Student stundetCast = (Model.Student)researcher; //Current researcher object ResearcherDetailsView_Degree_Value.Text = stundetCast.Degree; ResearcherDetailsView_Supervisor_Value.Text = stundetCast.SupervisorName; //Reset any set staff details ResearcherDetailsView_3YAv_Value.Text = ""; ResearcherDetailsView_Supervisions_Value.Text = ""; Window.SupervisionsListView.SupervisionsListView_Display_Box.ItemsSource = new ObservableCollection <Model.Researcher>(); ResearcherDetailsView_Performance_Value.Text = ""; ResearcherDetailsView_PrevPos_Data.ItemsSource = null; } }