public void GetSchoolList() { DropDownListSchool.Items.Clear(); try { ListItem[] _listSchool = null; if (_user.IsAdminUser || IsLeader()) { String DistrictId = DropDownListDistrict.SelectedValue.ToString(); _listSchool = _inBloomApi.GetSchoolForAdmin(DistrictId); } else { _listSchool = _inBloomApi.GetSchool(); } if (_listSchool != null) { for (int Index = 0; Index < _listSchool.Length; Index++) { if (_listSchool[Index] == null) { } else { DropDownListSchool.Items.Add(_listSchool[Index]); } } } if (DropDownListSchool.Items.Count > 0) { School school = new School(_listSchool); Session["School"] = school; } else { Session["School"] = null; } } catch (Exception ex) { } }
public void GetDistrictList() { try { ListItem[] _listDistrict = _inBloomApi.GetDistrictForAdmin(); DropDownListDistrict.Items.Clear(); if (_listDistrict != null) { String CategoryName = _listDistrict[0].Text; if (CategoryName == "Local Education Agency") { // hide district drop down for (int Index = 1; Index < _listDistrict.Length; Index++) { if (_listDistrict[Index] == null) { } else { DropDownListDistrict.Items.Add(_listDistrict[Index]); } } DropDownListDistrict.Visible = false; LabelDistrict.Visible = false; } else if (CategoryName == "School") { // hide district drop down // add the result into the school dropdown with session ListItem[] _listSchool = new ListItem[_listDistrict.Count() - 1]; DropDownListSchool.Items.Clear(); for (int Index = 1; Index < _listDistrict.Length; Index++) { if (_listDistrict[Index] == null) { } else { DropDownListSchool.Items.Add(_listDistrict[Index]); _listSchool[Index - 1] = new ListItem(_listDistrict[Index].Text, _listDistrict[Index].Value); } } if (DropDownListSchool.Items.Count > 0) { School school = new School(_listSchool); Session["School"] = school; } else { Session["School"] = null; } DropDownListDistrict.Visible = false; LabelDistrict.Visible = false; } else if (CategoryName == "State Education Agency") { // show the district drop down // load all the district into the dropdown for (int Index = 1; Index < _listDistrict.Length; Index++) { if (_listDistrict[Index] == null) { } else { DropDownListDistrict.Items.Add(_listDistrict[Index]); } } } //DropDownListDistrict.SelectedValue = "Daybreak School District 4529"; } } catch (Exception ex) { } }