/// <summary> /// 初始化班级列表 /// </summary> private void init_class() { Student.BLL.CLASS_INFO classBll = new CLASS_INFO(); string majordirctname = ""; DataSet ds = null; if (this.cbb_majordirct.SelectedIndex != -1) { majordirctname = this.cbb_majordirct.Properties.Items[this.cbb_majordirct.SelectedIndex].ToString(); } if (majordirctname.Length > 0) { ds = classBll.GetList(" and B.MAJORDIRCTNAME = '" + majordirctname + "'"); } else { ds = classBll.GetList(""); } 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> /// <param name="id"></param> /// <returns></returns> private bool deleteData(int id) { try { BLL.CLASS_INFO classBll = new CLASS_INFO(); int recordCount = classBll.GetRecordCount("CLASSNO = " + id.ToString()); if (recordCount > 0) { MessageBox.Show("该专业方向信息已经被使用,不能被删除!", "提示信息"); return(false); } else { BLL.MAJORDIRCT_INFO majordirctBll = new MAJORDIRCT_INFO(); majordirctBll.Delete(id); return(true); } } catch (Exception exception) { MessageBox.Show("删除失败!", exception.Message); return(false); } }
/// <summary> /// 删除数据方法 /// </summary> /// <param name="id"></param> /// <returns></returns> private bool deleteData(int id) { try { BLL.STUDENT_INFO studentBll = new STUDENT_INFO(); int recordCount = studentBll.GetRecordCount("CLASSNO = " + id.ToString()); if (recordCount > 0) { MessageBox.Show("该班级信息已经被使用,不能被删除!", "提示信息"); return(false); } else { BLL.CLASS_INFO classBll = new CLASS_INFO(); classBll.Delete(id); return(true); } } catch (Exception exception) { MessageBox.Show("删除失败!", exception.Message); return(false); } }