/// <summary> /// 绑定下拉框 /// </summary> public void CampusComItemGetData(string schoolNo) { try { AMS_SchoolModel schoolid = AMS_SchoolBLL.GetSchoolInfoByNum(schoolNo); _CampusVM.GetData(schoolid.Id); _CampusComBoxItems.Clear(); if (_CampusVM.CampusList.Count > 0) { foreach (CampusInfoViewModel campuslvm in _CampusVM.CampusList) { ComboxIntItem si = new ComboxIntItem(); si.Text = campuslvm.Name; si.Value = campuslvm.Id; _CampusComBoxItems.Add(si); } } else { ComboxIntItem si = new ComboxIntItem(); si.Text = "请先添加此学校的校区"; si.Value = 0; _CampusComBoxItems.Add(si); } } catch (Exception ex) { System.Windows.Forms.MessageBox.Show(ex.Message); } }
/// <summary> /// 绑定下拉框 /// </summary> public void ComItemGetData() { try { _SchoolVM.DataGet(); ComboxIntItem si = new ComboxIntItem(); si.Text = "全部学校"; si.Value = 0; _ComBoxItems.Add(si); while (_ComBoxItems.Count > 1) { _ComBoxItems.RemoveAt(1); } foreach (SchoolInfoViewModel schoolvm in _SchoolVM.SchoolList) { si = new ComboxIntItem(); si.Text = schoolvm.Name; si.Value = schoolvm.Id; _ComBoxItems.Add(si); } } catch (Exception ex) { System.Windows.Forms.MessageBox.Show(ex.Message); } }