/// <summary> /// 初始化班级列表 /// </summary> private void init_class() { Student.BLL.CLASS_INFO classBll = new Student.BLL.CLASS_INFO(); DataSet ds = classBll.GetAllList(); this.cbb_classno.Properties.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.DisableTextEditor; cbb_classno.Properties.Items.Clear(); cbb_classno.EditValue = null; cbb_classno.Properties.NullText = "--请选择--"; for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { string className = ds.Tables[0].Rows[i]["CLASSNAME"].ToString(); this.cbb_classno.Properties.Items.Add(className); } }
/// <summary> /// 查询数据方法 /// </summary> private void ReadData() { string condition = ""; if (this.cbb_master.SelectedIndex != -1 || cbb_master.Text != "--请选择--") { condition += "and D.NAME like '%" + this.cbb_master.Properties.Items[this.cbb_master.SelectedIndex].ToString() + "%' "; } if (this.cbb_instructor.SelectedIndex != -1 || cbb_instructor.Text != "--请选择--") { condition += "and E.NAME like '%" + this.cbb_instructor.Properties.Items[this.cbb_instructor.SelectedIndex].ToString() + "%' "; } if (this.cbb_organizer.SelectedIndex != -1 || cbb_organizer.Text != "--请选择--") { condition += "and F.NAME like '%" + this.cbb_organizer.Properties.Items[this.cbb_organizer.SelectedIndex].ToString() + "%' "; } if (this.cbb_inyear.SelectedIndex != -1) { condition += "and left(A.CLASSNAME,2) = right('" + this.cbb_inyear.Properties.Items[this.cbb_inyear.SelectedIndex].ToString() + "',2) "; } if (this.te_classname.Text.Length > 0) { condition += "and A.CLASSNAME like '%" + this.te_classname.Text + "%' "; } if (this.cbb_majordirctname.SelectedIndex != -1) { condition += "and B.MAJORDIRCTNAME like '%" + this.cbb_majordirctname.Properties.Items[this.cbb_majordirctname.SelectedIndex].ToString() + "%' "; } Student.BLL.CLASS_INFO majorBll = new Student.BLL.CLASS_INFO(); this.gridControl1.DataSource = majorBll.GetList(condition).Tables[0]; this.gridView1.BestFitColumns(); DBUtility.ToolHelper.DrawRowIndicator(gridView1, 40); DBUtility.ToolHelper.SetLineColorofGridView(this.gridView1); }