private void initData() { scientistController = new ScientistController(dataFormDTO.db); crud = new ScientistCrud(dataFormDTO.db); formDTO = new CUScientistFormDTO(); formDTO.contex = dataFormDTO.db; filter = new ScientistFilter(); CheckBoxDataInit dataInit = new CheckBoxDataInit(dataFormDTO.db); dataInit.addCompanies(cbCompany); dataInit.addCountries(cbCountry); dataInit.addDegrees(cbDegree); if (!(dataFormDTO.userData.userRole == UserRole.ADMIN || dataFormDTO.userData.userRole == UserRole.SCIENTIST_MANGER)) { AddButton.Visible = false; updateScientist.Visible = false; deleteScientist.Visible = false; } else { AddButton.Visible = true; updateScientist.Visible = true; deleteScientist.Visible = true; } //dataGridView1.DataSource = db.ViewScientists.ToList(); }
public List <ViewScientist> GetScientists(ScientistFilter filter) { IQueryable <ViewScientist> scientists = db.ViewScientists; /* * 1) company * 2) country * 4) degree * */ scientists = GetViewScientistCountry(filter.country, scientists); scientists = GetViewScientistCompany(filter.company, scientists); scientists = GetViewScientistDegree(filter.degree, scientists); return(scientists.ToList()); }