package action; import dao.C2SDao; import model.C2S; import java.sql.SQLException; import java.util.List; /** * Created by yinus * Date:2016/4/6 * Time:18:43 */ public class C2SAction { public void add(C2S c) throws SQLException { C2SDao cd = new C2SDao(); cd.add(c); } public void delete(int id ,boolean isStudentId) throws SQLException { C2SDao cd = new C2SDao(); cd.delete(id,isStudentId); } public void delete(int stuId,int couId) throws SQLException { C2SDao cd = new C2SDao(); cd.delete(stuId,couId); } public void update(C2S c) throws SQLException { C2SDao cd = new C2SDao(); cd.update(c); } public List<C2S> querys(int id, boolean isStudentId) throws SQLException { C2SDao cd = new C2SDao(); return cd.queryById(id,isStudentId); } public C2S query(int stuId,int couId) throws SQLException { C2SDao cd = new C2SDao(); return cd.queryByStudentIdAndCourseId(stuId,couId); } }
package action; import dao.CourseDao; import model.Course; import java.sql.SQLException; import java.util.List; /** * Created by yinus * Date:2016/4/6 * Time:18:43 */ public class CourseAction { public void add(Course course) throws SQLException { CourseDao courseDao = new CourseDao(); courseDao.addCourse(course); } public void update(Course course) throws SQLException { CourseDao courseDao = new CourseDao(); courseDao.updateCourse(course); } public void delete(int id) throws SQLException { CourseDao courseDao = new CourseDao(); courseDao.delCourse(id); } public List<Course> queryByName(String name) throws SQLException { CourseDao courseDao = new CourseDao(); return courseDao.queryCourses(name); } public Course queryById(int id) throws SQLException { CourseDao courseDao = new CourseDao(); return courseDao.querySingleCourse(id); } }
package action; import dao.StudentDao; import model.Student; import java.sql.SQLException; import java.util.List; /** * Created by yinus * Date:2016/4/6 * Time:18:43 */ public class StudentAction { public void add(Student student) throws SQLException { StudentDao studentDao = new StudentDao(); studentDao.addStudent(student); } public void update(Student student) throws SQLException { StudentDao studentDao = new StudentDao(); studentDao.updateStudent(student); } public void delete(int id) throws SQLException { StudentDao studentDao = new StudentDao(); studentDao.delStudent(id); } public List<Student> queryByName(String name) throws SQLException { StudentDao studentDao = new StudentDao(); return studentDao.queryStudents(name); } public Student queryById(int id) throws SQLException { StudentDao studentDao = new StudentDao(); return studentDao.querySingleStudent(id); } }