added missing functionality
This commit is contained in:
@@ -1,4 +1,7 @@
|
||||
package com.bib.essensbestellungsverwaltung;
|
||||
/*
|
||||
@author Malte Schulze Hobeling
|
||||
*/
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -116,7 +119,9 @@ public class ConsoleLib {
|
||||
System.out.print("Allergienummer: ");
|
||||
String allergies = sc.nextLine();
|
||||
String[] allergyData = allergies.split(",");
|
||||
FoodMgr.createFood(foodData,allergyData);
|
||||
if(FoodMgr.createFood(foodData,allergyData) < 1){
|
||||
System.out.println("Fehler");
|
||||
}
|
||||
}
|
||||
|
||||
public static long loginPrompt(){
|
||||
@@ -155,6 +160,17 @@ public class ConsoleLib {
|
||||
printConsole(Database.getTable(table));
|
||||
}
|
||||
|
||||
public static void deletePrompt(){
|
||||
Scanner sc = new Scanner(System.in);
|
||||
System.out.println("Löschen");
|
||||
System.out.print("Tabelle: ");
|
||||
String table = sc.nextLine();
|
||||
System.out.print("Id: ");
|
||||
long id = sc.nextLong();
|
||||
sc.nextLine();
|
||||
Database.delete(table,id);
|
||||
}
|
||||
|
||||
public static void printConsole(List<String> list){
|
||||
for (String entry : list) {
|
||||
System.out.println(entry);
|
||||
@@ -218,4 +234,32 @@ public class ConsoleLib {
|
||||
}
|
||||
printConsole(food);
|
||||
}
|
||||
|
||||
public static void createFood_selectionPrompt(){
|
||||
System.out.println("Essensauswahl");
|
||||
Scanner sc = new Scanner(System.in);
|
||||
String[] food_selectionData = new String[3];
|
||||
System.out.print("Kind ID: ");
|
||||
food_selectionData[0] = sc.nextLine();
|
||||
System.out.print("Datum: ");
|
||||
String date = sc.nextLine();
|
||||
String[] foodPlanParts = Database.select("food_plan", new String[]{"date"}, new String[]{date}).get(0).split(":");
|
||||
food_selectionData[1] = foodPlanParts[0];
|
||||
System.out.println("Hauptspeisen: ");
|
||||
System.out.println(Database.select("food",new String[]{"food"},new String[]{foodPlanParts[2]}).get(0));
|
||||
System.out.println(Database.select("food",new String[]{"food"},new String[]{foodPlanParts[3]}).get(0));
|
||||
System.out.print("Id: ");
|
||||
food_selectionData[2] = sc.nextLine();
|
||||
if(FoodMgr.createFood_selection(food_selectionData) < 1){
|
||||
System.out.println("Fehler");
|
||||
}
|
||||
System.out.println("Nachspeisen: ");
|
||||
System.out.println(Database.select("food",new String[]{"food"},new String[]{foodPlanParts[4]}).get(0));
|
||||
System.out.println(Database.select("food",new String[]{"food"},new String[]{foodPlanParts[5]}).get(0));
|
||||
System.out.print("Id: ");
|
||||
food_selectionData[2] = sc.nextLine();
|
||||
if(FoodMgr.createFood_selection(food_selectionData) < 1){
|
||||
System.out.println("Fehler");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user