most Objects done
This commit is contained in:
@@ -6,9 +6,8 @@ package com.bib.essensbestellungsverwaltung;
|
||||
import java.util.Scanner;
|
||||
|
||||
public class ConsoleMain {
|
||||
static long currentUserId = -1;
|
||||
static boolean isWorker = false;
|
||||
static boolean isParent = false;
|
||||
static User currentUser = null;
|
||||
static boolean running = true;
|
||||
public static void main(String[] args) {
|
||||
boolean firstRun = Database.init();
|
||||
if(firstRun){
|
||||
@@ -16,15 +15,14 @@ public class ConsoleMain {
|
||||
Database.fillDb();
|
||||
ConsoleLib.createWorkerPrompt();
|
||||
}
|
||||
while (true){
|
||||
if(currentUserId == -2){
|
||||
break;
|
||||
}else if(currentUserId < 0){
|
||||
AccountMgr.getPriceFromDb();
|
||||
while (running){
|
||||
if(currentUser == null){
|
||||
defaultMenu();
|
||||
}else{
|
||||
if(isWorker){
|
||||
if(currentUser.getClass().getSimpleName().equals("Worker")){
|
||||
adminMenu();
|
||||
}else if(isParent){
|
||||
}else if(currentUser.getClass().getSimpleName().equals("Parent")){
|
||||
parentMenu();
|
||||
}
|
||||
}
|
||||
@@ -41,11 +39,9 @@ public class ConsoleMain {
|
||||
Scanner sc = new Scanner(System.in);
|
||||
String selection = sc.nextLine();
|
||||
switch (selection) {
|
||||
case "0" -> currentUserId = -2;
|
||||
case "0" -> running = false;
|
||||
case "1" -> {
|
||||
currentUserId = ConsoleLib.loginPrompt();
|
||||
isWorker = AccountMgr.isWorker(String.valueOf(currentUserId));
|
||||
isParent = AccountMgr.isParent(String.valueOf(currentUserId));
|
||||
currentUser = ConsoleLib.loginPrompt();
|
||||
}
|
||||
case "2" -> ConsoleLib.showFood_planPrompt();
|
||||
case "3" -> ConsoleLib.createParentPrompt();
|
||||
@@ -74,14 +70,12 @@ public class ConsoleMain {
|
||||
String selection = sc.nextLine();
|
||||
switch (selection) {
|
||||
case "0" -> {
|
||||
currentUserId = -1;
|
||||
isWorker = false;
|
||||
isParent = false;
|
||||
currentUser = null;
|
||||
}
|
||||
case "1" -> ConsoleLib.createWorkerPrompt();
|
||||
case "2" -> ConsoleLib.createParentPrompt();
|
||||
case "3" -> ConsoleLib.createChildPrompt(String.valueOf(currentUserId));
|
||||
case "4" -> ConsoleLib.matchParentChildPrompt(String.valueOf(currentUserId));
|
||||
case "3" -> ConsoleLib.createChildPrompt(String.valueOf(currentUser.getId()));
|
||||
case "4" -> ConsoleLib.matchParentChildPrompt(String.valueOf(currentUser.getId()));
|
||||
case "5" -> ConsoleLib.createFoodPrompt();
|
||||
case "6" -> ConsoleLib.createFood_planPrompt();
|
||||
case "7" -> ConsoleLib.showFood_planPrompt();
|
||||
@@ -107,11 +101,9 @@ public class ConsoleMain {
|
||||
String selection = sc.nextLine();
|
||||
switch (selection) {
|
||||
case "0" -> {
|
||||
currentUserId = -1;
|
||||
isWorker = false;
|
||||
isParent = false;
|
||||
currentUser = null;
|
||||
}
|
||||
case "3" -> ConsoleLib.createChildPrompt(String.valueOf(currentUserId));
|
||||
case "3" -> ConsoleLib.createChildPrompt(String.valueOf(currentUser.getId()));
|
||||
case "6" -> ConsoleLib.tablePrompt();
|
||||
case "7" -> ConsoleLib.showFood_planPrompt();
|
||||
case "8" -> ConsoleLib.createFood_selectionPrompt();
|
||||
|
Reference in New Issue
Block a user