/// <summary> /// 初始化所有教师列表 /// </summary> private void init_teacher() { Student.BLL.TEACHER_INFO teacherBll = new TEACHER_INFO(); DataSet ds = teacherBll.GetAllList(); this.cbb_master.Properties.Items.Clear(); this.cbb_organizer.Properties.Items.Clear(); this.cbb_instructor.Properties.Items.Clear(); cbb_master.EditValue = null; cbb_master.Properties.NullText = "--请选择--"; cbb_organizer.EditValue = null; cbb_organizer.Properties.NullText = "--请选择--"; cbb_instructor.EditValue = null; cbb_instructor.Properties.NullText = "--请选择--"; cbb_inyear.EditValue = null; cbb_inyear.Properties.NullText = "--请选择--"; for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { string teacherName = ds.Tables[0].Rows[i]["NAME"].ToString(); this.cbb_master.Properties.Items.Add(teacherName); this.cbb_organizer.Properties.Items.Add(teacherName); this.cbb_instructor.Properties.Items.Add(teacherName); } this.cbb_inyear.Properties.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.DisableTextEditor; this.cbb_master.Properties.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.DisableTextEditor; this.cbb_organizer.Properties.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.DisableTextEditor; this.cbb_instructor.Properties.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.DisableTextEditor; }
/// <summary> /// 删除数据方法 /// </summary> /// <param name="id"></param> /// <returns></returns> private bool deleteData(int id) { try { BLL.TEA_STU teastuBll = new TEA_STU(); int recordCount = teastuBll.GetRecordCount("TEACHERNO = " + id.ToString()); if (recordCount > 0) { MessageBox.Show("该教师信息已经被使用,不能被删除!", "提示信息"); return(false); } else { BLL.TEACHER_INFO teacherbll = new TEACHER_INFO(); teacherbll.Delete(id); return(true); } } catch (Exception exception) { MessageBox.Show("删除失败!", exception.Message); return(false); } }