From f200d98df9493a3be3e8888be9688b3d4ec322f0 Mon Sep 17 00:00:00 2001 From: sknobl2s <sebastian.knoblauch@smail.inf.h-brs.de> Date: Mon, 19 Jun 2017 19:00:22 +0200 Subject: [PATCH] =?UTF-8?q?Transaction=20beim=20CLickEvent=20im=20Warenkor?= =?UTF-8?q?b=20hinzugef=C3=BCgt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/org/s4s/gui/views/WarenkorbView.java | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/s4s/gui/views/WarenkorbView.java b/src/main/java/org/s4s/gui/views/WarenkorbView.java index 127a8c3..3964888 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); -- GitLab