private static SchoolList ReadTable(DataTable table, string sheetName) { var schools = new SchoolList(); foreach (DataRow row in table.Rows) { if (sheetName == "KiTa") { var school = GetSchool(row, 5, 4); if (school != null) { schools.Add(school); } } else { var school = GetSchool(row, 13, 12); if (school != null) { schools.Add(school); } } } return(schools); }
/// <summary> /// 绑定学校列表 /// </summary> public void BindSchoolList() { string functionName = "BindSchoolList"; try { List <AMS.Model.AMS_ProvinceSchoolInfo> List = AMS.ServiceProxy.IssuedInfoWindow.GetSchoolList(); SchoolList.Clear(); SchoolList.Add(new AMS.Model.AMS_School() { Number = "-1", Name = "请选择" }); foreach (AMS.Model.AMS_ProvinceSchoolInfo model in List) { foreach (AMS.Model.AMS_School modelChild in model.Schools) { SchoolList.Add(modelChild); } } } catch (AMS.Model.CustomerException ex) { ErrorMessage = string.Format("{0} 出自{1}.{2}", ex.Message, ex.ErrorSourcesClass, ex.ErrorSourcesFunction); } catch (Exception ex) { ErrorMessage = string.Format("{0} 出自{1}.{2}", ex.Message, CLASSNAME, functionName); } }
/// <summary> /// 绑定学校列表 /// </summary> public void BindSchool() { SchoolList.Clear(); List <AdvertManage.Model.AMS_SchoolModel> schoolList = AdvertManage.BLL.AMS_SchoolBLL.GetAllSchoolInfo(); SchoolList.Add(new AdvertManage.Model.AMS_SchoolModel() { Id = -1, Name = "请选择" }); foreach (AdvertManage.Model.AMS_SchoolModel model in schoolList) { SchoolList.Add(model); } }