diff --git a/src/main/java/com/bib/essensbestellungsverwaltung/Address.java b/src/main/java/com/bib/essensbestellungsverwaltung/Address.java index 641330d..eaf6bf2 100644 --- a/src/main/java/com/bib/essensbestellungsverwaltung/Address.java +++ b/src/main/java/com/bib/essensbestellungsverwaltung/Address.java @@ -44,4 +44,5 @@ public class Address { this.plz = plz; this.city = city; } + } diff --git a/src/main/java/com/bib/essensbestellungsverwaltung/Allergy.java b/src/main/java/com/bib/essensbestellungsverwaltung/Allergy.java index 77518be..dbc1adf 100644 --- a/src/main/java/com/bib/essensbestellungsverwaltung/Allergy.java +++ b/src/main/java/com/bib/essensbestellungsverwaltung/Allergy.java @@ -25,4 +25,5 @@ public class Allergy { public String getHandle() { return handle; } + } diff --git a/src/main/java/com/bib/essensbestellungsverwaltung/FoodType.java b/src/main/java/com/bib/essensbestellungsverwaltung/FoodType.java index be7ca6a..51d549b 100644 --- a/src/main/java/com/bib/essensbestellungsverwaltung/FoodType.java +++ b/src/main/java/com/bib/essensbestellungsverwaltung/FoodType.java @@ -19,4 +19,5 @@ public class FoodType { public String getName() { return name; } + } diff --git a/src/main/java/com/bib/essensbestellungsverwaltung/SingUpController.java b/src/main/java/com/bib/essensbestellungsverwaltung/SingUpController.java index f6a5b6f..0de5d8f 100644 --- a/src/main/java/com/bib/essensbestellungsverwaltung/SingUpController.java +++ b/src/main/java/com/bib/essensbestellungsverwaltung/SingUpController.java @@ -1,11 +1,95 @@ package com.bib.essensbestellungsverwaltung; +import javafx.fxml.FXML; +import javafx.fxml.FXMLLoader; +import javafx.scene.Scene; +import javafx.scene.control.Alert; +import javafx.scene.control.PasswordField; +import javafx.scene.control.TextField; -import javafx.event.ActionEvent; +import java.io.IOException; public class SingUpController { - public void onKontoErstellenBtClick(ActionEvent actionEvent) { + @FXML + private TextField tfLastName; + @FXML + private TextField tfFirstName; + @FXML + private TextField tfEmail; + @FXML + private PasswordField pfPassword; + @FXML + private TextField tfPostCode; + @FXML + private TextField tfCity; + + @FXML + private TextField tfStreet; + @FXML + private TextField tfHousNumber; + @FXML + private void onKontoErstellenBtClick(){ + String lastName = tfLastName.getText(); + String firstNanme = tfFirstName.getText(); + String email = tfEmail.getText(); + String password = pfPassword.getText(); + String postCode = tfPostCode.getText(); + String city = tfCity.getText(); + String street = tfStreet.getText(); + String housNumber = tfHousNumber.getText(); + Alert alert; + if(lastName.isEmpty() || firstNanme.isEmpty() || email.isEmpty() || password.isEmpty() || postCode.isEmpty() || + city.isEmpty() || street.isEmpty() || housNumber.isEmpty()){ + + if(lastName.isEmpty()){ + alert = new Alert(Alert.AlertType.ERROR," Die Eingabefeld 'Name' ist leer."); + alert.showAndWait(); + } else if (firstNanme.isEmpty()) { + alert = new Alert(Alert.AlertType.ERROR," Die Eingabefeld 'Vorname' ist leer."); + alert.showAndWait(); + } else if (email.isEmpty()) { + alert = new Alert(Alert.AlertType.ERROR," Die Eingabefeld 'E-Mail' ist leer."); + alert.showAndWait(); + } else if (password.isEmpty()) { + alert = new Alert(Alert.AlertType.ERROR," Die Eingabefeld 'Passwort' ist leer."); + alert.showAndWait(); + } else if (postCode.isEmpty()) { + alert = new Alert(Alert.AlertType.ERROR," Die Eingabefeld 'Postleitzahl' ist leer."); + alert.showAndWait(); + } else if (city.isEmpty()) { + alert = new Alert(Alert.AlertType.ERROR," Die Eingabefeld 'Stadt' ist leer."); + alert.showAndWait(); + } else if (street.isEmpty()) { + alert = new Alert(Alert.AlertType.ERROR," Die Eingabefeld 'Straße' ist leer."); + alert.showAndWait(); + }else { + alert = new Alert(Alert.AlertType.ERROR," Die Eingabefeld 'Hausnummer' ist leer."); + alert.showAndWait(); + } + + }else { + Address newAdresse = new Address(street,housNumber,postCode,city); + User newUser = new User(lastName,firstNanme,password,email,newAdresse); + long creatNewUser = AccountMgr.createUser(newUser); + if (creatNewUser > 0){ + alert = new Alert(Alert.AlertType.CONFIRMATION,"Ihrer Daten wurde gespeichert."); + alert.showAndWait(); + } + tfLastName.setText(""); + tfFirstName.setText(""); + tfEmail.setText(""); + pfPassword.setText(""); + tfPostCode.setText(""); + tfCity.setText(""); + tfStreet.setText(""); + tfHousNumber.setText(""); + } + } - public void onAnmeldenBtClick(ActionEvent actionEvent) { + @FXML + private void onAnmeldenBtClick() throws IOException { + FXMLLoader fxmlLoader = new FXMLLoader(StartViewApplication.class.getResource("login-view.fxml")); + Scene scene = new Scene(fxmlLoader.load(), 950,700); + StartViewApplication.primary.setScene(scene); } } diff --git a/src/main/java/com/bib/essensbestellungsverwaltung/StartViewApplication.java b/src/main/java/com/bib/essensbestellungsverwaltung/StartViewApplication.java index 911705f..5f26aac 100644 --- a/src/main/java/com/bib/essensbestellungsverwaltung/StartViewApplication.java +++ b/src/main/java/com/bib/essensbestellungsverwaltung/StartViewApplication.java @@ -2,6 +2,7 @@ * @autor: Reshad Meher * Fenstergrößer * Fenstertitle + * Parent Root */ package com.bib.essensbestellungsverwaltung; diff --git a/src/main/resources/com/bib/essensbestellungsverwaltung/deleteChild-view.fxml b/src/main/resources/com/bib/essensbestellungsverwaltung/deleteChild-view.fxml index 4f1d8c4..b14b2fa 100644 --- a/src/main/resources/com/bib/essensbestellungsverwaltung/deleteChild-view.fxml +++ b/src/main/resources/com/bib/essensbestellungsverwaltung/deleteChild-view.fxml @@ -9,18 +9,19 @@ - - - - - - - - - - - - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +