public JsonResult FillDowndowns(string Type = "", string Discipline_ID = "0", string ProgramLevel_Id = "0", string Qualification_ID = "0") { string Code = string.Empty, Message = string.Empty; List <InstituteSearchDropdowns> _list = new List <InstituteSearchDropdowns>(); try { InstituteRepository _objRepo = new InstituteRepository(); DataSet _ds = _objRepo.SELECT_INSTITUTE_SEARCH_DROPDOWNS(Type, Discipline_ID, ProgramLevel_Id, Qualification_ID); if (_ds != null) { if (_ds.Tables[0].Rows.Count > 0) { foreach (DataRow _dr in _ds.Tables[0].Rows) { _list.Add(new InstituteSearchDropdowns { Id = _dr["ID"].ToString(), Value = _dr["VALUE"].ToString() }); } } } } catch (NullReferenceException) { throw; } catch (Exception) { throw; } return(Json(new { List = _list, c = Code, m = Message }, JsonRequestBehavior.AllowGet )); }
private void SelectDropdowns() { string Code = string.Empty, Message = string.Empty; List <InstituteSearchDropdowns> _listDiscipline = new List <InstituteSearchDropdowns>(); List <InstituteSearchDropdowns> _listProgrammeLevel = new List <InstituteSearchDropdowns>(); List <InstituteSearchDropdowns> _listQualification = new List <InstituteSearchDropdowns>(); List <InstituteSearchDropdowns> _listCourseOfStudy = new List <InstituteSearchDropdowns>(); List <InstituteSearchDropdowns> _listInstituteType = new List <InstituteSearchDropdowns>(); try { InstituteRepository _objRepo = new InstituteRepository(); DataSet _ds = _objRepo.SELECT_INSTITUTE_SEARCH_DROPDOWNS("Dropdowns", "", "", ""); if (_ds != null) { if (_ds.Tables[0].Rows.Count > 0) { foreach (DataRow _dr in _ds.Tables[0].Rows) { _listDiscipline.Add(new InstituteSearchDropdowns { Id = _dr["ID"].ToString(), Value = _dr["VALUE"].ToString() }); } } if (_ds.Tables[1].Rows.Count > 0) { foreach (DataRow _dr in _ds.Tables[1].Rows) { _listProgrammeLevel.Add(new InstituteSearchDropdowns { Id = _dr["ID"].ToString(), Value = _dr["VALUE"].ToString() }); } } if (_ds.Tables[2].Rows.Count > 0) { foreach (DataRow _dr in _ds.Tables[2].Rows) { _listQualification.Add(new InstituteSearchDropdowns { Id = _dr["ID"].ToString(), Value = _dr["VALUE"].ToString() }); } } if (_ds.Tables[3].Rows.Count > 0) { foreach (DataRow _dr in _ds.Tables[3].Rows) { _listCourseOfStudy.Add(new InstituteSearchDropdowns { Id = _dr["ID"].ToString(), Value = _dr["VALUE"].ToString() }); } } if (_ds.Tables[4].Rows.Count > 0) { foreach (DataRow _dr in _ds.Tables[4].Rows) { _listInstituteType.Add(new InstituteSearchDropdowns { Id = _dr["ID"].ToString(), Value = _dr["VALUE"].ToString() }); } } } } catch (NullReferenceException) { throw; } catch (Exception) { throw; } ViewBag.Disciplines = _listDiscipline; ViewBag.ProgrammeLevel = _listProgrammeLevel; ViewBag.Qualification = _listQualification; ViewBag.CourseOfStudy = _listCourseOfStudy; ViewBag.InstituteType = _listInstituteType; }