transactionItem.setDate(new Date());
daoTransaction.save(transactionItem);
transactionList.add(transactionItem);
//Agregar StudentCourse
DAOStudent daoStudent = DAOStudent.getInstance();
Student student = daoStudent.get(transactionItem.getIdStudent().getId());
List<StudentCourse> studentCourses = student.getStudentCourses();
StudentCourse e = new StudentCourse();
e.setCourse(courseItem);
e.setStatus("active");
if(studentCourses != null){
if (studentCourses.size() > 0){
for (int i = 0; i < studentCourses.size(); i++) {
studentCourses.get(i).setStatus("inactive");
}
}
}else {
studentCourses = new ArrayList<StudentCourse>();
}
studentCourses.add(e);
student.setStudentCourses(studentCourses);
daoStudent.save(student);
//Reseteando transaccion
transactionItem = new Transaction();
}