use of com.cas.sim.tis.entity.Library in project TeachingInSimulation by ScOrPiOzzy.
the class LibraryImportTest method importExcel.
private void importExcel(File source) {
String name = FileUtil.getFileName(source.getAbsolutePath());
Library library = new Library();
library.setName(name);
library.setNum(0);
library.setTime(100);
library.setType(0);
library.setCreator(1);
LibraryService libraryService = (LibraryService) libraryServiceFactory.getObject();
libraryService.save(library);
List<Library> librarys = libraryService.findAll();
library = librarys.get(librarys.size() - 1);
rid = library.getId();
List<Question> questions = new ArrayList<>();
if (!loadChoice(source, questions) || !loadJudgment(source, questions) || !loadBlank(source, questions) || !loadSubjective(source, questions)) {
return;
}
try {
SpringUtil.getBean(QuestionAction.class).addQuestions(rid, questions);
} catch (Exception e) {
e.printStackTrace();
}
}
use of com.cas.sim.tis.entity.Library in project TeachingInSimulation by ScOrPiOzzy.
the class LibrarySelectDialog method reload.
private void reload() {
List<Library> libraries = SpringUtil.getBean(LibraryAction.class).findLibraryByType((int) group.getSelectedToggle().getUserData(), search.getText());
JSONArray array = new JSONArray();
array.addAll(libraries);
table.setItems(array);
table.build();
}
use of com.cas.sim.tis.entity.Library in project TeachingInSimulation by ScOrPiOzzy.
the class PreviewQuestionPaper method initialize.
/**
* 界面初始化
*/
private void initialize() {
Library library = SpringUtil.getBean(LibraryAction.class).findLibraryByID(rid);
this.libName.setText(library.getName());
if (readonly) {
this.options.getChildren().removeAll(templateBtn, importBtn, exportBtn);
this.submits.getChildren().removeAll(practiceBtn, publishBtn);
} else {
if (!editable) {
this.options.getChildren().removeAll(templateBtn, importBtn, exportBtn);
}
int role = Session.get(Session.KEY_LOGIN_ROLE);
if (RoleConst.ADMIN == role) {
this.submits.getChildren().removeAll(practiceBtn, publishBtn);
showReference = true;
} else if (RoleConst.TEACHER == role) {
this.submits.getChildren().removeAll(practiceBtn);
showReference = true;
} else if (RoleConst.STUDENT == role) {
this.submits.getChildren().removeAll(publishBtn);
}
}
chart.setOnMouseMoved(e -> {
tip.setTranslateX(e.getX());
tip.setTranslateY(e.getY());
});
checkImportOrExport();
loadQuestions();
}
use of com.cas.sim.tis.entity.Library in project TeachingInSimulation by ScOrPiOzzy.
the class LibraryAction method deleteLibrary.
public void deleteLibrary(int id) {
LibraryService service = getService();
Library library = service.findById(id);
library.setDel(1);
library.setUpdater(Session.get(Session.KEY_LOGIN_ID));
service.update(library);
}
Aggregations