diff --git a/src/main/java/org/s4s/gui/views/WarenkorbView.java b/src/main/java/org/s4s/gui/views/WarenkorbView.java index 127a8c3f27a693d5699f1b7ecc7926e85250a24f..3964888cc5f2dbea8d035b9c72ec3fc8f1f15b93 100644 --- a/src/main/java/org/s4s/gui/views/WarenkorbView.java +++ b/src/main/java/org/s4s/gui/views/WarenkorbView.java @@ -13,9 +13,14 @@ import com.vaadin.ui.Panel; import com.vaadin.ui.Table; import com.vaadin.ui.UI; import com.vaadin.ui.VerticalLayout; +import java.sql.SQLException; import java.util.List; +import java.util.logging.Level; +import java.util.logging.Logger; +import org.s4s.exceptions.DAOException; import org.s4s.modell.dto.Product; import org.s4s.modell.dto.Warenkorb; +import org.s4s.process.control.TransactionControl; import org.s4s.services.util.Roles; import org.s4s.services.util.Views; @@ -90,8 +95,15 @@ public class WarenkorbView extends TemplateView { }); Button buyButton = new Button("Kaufen!"); - buyButton.addClickListener((event) -> { - + buyButton.addClickListener((Button.ClickEvent event) -> { + TransactionControl t = new TransactionControl(); + try { + t.createTransactions(); + } catch (DAOException ex) { + Logger.getLogger(WarenkorbView.class.getName()).log(Level.SEVERE, null, ex); + } catch (SQLException ex) { + Logger.getLogger(WarenkorbView.class.getName()).log(Level.SEVERE, null, ex); + } }); buttonLayout.addComponent(buyButton);