//删除教师员工 public bool DeleteTeacher(TeacherModel objTeacherModel) { string SqlString = "delete FROM Teacher WHERE TeaNum='" + objTeacherModel.TeaNum + "' "; DataBaseOperaClass objDataBase = new DataBaseOperaClass(); return (objDataBase.GetExecute(SqlString)); }
//修改课程 public bool ChangeCourse(CourseModel objCourseModel) { #region // //public bool ChangeCourse(string Course, string CourseNum, string CourseName, string Credit, string ProOrPub, string NeedOrOpt) //{ // string SQLString; // SQLString = "update Course set CourseNum='" + CourseNum + "',CourseName='" + CourseName + "'"; // SQLString += ",Credit='" + Credit + "',ProOrPub='" + ProOrPub + "'"; // SQLString += ",NeedOrOpt='" + NeedOrOpt + "'where CourseNum='" + Course + "'"; // DataBaseOperateClass objDataBase = new DataBaseOperateClass(); // if (objDataBase.GetExecute(SQLString)) // return (true); // else // return (false); //} #endregion #region 使用实体类在各层之间传递数据 string SQLString; SQLString = "update Course set CourseNum='" + objCourseModel.CourseNum + "',CourseName='" + objCourseModel.CourseName + "',Credit='" + objCourseModel.Credit + "',ProOrPub='" + objCourseModel.ProOrPub + "',NeedOrOpt='" + objCourseModel.NeedOrOpt + "',DeptNum='"+ objCourseModel.DeptNum+"' where CourseNum='" + objCourseModel.CourseNum + "'"; DataBaseOperaClass objDataBase = new DataBaseOperaClass(); if (objDataBase.GetExecute(SQLString)) return (true); else return (false); #endregion }
public bool DelProfession(ProfessionModel objProfessionModel) { string SqlString = "delete from profession where ProNum='" + objProfessionModel.ProNum + "'"; DataBaseOperaClass objDataBase = new DataBaseOperaClass(); //return (objDataBase.GetExecute(SqlString)); return (objDataBase.GetExecute(SqlString)); }
//删除班级信息 public bool DeleteClass(ClassModel objClassModel) { string Sqlstring = "delete from Class where ClaNum = '" + objClassModel.ClaNum + "'"; DataBaseOperaClass objDataBase = new DataBaseOperaClass(); if (objDataBase.GetExecute(Sqlstring)) return (true); else return (false); }
public bool AddProfessin(ProfessionModel objProfessionModel) { string SqlString = "INSERT INTO Profession(ProNum,ProName,deptNum)VALUES('" + objProfessionModel.ProNum + "','" + objProfessionModel.ProName + "','"+objProfessionModel.DepartNum + "')"; DataBaseOperaClass objDataBase = new DataBaseOperaClass(); if (objDataBase.GetExecute(SqlString)) return (true); else return (false); }
//添加班级信息 public bool AddTeachingTask(TeachingModel objTeachingModel) { string Sqlstring = "Insert into Teaching Values('T001','第一学期','c1000')"; DataBaseOperaClass objDataBase = new DataBaseOperaClass(); if (objDataBase.GetExecute(Sqlstring)) return (true); else return (false); }
public bool UpdateTea(TeacherModel objTeacherModel) { string SQLString; SQLString = "UPDATE Teacher SET TeaName='" + objTeacherModel.TeaName + "',TeaSex='" + objTeacherModel.TeaSex + "'"; SQLString += ",TeaPhone='" + objTeacherModel.TeaPhone + "',TeaAdress='" + objTeacherModel.TeaAdress + "'"; SQLString += ",TeaTitle='" + objTeacherModel.TeaTitle + "',TeaNum='" + objTeacherModel.TeaNum + "' where TeaNum='" + objTeacherModel.TeaNum + "'"; DataBaseOperaClass objDataBase = new DataBaseOperaClass(); if (objDataBase.GetExecute(SQLString)) return (true); else return (false); }
//修改班级信息 public bool ChangeClass(ClassModel objClassModel) { //string Sqlstring; //Sqlstring = "update Class set ClaNum ='" + objClassModel.ClaNum + "',ClaName ='" + objClassModel.ClaName + "',DeptNum ='" + objClassModel.DeptNum + "',ProNum ='" + objClassModel.ProNum + "' where ClaNum ='"+objClassModel.ClaNum+"'"; string SqlString="Update V_ClassInfo set 班级编号='"+objClassModel.ClaNum+"',班级名称='"+objClassModel.ClaName+"',专业编号='"+objClassModel.ProNum+"',系部编号='"+objClassModel.DeptNum+"'where 班级编号='"+objClassModel.ClaNum+"'"; DataBaseOperaClass objDataBase = new DataBaseOperaClass(); if (objDataBase.GetExecute(SqlString)) return (true); else return (false); }
public bool UpdateProfession(ProfessionModel objProfessionModel) { string SqlString; //专业编号不可以修改,因它这里它用作搜索条件 ProNum='"+objProfessionModel.ProNum +"', SqlString = "update dbo.profession set ProName='"+objProfessionModel.ProName+"',deptNum='"+ objProfessionModel.DepartNum + "' where ProNum='" + objProfessionModel.ProNum + "'"; DataBaseOperaClass objDataBase = new DataBaseOperaClass(); if (objDataBase.GetExecute(SqlString)) return (true); else return (false); }
public bool CancelSel(SelCourseModel objSelCourseClass) { string SqlString = "delete from SelCourse where StuNum=@StuNum AND CourseNum=@CourseNum"; SqlParameter[] parms ={ new SqlParameter("@StuNum",objSelCourseClass.StuNum), new SqlParameter("@CourseNum",objSelCourseClass.CourseNum) }; DataBaseOperaClass objDataBase = new DataBaseOperaClass(); if (objDataBase.GetExecute(SqlString,parms)) return (true); else return (false); }
//添加 public bool AddSchool(SchoolModel objSchoolModel) { #region 使用实体类在各层之间传递数据 string SqlString = "insert into School values ('"+objSchoolModel.SchNum+"','"+ objSchoolModel.SchName+"')"; DataBaseOperaClass objDataBase = new DataBaseOperaClass(); if (objDataBase.GetExecute(SqlString)) return (true); else return (false); #endregion }
public bool InputScore(SelCourseModel objSelCourseModel) { string SqlString = "Update SelCourse Set Score=@Score where StuNum=@StuNum AND CourseNum=@CourseNum"; SqlParameter[] parms ={ new SqlParameter("@Score",objSelCourseModel.Score), new SqlParameter("@StuNum",objSelCourseModel.StuNum), new SqlParameter("@CourseNum",objSelCourseModel.CourseNum) }; DataBaseOperaClass objDataBase = new DataBaseOperaClass(); if (objDataBase.GetExecute(SqlString,parms)) return (true); else return (false); }
public bool AddCourse( CourseModel objCourseModel) { #region 使用实体类在各层之间传递数据 string SqlString = "Insert into Course(CourseNum,CourseName,Credit,ProOrPub,NeedOrOpt,DeptNum) values('" + objCourseModel.CourseNum + "','" + objCourseModel.CourseName + "','" + objCourseModel.Credit + "','" + objCourseModel.ProOrPub + "','" + objCourseModel.DeptNum + "','"+objCourseModel.DeptNum+"')"; DataBaseOperaClass objDataBase = new DataBaseOperaClass(); if (objDataBase.GetExecute(SqlString)) return (true); else return (false); #endregion }
public bool AddClass(ClassModel objClassModel) { string SqlString = "Insert into V_ClassInfo (班级编号,班级名称,专业编号,系部编号) Values(@ClaNum,@ClaName,@ProNum,@DeptNum)"; SqlParameter[] parms ={ new SqlParameter("@ClaNum",objClassModel.ClaNum), new SqlParameter("@ClaName",objClassModel.ClaName), new SqlParameter("@ProNum",objClassModel.ProNum), new SqlParameter("@DeptNum",objClassModel.DeptNum) }; DataBaseOperaClass objDataBase = new DataBaseOperaClass(); if (objDataBase.GetExecute(SqlString,parms)) return (true); else return (false); }
public bool DelSchool(SchoolModel objSchoolModel) { string SqlString = "delete from School where SchNum='" + objSchoolModel.SchNum + "'"; DataBaseOperaClass objDataBase = new DataBaseOperaClass(); try { if (objDataBase.GetExecute(SqlString)) return (true); else return (false); } catch (Exception e1) { MessageBox.Show("该学校有数据!\n不能删除!\n删除前请先清空学校下属的所有内容!"+e1); return (false); } }
public bool AddTeacher(TeacherModel objTeacherModel) { string Sqlstring = "INSERT INTO Teacher(TeaNum,TeaName,TeaSex,TeaAdress,TeaPhone,TeaTitle)VALUES ('" + objTeacherModel.TeaNum + "','" + objTeacherModel.TeaName + "','" + objTeacherModel.TeaSex + "','" + objTeacherModel.TeaAdress + "','" + objTeacherModel.TeaPhone + "','" + objTeacherModel.TeaTitle + "')"; DataBaseOperaClass objDataBase = new DataBaseOperaClass(); try { if (objDataBase.GetExecute(Sqlstring)) return (true); else return (false); } catch (Exception e1) { MessageBox.Show("教师工号不能重复\n请检查输入内容!" + e1); return (false); } }
//删除课程 public bool DeletCourse(CourseModel objCourseModel ) { string SqlString = "DELETE FROM Course WHERE CourseNum='" + objCourseModel.CourseNum + "'"; DataBaseOperaClass objDataBase = new DataBaseOperaClass(); return (objDataBase.GetExecute(SqlString)); }
//修改: public bool Update(SchoolModel objSchoolModel) { #region 使用实体类在各层 string SqlString = "Update School Set SchNum='" +objSchoolModel.SchNum + "',SchName='" + objSchoolModel.SchName +"'where SchNum='"+objSchoolModel.SchNum+"'"; DataBaseOperaClass objDataBase = new DataBaseOperaClass(); if (objDataBase.GetExecute(SqlString)) return (true); else return (false); #endregion }
public bool SelOk(SelCourseModel objSelCourseModel) { string SqlString = "Insert into SelCourse(StuNum,CourseNum) Values(@StuNum ,@CourseNum)"; DataBaseOperaClass objDataBase = new DataBaseOperaClass(); SqlParameter[] parms = { new SqlParameter("@StuNum", objSelCourseModel.StuNum), new SqlParameter("@CourseNum",objSelCourseModel.CourseNum), //new SqlParameter("@Score",objSelCourseModel.Score) }; if (objDataBase.GetExecute(SqlString, parms)) { return (true); } else { return (false); } }
public bool Update(SelCourseModel objSelCourseClass) { string SqlString = "Update V_SelCourse set 课程编号='" + objSelCourseClass.CourseNum + "'"; SqlString +=" Where 学号=@StuNum AND 所选课程=@CourseName"; SqlParameter[] parms ={ new SqlParameter("@StuNum",objSelCourseClass.StuNum), new SqlParameter("@CourseName",objSelCourseClass.CourseName) }; DataBaseOperaClass objDataBase = new DataBaseOperaClass(); if (objDataBase.GetExecute(SqlString,parms)) return (true); else return (false); }