/// <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("DORMITORY_ID = " + id.ToString()); if (recordCount > 0) { MessageBox.Show("该宿舍信息已经被使用,不能被删除!", "提示信息"); return(false); } else { BLL.DORMITORY_INFO dormitoryBll = new DORMITORY_INFO(); dormitoryBll.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); } }