//return title if called public string ToTitle(EmploymentLevel l) { if (l == EmploymentLevel.A) { return("PostDoc"); } else if (l == EmploymentLevel.B) { return("Lecturer"); } else if (l == EmploymentLevel.C) { return("Senior lecturer"); } else if (l == EmploymentLevel.D) { return("Associate professor"); } else if (l == EmploymentLevel.E) { return("Professor"); } else if (l == EmploymentLevel.student) { return("Student"); } else { return("UNDEFINED"); } }
/// <summary> /// Takes the level of the researcher and returns their title string. /// </summary> /// <param name="l"></param> /// <returns></returns> String ToTitle(EmploymentLevel l) { String levelName = l.ToString(); switch (levelName) { case "Student": return("Student"); case "A": return("Postdoc"); case "B": return("Lecturer"); case "C": return("Senior Lecturer"); case "D": return("Associate Professor"); case "E": return("Professor"); default: return("No employment level"); } }
/////////Methods///////// /// <summary> /// "Converts" enum of employment level to a string /// </summary> /// <param name="l"></param> /// <returns>String of title that was represented by enum</returns> public string ToTitle(EmploymentLevel l) { string job = "N/A"; //get the employment level switch (l) { case EmploymentLevel.Student: job = "Student"; break; case EmploymentLevel.A: job = "Postdoc"; break; case EmploymentLevel.B: job = "Lecturer"; break; case EmploymentLevel.C: job = "Senior Lecturer"; break; case EmploymentLevel.D: job = "Associate Professor"; break; case EmploymentLevel.E: job = "Professor"; break; } return(job); }
/// <summary> /// calculate the researcher performance /// </summary> /// <returns></returns> public float GetPerformance() { EmploymentLevel l = GetCurrentJob().Level; float ave = ThreeYearAverage(); float ratio = (float)0.0; switch (l) { case EmploymentLevel.A: ratio = (float)0.5; break; case EmploymentLevel.B: ratio = 1; break; case EmploymentLevel.C: ratio = 2; break; case EmploymentLevel.D: ratio = (float)3.2; break; case EmploymentLevel.E: ratio = 4; break; default: ratio = (float)double.PositiveInfinity; break; } ave = ave / ratio * 100; return((float)Math.Round((double)ave, 2)); }
public string ToTitle(EmploymentLevel level) { switch (level) { case EmploymentLevel.A: title = "Postdoc"; break; case EmploymentLevel.B: title = "Lecturer"; break; case EmploymentLevel.C: title = "Senior Lecturer"; break; case EmploymentLevel.D: title = "Associate Professor"; break; case EmploymentLevel.E: title = "Professor"; break; default: title = "Student"; break; } return(title); }
//performance value calculation (ThreeYearAverage / expected number of puclications) public float Performance() { //get employment level float p = 1f; EmploymentLevel pos = GetCurrentJob().Level; switch (pos) { case EmploymentLevel.A: p = 0.5f; break; case EmploymentLevel.B: p = 1f; break; case EmploymentLevel.C: p = 2; break; case EmploymentLevel.D: p = 3.2f; break; case EmploymentLevel.E: p = 4f; break; } //calc performance return((float)Math.Round(100f * (ThreeYearAverage() / p), 1)); }
//Filter by employment level public void FilterBy(EmploymentLevel level) { var filteredByLevel = from r in res where r.position.Level == level select r; resFiltered = filteredByLevel.ToList(); }
public static ObservableCollection <Researcher> FilterBy(EmploymentLevel e) { var baseList = LoadStaff(); var selected = from some in baseList where some.CurrentJob().Level == e select some; return(new ObservableCollection <Researcher>(selected)); }
//Filter by level public void FilterByLevel(EmploymentLevel level) { var filteredByLevel = from r in researchers where r.position.Level == level || level == EmploymentLevel.All select r; viewableResearchers.Clear(); filteredByLevel.ToList().ForEach(viewableResearchers.Add); }
private void ByLevel_SelectionChanged(object sender, SelectionChangedEventArgs e) { ComboBox ByLevelCB = (ComboBox)sender; //Get selected Level(Enum type) EmploymentLevel level = (EmploymentLevel)Enum.Parse(typeof(EmploymentLevel), ByLevelCB.SelectedItem.ToString(), false); controller.LevelFilter(level); ResearcherListBox.ItemsSource = controller.Loadresearcher(); }
public void LevelFilter(EmploymentLevel Level) { var LinQ = from Researcher r in researchers where Level == EmploymentLevel.All || r.Level == Level select r; viewableresearchers.Clear(); LinQ.ToList().ForEach(viewableresearchers.Add); }
public void LevelFilter(EmploymentLevel employmentLevel) { var selected = from Researcher r in researcherBasic where employmentLevel == EmploymentLevel.All || r.Level == employmentLevel select r; viewableResearcher.Clear(); //Converts the result of the LINQ expression to a List and then calls viewableResearcher.Add with each element of that list in turn selected.ToList().ForEach(viewableResearcher.Add); }
private void DBLevel_SelectionChanged(object sender, SelectionChangedEventArgs e) { // spResearcherDetails.DataContext = null; ComboBox cb = (ComboBox)sender; //Get selected value from ComboBox EmploymentLevel level = (EmploymentLevel)Enum.Parse(typeof(EmploymentLevel), cb.SelectedItem.ToString(), false); //Call LevelFilter function controller.LevelFilter(level); lbResearcher.ItemsSource = controller.GetViewableList(); }
// filter the list by researche level. if the researcher type is 'Student', the leve is 'Student' public static List <Researcher> FilterBy(EmploymentLevel level) { List <Researcher> researcherList = ERDAdapter.fetchBasicResearcherDetails(); if (level == EmploymentLevel.All) { return(researcherList); } else { var selected = from Researcher r in researcherList where level.ToString().Equals(r.Level) select r; return(new List <Researcher>(selected)); } }
//filterby combo box employment level public void FilterByEmploymentLevel(EmploymentLevel e) { if (e != EmploymentLevel.Any) { var selected = from Researher r in researchers where e == r.employmentLevel select r; viewableresearchers.Clear(); selected.ToList().ForEach(viewableresearchers.Add); } else { var selected = from Researher r in researchers select r; viewableresearchers.Clear(); selected.ToList().ForEach(viewableresearchers.Add); } }
/* Three-year average divided by the expected number of publications * for employment level. */ public double performance() { EmploymentLevel level = getEmploymentLevel(); // Expected number of publications for each employment level. Dictionary <EmploymentLevel, double> expectedPublicationsByLevel = new Dictionary <EmploymentLevel, double>() { { EmploymentLevel.A, 0.5 }, { EmploymentLevel.B, 1 }, { EmploymentLevel.C, 2 }, { EmploymentLevel.D, 3.2 }, { EmploymentLevel.E, 4 }, }; double expectedPublications = expectedPublicationsByLevel[level]; return(threeYearAverage() / expectedPublications); }
// Returns a single string from the given employment level public string GetTitleFromLevel(EmploymentLevel level) { switch (level) { case EmploymentLevel.A: return("Postdoc"); case EmploymentLevel.B: return("Lecturer"); case EmploymentLevel.C: return("Senior Lecturer"); case EmploymentLevel.D: return("Associate Professor"); case EmploymentLevel.E: return("Professor"); default: return("LEVEL_NOT_FOUND"); } }
public static string GetPerformance(EmploymentLevel level, double TYAve) { string Performance; double ExpectedNum; string LevelStr = level.ToString(); switch (LevelStr) { case "A": ExpectedNum = 0.5; break; case "B": ExpectedNum = 1; break; case "C": ExpectedNum = 2; break; case "D": ExpectedNum = 3.2; break; case "E": ExpectedNum = 4; break; default: return(""); } //Transfer to string type Performance = (TYAve / ExpectedNum).ToString("0.#%"); return(Performance); }
public static string FetchPerformance(EmploymentLevel level, double ThreeYearAverage) { string Performance; double Require; switch (level.ToString()) { case "A": Require = 0.5; break; case "B": Require = 1; break; case "C": Require = 2; break; case "D": Require = 3.2; break; case "E": Require = 4; break; default: return(""); } //Transfer to string type Performance = (ThreeYearAverage / Require).ToString("0.#%"); return(Performance); }
public string ToTitle(EmploymentLevel I) { return(convertTitle[I]); }
public void FilterBy(EmploymentLevel level) { }
public static string Title(this EmploymentLevel level) => level switch {