public static void BindDepartmentEntitytoCombobox(ComboBox comboBox) { try { Department_BLL D_Dal = new Department_BLL(); var DepartmentList = D_Dal.GetAllEntityFromDAL(); CommonUIDataBindMethod.BindComboBox(comboBox, DepartmentList, "DeptName", "DeptID", "--所有部门--"); //comboBox.SelectedValue = DepartmentList.Find(d => d.DeptID == "0").DeptID; D_Dal = null; } catch (Exception ex) { MessageBox.Show("程序发生错误,信息: " + ex.Message); } }
/// <summary> /// 绑定全部学年信息到ComboBox /// </summary> /// <param name="comboBox"></param> public static void BindActiveYearEntitytoCombobox(ComboBox comboBox) { try { ActiveYear_BLL ActiveYearBLL = new ActiveYear_BLL(); var AllActiveYearList = ActiveYearBLL.GetActiveYearForComboBox(); CommonUIDataBindMethod.BindComboBox(comboBox, AllActiveYearList, "ATName", "ATID", "--所有学期--"); comboBox.SelectedValue = AllActiveYearList.Find(d => d.State == "当前").ATID; ActiveYearBLL = null; } catch (Exception ex) { MessageBox.Show("程序发生错误,信息: " + ex.Message); } }