Ejemplo n.º 1
0
  /** Return the book */
  public void closeBookOrder() {
    try {

      bookOrderItemsService.closeBookOrder(currentBookOrderId);

      initDiscipleCurrentBookOrders();
    } catch (Exception e) {
      e.printStackTrace();
      FacesContext.getCurrentInstance()
          .addMessage(
              null, new FacesMessage(FacesMessage.SEVERITY_ERROR, "Error: ", e.getMessage()));
    }
  }
Ejemplo n.º 2
0
  public List<BookOrder> DiscipleCurrentBookOrders() {

    try {
      return bookOrderItemsService.getAllEntities();
    } catch (Exception e) {
      e.printStackTrace();
      FacesContext.getCurrentInstance()
          .addMessage(
              null, new FacesMessage(FacesMessage.SEVERITY_ERROR, "Error: ", e.getMessage()));
    }

    return null;
  }
Ejemplo n.º 3
0
  /**
   * Save new order
   *
   * @return
   */
  public String addNewBookOrder() {
    try {

      this.newBookOrder.setDisciple(selectedDisciple);
      bookOrderItemsService.addNewBookOrder(this.newBookOrder);

      this.newBookOrder = new BookOrder(); // После добавления создаем
      // новый
      initDiscipleCurrentBookOrders();

    } catch (Exception e) {
      e.printStackTrace();
      FacesContext.getCurrentInstance()
          .addMessage(
              null, new FacesMessage(FacesMessage.SEVERITY_ERROR, "Error: ", e.getMessage()));
    }
    return null;
  }
Ejemplo n.º 4
0
  @Transactional
  public void initDiscipleCurrentBookOrders() {

    if (this.selectedDisciple == null) return;

    try {
      this.discipleCurrentBookOrders =
          bookOrderItemsService.findByDiscipleActiv(this.selectedDisciple);

      for (BookOrder bo : this.discipleCurrentBookOrders) { // Lazy init
        if (bo.getItems() != null) bo.getItems().size();
      }

    } catch (Exception e) {
      e.printStackTrace();
      FacesContext.getCurrentInstance()
          .addMessage(
              null, new FacesMessage(FacesMessage.SEVERITY_ERROR, "Error: ", e.getMessage()));
    }
  }