use of org.hl7.fhir.dstu3.model.Account in project Happourse_online_study_web by infiq2000.
the class CourseDetail method doGet.
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
int course_id = Integer.parseInt(request.getParameter("course_id"));
int uid = (int) request.getSession(false).getAttribute("uid");
int aid = (int) request.getSession(false).getAttribute("aid");
try {
/* Account ac = accUtil.getAccount(aid); */
Account acc = accUtil.getAccount(aid);
request.setAttribute("account", acc);
request.setAttribute("course_id", course_id);
} catch (SQLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
try {
Courses detailC = courseUtil.getCourseDetail(course_id);
request.setAttribute("course_detail", detailC);
String cate = insUtil.getCate(detailC.getCid());
request.setAttribute("cate", cate);
Instructor ins_info = insUtil.getIns_Info(detailC.getIns_id());
request.setAttribute("ins_info", ins_info);
List<Chapter> list_chapter = lecUtil.getChapterOfCourse(detailC.getCourses_id());
request.setAttribute("chapter", list_chapter);
RequestDispatcher dispatcher;
if (courseUtil.checkSignedCourse(course_id, uid) == null) {
dispatcher = request.getRequestDispatcher("/Course_detail.jsp");
} else {
dispatcher = request.getRequestDispatcher("/CourseSigned.jsp");
}
dispatcher.forward(request, response);
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
use of org.hl7.fhir.dstu3.model.Account in project Happourse_online_study_web by infiq2000.
the class AccountUtil method getAccount.
public Account getAccount(int aid) throws SQLException {
Connection myConn = null;
PreparedStatement myStmt = null;
ResultSet myRS = null;
try {
myConn = dataSource.getConnection();
String sql = "select * from account where aid = ?";
myStmt = myConn.prepareStatement(sql);
myStmt.setInt(1, aid);
myRS = myStmt.executeQuery();
Account acc = null;
if (myRS.next()) {
String userName = myRS.getString("userName");
String passWord = myRS.getString("passWord");
boolean type = myRS.getBoolean("type");
acc = new Account(aid, userName, passWord, type);
}
return acc;
} finally {
myConn.close();
}
}
use of org.hl7.fhir.dstu3.model.Account in project Happourse_online_study_web by infiq2000.
the class AccountUtil method validation.
public Account validation(String userName, String passWord) throws SQLException {
Connection myConn = null;
PreparedStatement myStmt = null;
ResultSet myRS = null;
try {
myConn = dataSource.getConnection();
String sql = "select * from account where userName = ? and password = ?";
myStmt = myConn.prepareStatement(sql);
myStmt.setString(1, userName);
myStmt.setString(2, passWord);
myRS = myStmt.executeQuery();
Account acc = null;
if (myRS.next()) {
int aid = myRS.getInt("aid");
boolean type = myRS.getBoolean("type");
acc = new Account(aid, userName, passWord, type);
}
return acc;
} finally {
myConn.close();
}
}
Aggregations