From c46eff1dda966aeb084684ea1422d29635d53fd7 Mon Sep 17 00:00:00 2001 From: Reshad Meher Date: Mon, 6 Feb 2023 03:23:27 +0100 Subject: [PATCH] NutzerEinstellung: passwort akuelliseren, Adressse aktuelliseren --- .idea/workspace.xml | 23 ++- database.db | Bin 94208 -> 94208 bytes .../AccountMgr.java | 28 +++ .../ParentController.java | 72 +++++++ .../SettingsController.java | 144 +++++++++++++ .../StartViewApplication.java | 13 +- .../bib/essensbestellungsverwaltung/User.java | 3 + .../child-view.fxml | 147 ++++++-------- .../hello-view.fxml | 30 --- .../parentMenue-view.fxml | 128 +++++++----- .../settingsMenue.fxml | 189 +++++++++++++++++- 11 files changed, 591 insertions(+), 186 deletions(-) create mode 100644 src/main/java/com/bib/essensbestellungsverwaltung/SettingsController.java delete mode 100644 src/main/resources/com/bib/essensbestellungsverwaltung/hello-view.fxml diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 2a3281e..7a44909 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -5,8 +5,17 @@ - + + + + + + + + + + @@ -125,6 +141,7 @@ - \ No newline at end of file diff --git a/database.db b/database.db index 84c0b260b96213dc7c66bce3a5f7f90605c2177e..b44a0a6ccaaf1846f8124c289ca72d8ffb515a22 100644 GIT binary patch delta 202 zcmZp8z}oPDb%Hdb*+dy585_j~i&EoqS^Z62LfrkcObe6T z3(}0svmJxXQj3DZGb2sH{fvssJStPQ!(H5+JuBSPZS^ukOCv3U-7TFnjH-wOLY01HMt A8~^|S delta 83 zcmV-Z0IdIj;01u-1&|v7G?5%b0W`5-qz?=P4}$;?C9vx6Uja0~ 0){ + alert.setTitle("Passwort"); + alert.setHeaderText("Ihre Passwort erfolgreich geändert"); + alert.showAndWait(); + } + else { + alert.setTitle("Passwort"); + alert.setHeaderText("nei"); + alert.showAndWait(); + } + } + + tfOldPassword.setText(""); + tfNewPassword.setText(""); + tfConfirmNewPasword.setText(""); + } + else { + if(oldPassword.isEmpty()){ + alert = new Alert(Alert.AlertType.WARNING); + alert.setTitle("Passwort"); + alert.setHeaderText("Ihre aktuelles Passwort ist leer."); + alert.showAndWait(); + }else if(newPassword.isEmpty()){ + alert = new Alert(Alert.AlertType.WARNING); + alert.setTitle("Passwort"); + alert.setHeaderText("Ihre neues Passwort ist leer."); + alert.showAndWait(); + }if(confirmNewPassword.isEmpty()){ + alert = new Alert(Alert.AlertType.WARNING); + alert.setTitle("Passwort"); + alert.setHeaderText("Ihre neue Passwort Bestätigung ist leer."); + alert.showAndWait(); + }else{ + alert = new Alert(Alert.AlertType.WARNING); + alert.setTitle("Passwort"); + alert.setHeaderText("Ihre Passwort wurde nicht geändert"); + alert.showAndWait(); + } + + } + } + + @FXML + private void onChangAdressClick(){ + String postCode = tfPostCode.getText(); + String street = tfStreet.getText(); + String city = tfCity.getText(); + String housNumber = tfHousNumber.getText(); + if (!postCode.isEmpty() && !street.isEmpty() && !city.isEmpty() && !housNumber.isEmpty()) { + Address userAdress = new Address(street,housNumber,postCode,city); + long UpdateUserAdress = AccountMgr.updateAdreess(userAdress); + if (UpdateUserAdress > 0) { + alert.setTitle("Adresse"); + alert.setHeaderText("Ihre Adresse erfolgreich geändert"); + alert.showAndWait(); + + tfPostCode.setText(""); + tfStreet.setText(""); + tfCity.setText(""); + tfHousNumber.setText(""); + } + + }else { + if (postCode.isEmpty()) { + alert = new Alert(Alert.AlertType.WARNING); + alert.setTitle("Adresse"); + alert.setHeaderText("Postleitzahl ist leer."); + alert.showAndWait(); + } else if (street.isEmpty()) { + alert = new Alert(Alert.AlertType.WARNING); + alert.setTitle("Adresse"); + alert.setHeaderText("Straß ist leer."); + alert.showAndWait(); + } else if (city.isEmpty()) { + alert = new Alert(Alert.AlertType.WARNING); + alert.setTitle("Adresse"); + alert.setHeaderText("Statd ist leer."); + alert.showAndWait(); + } else if (housNumber.isEmpty()) { + alert = new Alert(Alert.AlertType.WARNING); + alert.setTitle("Adresse"); + alert.setHeaderText("Hausnumer ist leer."); + alert.showAndWait(); + } else { + alert = new Alert(Alert.AlertType.WARNING); + alert.setTitle("Adresse"); + alert.setHeaderText("Ihre Adresse wurde nicht geändert"); + alert.showAndWait(); + } + } + } + @FXML + private void onLogOutBtClick() 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 81c233a..d5dbe03 100644 --- a/src/main/java/com/bib/essensbestellungsverwaltung/StartViewApplication.java +++ b/src/main/java/com/bib/essensbestellungsverwaltung/StartViewApplication.java @@ -7,6 +7,7 @@ package com.bib.essensbestellungsverwaltung; import javafx.application.Application; import javafx.fxml.FXMLLoader; +import javafx.scene.Parent; import javafx.scene.Scene; import javafx.stage.Stage; @@ -14,10 +15,12 @@ import java.io.IOException; public class StartViewApplication extends Application { public static Stage primary; + public static boolean firstLaunch; @Override public void start(Stage stage) throws IOException { - FXMLLoader fxmlLoader = new FXMLLoader(StartViewApplication.class.getResource("login-view.fxml")); - Scene scene = new Scene(fxmlLoader.load(), 950,700); + //FXMLLoader fxmlLoader = new FXMLLoader(StartViewApplication.class.getResource((firstLaunch) ? "signUp-view.fxml" : "login-view.fxml")); + FXMLLoader fxmlLoader = new FXMLLoader(StartViewApplication.class.getResource((firstLaunch) ? "settingsMenue.fxml" : "settingsMenue.fxml")); + Scene scene = new Scene(fxmlLoader.load(), 1220, 790); primary = stage; stage.setTitle("Essen Bestellung im Kindergarten"); stage.setScene(scene); @@ -25,6 +28,7 @@ public class StartViewApplication extends Application { } public static void main(String[] args) { + firstLaunch = Database.init(); Database.init(); Database.createDb(); Database.fillDb(); @@ -32,4 +36,9 @@ public class StartViewApplication extends Application { //Database.deleteSample(); launch(); } + + public static void changeScene(String scene) throws IOException{ + Parent p = FXMLLoader.load(StartViewApplication.class.getResource(scene)); + primary.getScene().setRoot(p); + } } \ No newline at end of file diff --git a/src/main/java/com/bib/essensbestellungsverwaltung/User.java b/src/main/java/com/bib/essensbestellungsverwaltung/User.java index fb89351..2aea7c9 100644 --- a/src/main/java/com/bib/essensbestellungsverwaltung/User.java +++ b/src/main/java/com/bib/essensbestellungsverwaltung/User.java @@ -28,6 +28,9 @@ public class User { this.email = email; this.address = address; } + public User (String password){ + this.password = password; + } public long getId() { return id; diff --git a/src/main/resources/com/bib/essensbestellungsverwaltung/child-view.fxml b/src/main/resources/com/bib/essensbestellungsverwaltung/child-view.fxml index 1023f4f..40a229d 100644 --- a/src/main/resources/com/bib/essensbestellungsverwaltung/child-view.fxml +++ b/src/main/resources/com/bib/essensbestellungsverwaltung/child-view.fxml @@ -2,9 +2,9 @@ - - - + + + @@ -13,88 +13,63 @@ - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - + + + - - - - - + + + - - - - - + + + + - - + + + + + + + + + - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +