package tarena.proxy;
import java.sql.Connection;
import java.sql.Date;
import java.util.List;
import java.util.Map;
import org.hibernate.Session;
import tarena.business.*;
import tarena.pojo.*;
import tarena.util.HibernateSessionFactory;
public class Business {
private static AdminDAOImpl adminDAO = new AdminDAOImpl();
private static ClassesDAOImpl classesDAO = new ClassesDAOImpl();
private static CourseDAOImpl courseDAO = new CourseDAOImpl();
private static ManagerDAOImpl managerDAO = new ManagerDAOImpl();
private static PollDAOImpl pollDAO = new PollDAOImpl();
private static StudentDAOImpl studentDAO = new StudentDAOImpl();
private static TeacherDAOImpl teacherDAO = new TeacherDAOImpl();
public static boolean saveAdmin(Session session, Admin admin) {
return adminDAO.save(session,admin);
}
public static boolean deleteAdmin(Session session, Admin admin) {
return adminDAO.delete(session,admin);
}
public static boolean updateAdmin(Session session, Admin admin) {
return adminDAO.update(session,admin);
}
public static Admin findAdmin(Session session, Integer id) {
return adminDAO.find(session,id);
}
public static Admin findAdmin(Session session, String name) {
return adminDAO.find(session,name);
}
public static Map findAdmin(Session session) {
return adminDAO.find(session);
}
public static boolean saveClasses(Session session, Classes classes) {
return classesDAO.save(session, classes);
}
public static boolean deleteClasses(Session session, Classes classes) {
return classesDAO.delete(session, classes);
}
public static boolean updateClasses(Session session, Classes classes) {
return classesDAO.update(session, classes);
}
public static Classes findClasses(Session session, Integer id) {
return classesDAO.find(session, id);
}
public static Classes findClasses(Session session, String name) {
return classesDAO.find(session, name);
}
public static Map findClasses(Session session) {
return classesDAO.find(session);
}
public static boolean saveCourse(Session session, Course course) {
return courseDAO.save(session,course);
}
public static boolean deleteCourse(Session session, Course course) {
return courseDAO.delete(session, course);
}
public static boolean updateCourse(Session session, Course classes) {
return courseDAO.update(session,classes);
}
public static Course findCourse(Session session, Integer id) {
return courseDAO.find(session,id);
}
public static Course findCourse(Session session, String name) {
return courseDAO.find(session,name);
}
public static Map findCourse(Session session) {
return courseDAO.find(session);
}
public static boolean saveManager(Session session, Manager manager) {
return managerDAO.save(session,manager);
}
public static boolean deleteManager(Session session, Manager manager) {
return managerDAO.delete(session,manager);
}
public static boolean updateManager(Session session, Manager manager) {
return managerDAO.update(session,manager);
}
public static Manager findManager(Session session, Integer id) {
return managerDAO.find(session,id);
}
public static Manager findManager(Session session, String name) {
return managerDAO.find(session,name);
}
public static Map findManager(Session session) {
return managerDAO.find(session);
}
public static boolean savePoll(Session session, Poll poll) {
return pollDAO.save(session,poll);
}
public static boolean savePoll(Connection conn, List allPoll) {
return pollDAO.save(conn, allPoll);
}
public static boolean deletePoll(Session session, Poll poll) {
return pollDAO.delete(session,poll);
}
public static boolean deletePoll(Session session, List allPoll) {
return pollDAO.delete(session,allPoll);
}
public static boolean updatePoll(Session session, Poll poll) {
return pollDAO.update(session, poll);
}
public static Poll findPoll(Session session, Integer id) {
return pollDAO.find(session, id);
}
public static List findPoll(Session session) {
return pollDAO.find(session);
}
public static List findPoll(Session session, Poll poll, Date startDate, Date endDate, String orderby) {
return pollDAO.find(session, poll, startDate, endDate, orderby);
}
public static List findPoll(Session session, Date startDate, Date endDate, String orderby) {
Session session1=HibernateSessionFactory.currentSession();
return pollDAO.find(session1, startDate, endDate, orderby);
}
public static boolean saveStudent(Session session, Student poll) {
return studentDAO.save(session, poll);
}
public static boolean deleteStudent(Session session, Student poll) {
return studentDAO.delete(session, poll);
}
public static boolean updateStudent(Session session, Student poll) {
return studentDAO.update(session, poll);
}
public static Student findStudent(Session session, Integer id) {
return studentDAO.find(session, id);
}
public static Student findStudent(Session session, String name) {
return studentDAO.find(session, name);
}
public static Map findStudent(Session session) {
return studentDAO.find(session);
}
public static boolean saveTeacher(Session session, Teacher teacher) {
return teacherDAO.save(session, teacher);
}
public static boolean deleteTeacher(Session session, Teacher teacher) {
return teacherDAO.delete(session, teacher);
}
public static boolean updateTeacher(Session session, Teacher teacher) {
return teacherDAO.update(session, teacher);
}
public static Teacher findTeacher(Session session, Integer id) {
return teacherDAO.find(session, id);
}
public static Teacher findTeacher(Session session, String name) {
return teacherDAO.find(session, name);
}
public static Map findTeacher(Session session) {
return teacherDAO.find(session);
}
}