Search in sources :

Example 66 with Account

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();
    }
}
Also used : Account(Model.Account) SQLException(java.sql.SQLException) Instructor(Model.Instructor) Chapter(Model.Chapter) Courses(Model.Courses) RequestDispatcher(javax.servlet.RequestDispatcher)

Example 67 with Account

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();
    }
}
Also used : Account(Model.Account) Connection(java.sql.Connection) ResultSet(java.sql.ResultSet) PreparedStatement(java.sql.PreparedStatement)

Example 68 with Account

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();
    }
}
Also used : Account(Model.Account) Connection(java.sql.Connection) ResultSet(java.sql.ResultSet) PreparedStatement(java.sql.PreparedStatement)

Aggregations

Test (org.testng.annotations.Test)17 Patient (org.hl7.fhir.dstu3.model.Patient)10 ArrayList (java.util.ArrayList)8 Appointment (org.hl7.fhir.dstu3.model.Appointment)8 Account (org.sagebionetworks.bridge.models.accounts.Account)8 Complex (org.hl7.fhir.r4.utils.formats.Turtle.Complex)7 StatusMessage (org.sagebionetworks.bridge.models.StatusMessage)7 IOException (java.io.IOException)6 DateRangeResourceList (org.sagebionetworks.bridge.models.DateRangeResourceList)6 Account (com.google.api.services.adsense.v2.model.Account)5 JsonElement (com.google.gson.JsonElement)5 ProcedureRequest (org.hl7.fhir.dstu3.model.ProcedureRequest)5 Complex (org.hl7.fhir.dstu3.utils.formats.Turtle.Complex)5 HealthDataSubmission (org.sagebionetworks.bridge.models.healthdata.HealthDataSubmission)5 Account (Model.Account)4 File (java.io.File)4 FileInputStream (java.io.FileInputStream)4 FileOutputStream (java.io.FileOutputStream)4 Account (model.Account)4 ContactPoint (org.hl7.fhir.dstu3.model.ContactPoint)4