コード例 #1
0
ファイル: Form2.cs プロジェクト: IvanSlizhyk/StudentProject
 private void SearchSpeciality(int code, string value)
 {
     if (code == 13 && cmBox_search.SelectedIndex == 0 && value != "" && EntitiesIndex == 3)
     {
         var specialityService = new SpecialityService(_unit, _unit);
         var speciality        = specialityService.GetSpecialityById(Convert.ToInt32(_tBox_searchValue));
         specialityGV.DataSource = new List <Speciality>()
         {
             speciality
         };
     }
     if (code == 13 && cmBox_search.SelectedIndex == 1 && value != "")
     {
         var specialityService = new SpecialityService(_unit, _unit);
         var speciality        = specialityService.GetSpecialitiesByName(_tBox_searchValue);
         specialityGV.DataSource = speciality.ToList();
     }
     if (code == 13 && cmBox_search.SelectedIndex == 2 && value != "")
     {
         var specialityService    = new SpecialityService(_unit, _unit);
         var formEducationService = new FormEducationService(_unit, _unit);
         var formEducation        = formEducationService.GetFormEducationByName(_tBox_searchValue);
         var speciality           = specialityService.GetSpecialitiesByFormEducation(formEducation.Id);
         specialityGV.DataSource = speciality.ToList();
     }
 }