Search in sources :

Example 6 with LibraryPublish

use of com.cas.sim.tis.entity.LibraryPublish in project TeachingInSimulation by ScOrPiOzzy.

the class ExamMessageHandler method execute.

@Override
public void execute(Client client, ExamMessage m) throws Exception {
    int type = m.getType();
    if (ExamMessage.EXAM_START == type) {
        LibraryPublish publish = SpringUtil.getBean(LibraryPublishAction.class).findPublishById(m.getPid());
        Platform.runLater(() -> {
            Application.showView(ExamView.class);
            ExamController controller = SpringUtil.getBean(ExamController.class);
            controller.initialize(publish);
        });
    } else if (ExamMessage.EXAM_OVER == type) {
        Platform.runLater(() -> {
            ExamController controller = SpringUtil.getBean(ExamController.class);
            if (m.getPid() == controller.getLibraryPublish().getId()) {
                controller.submit(true);
            }
        });
    }
}
Also used : LibraryPublishAction(com.cas.sim.tis.action.LibraryPublishAction) ExamController(com.cas.sim.tis.view.controller.ExamController) LibraryPublish(com.cas.sim.tis.entity.LibraryPublish)

Example 7 with LibraryPublish

use of com.cas.sim.tis.entity.LibraryPublish in project TeachingInSimulation by ScOrPiOzzy.

the class PreviewQuestionPaper method practice.

@FXML
private void practice() {
    int id = SpringUtil.getBean(LibraryPublishAction.class).practiceLibraryByStudent(rid);
    LibraryPublish publish = SpringUtil.getBean(LibraryPublishAction.class).findPublishById(id);
    Application.showView(ExamView.class);
    ExamController controller = SpringUtil.getBean(ExamController.class);
    controller.initialize(publish);
}
Also used : LibraryPublishAction(com.cas.sim.tis.action.LibraryPublishAction) ExamController(com.cas.sim.tis.view.controller.ExamController) LibraryPublish(com.cas.sim.tis.entity.LibraryPublish) FXML(javafx.fxml.FXML)

Example 8 with LibraryPublish

use of com.cas.sim.tis.entity.LibraryPublish in project TeachingInSimulation by ScOrPiOzzy.

the class LibraryPublishAction method practiceLibraryByStudent.

public int practiceLibraryByStudent(int rid) {
    LibraryPublish publish = new LibraryPublish();
    publish.setLibraryId(rid);
    publish.setCreator(Session.get(Session.KEY_LOGIN_ID));
    publish.setType(LibraryPublishType.PRACTICE.getType());
    return getService().practiceLibraryByStudent(publish);
}
Also used : LibraryPublish(com.cas.sim.tis.entity.LibraryPublish)

Aggregations

LibraryPublish (com.cas.sim.tis.entity.LibraryPublish)8 LibraryPublishAction (com.cas.sim.tis.action.LibraryPublishAction)4 ExamController (com.cas.sim.tis.view.controller.ExamController)2 LibraryAnswer (com.cas.sim.tis.entity.LibraryAnswer)1 LibraryRecordMapper (com.cas.sim.tis.mapper.LibraryRecordMapper)1 HostedConnection (com.jme3.network.HostedConnection)1 ArrayList (java.util.ArrayList)1 FXML (javafx.fxml.FXML)1 DataSourceTransactionManager (org.springframework.jdbc.datasource.DataSourceTransactionManager)1 TransactionStatus (org.springframework.transaction.TransactionStatus)1 DefaultTransactionDefinition (org.springframework.transaction.support.DefaultTransactionDefinition)1 Condition (tk.mybatis.mapper.entity.Condition)1 Criteria (tk.mybatis.mapper.entity.Example.Criteria)1