@At @Ok("json") @AdaptBy(type = JsonAdaptor.class) public Object del( @Param("..") Store store, @Attr(scope = Scope.SESSION, value = "account") Account acc) { dao.delete(dao.fetch(Store.class, store.getId())); return store; }
public void delete(ActionEvent event) { ToolsTray bandeja = (ToolsTray) toolTable.getSelectionModel().getSelectedItem(); if (null != bandeja && null != bandeja.getId()) { Alert alert = new Alert(Alert.AlertType.CONFIRMATION); alert.setTitle("删除提醒"); alert.setHeaderText(null); alert.setContentText("确定删除:" + bandeja.getTrayName()); Optional<ButtonType> result = alert.showAndWait(); if (result.get() == ButtonType.OK) { dao.delete(ToolsTray.class, bandeja.getId()); tipsLabel.setText("删除成功:" + bandeja.getTrayName()); refresh(null); } } }
@At public Object reg(@Param("email") String email) { if (Strings.isBlank(email) || !Strings.isEmail(email)) { return Ajax.fail().setMsg("email is blank or invaild!"); } else { if (0 != dao.count(User.class, Cnd.where("email", "=", email))) { return Ajax.fail().setMsg("email is exist!"); } else { final User me = new User(); me.setEmail(email); String passwd = R.sg(12).next(); me.setPasswd(xMD5(passwd)); me.setNickName("_" + me.getNickName()); dao.insert(me); if (mailService.add2Queue(email, "推爸注册确认邮件", "Your password : "******"Fail to send comfig email!!"); } } } }