/// <summary> /// 值改变 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void cLookUp_EditValueChanged(object sender, EventArgs e) { if (ListIsValid == null) { return; } CurrentCoach = EditValue == null ? null : ListIsValid.Find(model => model.CoachID == Convert.ToInt32(EditValue)); }
/// <summary> /// 值改变 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void cLookUp_EditValueChanged(object sender, EventArgs e) { if (ListIsValid == null) { return; } selSource = EditValue == null ? null : ListIsValid.Find(model => model.Codes == EditValue); }
/// <summary> /// 绑定下拉控件数据集 /// </summary> public void BindListZY(int schoolId = 0, int trainPlaceId = 0, bool getFromCache = true) { _schoolID = schoolId; _trainPlaceID = trainPlaceId; var cacheName = "Group"; if (schoolId > 0) { cacheName += "#Sch_" + schoolId; } if (trainPlaceId > 0) { cacheName += "#Tp_" + trainPlaceId; } ClientCache.GetDataMethod method; if (schoolId > 0 && trainPlaceId > 0) { method = () => new GroupDao().GetListByPlaceSchool(trainPlaceId, schoolId); } else if (schoolId > 0) { method = () => new GroupDao().GetListByTrainPlace(trainPlaceId); } else if (trainPlaceId > 0) { method = () => new GroupDao().GetListBySchool(schoolId); } else { method = () => new GroupDao().GetList(); } ListIsValid = (List <Group>)(getFromCache ? ClientCache.GetAuto(cacheName, method) : ClientCache.GetUpdate(cacheName, method)); ListIsValid.RemoveAll(m => m.GroupType == "挂靠"); Properties.DataSource = ListIsValid; Properties.DisplayMember = "GroupName"; Properties.ValueMember = "GroupID"; Properties.BestFitMode = BestFitMode.BestFitResizePopup; Properties.SearchMode = SearchMode.AutoFilter; Properties.CaseSensitiveSearch = true; Properties.AutoSearchColumnIndex = 2; }
/// <summary> /// 绑定下拉控件数据集 /// </summary> public void BindList(bool getFromCache = true) { if (getFromCache) { ListIsValid = (List <ApplyPlace>)ClientCache.GetAuto("ApplyPlace", () => new ApplyPlaceDAO().GetList()); } else { ListIsValid = (List <ApplyPlace>)ClientCache.GetUpdate("ApplyPlace", () => new ApplyPlaceDAO().GetList()); } ListIsValid = ListIsValid.FindAll(m => m.State); Properties.DataSource = ListIsValid; Properties.DisplayMember = "ApplyPlaceName"; Properties.ValueMember = "ApplyPlaceID"; Properties.BestFitMode = BestFitMode.BestFitResizePopup; Properties.SearchMode = SearchMode.AutoFilter; Properties.CaseSensitiveSearch = true; Properties.AutoSearchColumnIndex = 2; }