bugfixes, funktioniert jetzt mit testing, Kinderkrankheiten sind trotzdem da.

This commit is contained in:
root 2020-11-08 13:20:20 +01:00
parent effc24ddc1
commit 9fd5a35ac7
9 changed files with 127 additions and 127 deletions

6
.idea/vcs.xml Normal file
View file

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

View file

@ -6,7 +6,16 @@
</artifacts-to-build>
</component>
<component name="ChangeListManager">
<list default="true" id="20f6192e-712c-4901-ab50-abe79c149ecf" name="Default Changelist" comment="" />
<list default="true" id="20f6192e-712c-4901-ab50-abe79c149ecf" name="Default Changelist" comment="">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/out/artifacts/Autovermietung/Autovermietung.jar" beforeDir="false" afterPath="$PROJECT_DIR$/out/artifacts/Autovermietung/Autovermietung.jar" afterDir="false" />
<change beforePath="$PROJECT_DIR$/out/production/autovermietung-int/autovermietung/Main.class" beforeDir="false" afterPath="$PROJECT_DIR$/out/production/autovermietung-int/autovermietung/Main.class" afterDir="false" />
<change beforePath="$PROJECT_DIR$/out/production/autovermietung-int/autovermietung/helper/Database.class" beforeDir="false" afterPath="$PROJECT_DIR$/out/production/autovermietung-int/autovermietung/helper/Database.class" afterDir="false" />
<change beforePath="$PROJECT_DIR$/out/production/autovermietung-int/autovermietung/helper/Shop.class" beforeDir="false" afterPath="$PROJECT_DIR$/out/production/autovermietung-int/autovermietung/helper/Shop.class" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/autovermietung/Main.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/autovermietung/Main.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/autovermietung/helper/Database.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/autovermietung/helper/Database.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/autovermietung/helper/Shop.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/autovermietung/helper/Shop.java" afterDir="false" />
</list>
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -23,11 +32,11 @@
<splitter split-orientation="horizontal" split-proportion="0.48266166">
<split-first>
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
<file pinned="false" current-in-tab="true">
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/autovermietung/Main.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="770">
<caret line="95" column="63" selection-start-line="95" selection-start-column="63" selection-end-line="95" selection-end-column="63" />
<state relative-caret-position="702">
<caret line="89" column="66" selection-start-line="89" selection-start-column="66" selection-end-line="89" selection-end-column="66" />
<folding>
<element signature="imports" expanded="true" />
</folding>
@ -35,23 +44,11 @@
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/autovermietung/helper/Shop.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="770">
<caret line="158" column="34" selection-start-line="158" selection-start-column="34" selection-end-line="158" selection-end-column="34" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<file pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/src/autovermietung/helper/Database.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="260">
<caret line="150" lean-forward="true" selection-start-line="150" selection-end-line="150" />
<state relative-caret-position="391">
<caret line="87" selection-start-line="87" selection-end-line="87" />
<folding>
<element signature="imports" expanded="true" />
</folding>
@ -62,11 +59,11 @@
</leaf>
</split-first>
<split-second>
<leaf>
<file pinned="false" current-in-tab="true">
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/autovermietung/helper/Tastatur.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="986">
<state relative-caret-position="676">
<caret line="127" column="50" selection-start-line="127" selection-start-column="50" selection-end-line="127" selection-end-column="50" />
<folding>
<element signature="imports" expanded="true" />
@ -75,25 +72,23 @@
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/src/autovermietung/helper/Shop.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="2703">
<caret line="159" column="41" selection-start-line="159" selection-start-column="41" selection-end-line="159" selection-end-column="41" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/autovermietung/models/Pkw.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="532">
<state relative-caret-position="816">
<caret line="68" column="22" selection-start-line="68" selection-start-column="22" selection-end-line="68" selection-end-column="22" />
<folding>
<element signature="e#1099#1100#0" expanded="true" />
<element signature="e#1134#1135#0" expanded="true" />
<element signature="e#1190#1191#0" expanded="true" />
<element signature="e#1238#1239#0" expanded="true" />
<element signature="e#1582#1583#0" expanded="true" />
<element signature="e#1608#1609#0" expanded="true" />
<element signature="e#1643#1644#0" expanded="true" />
<element signature="e#1673#1674#0" expanded="true" />
<element signature="e#1700#1701#0" expanded="true" />
<element signature="e#1726#1727#0" expanded="true" />
<element signature="e#1761#1762#0" expanded="true" />
<element signature="e#1791#1792#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
@ -101,16 +96,8 @@
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/autovermietung/models/Kunde.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="935">
<state relative-caret-position="833">
<caret line="73" column="25" selection-start-line="73" selection-start-column="25" selection-end-line="73" selection-end-column="25" />
<folding>
<element signature="e#427#428#0" expanded="true" />
<element signature="e#453#454#0" expanded="true" />
<element signature="e#488#489#0" expanded="true" />
<element signature="e#518#519#0" expanded="true" />
<element signature="e#1232#1233#0" expanded="true" />
<element signature="e#1270#1271#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
@ -118,12 +105,8 @@
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/autovermietung/models/Modell.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="867">
<state relative-caret-position="833">
<caret line="73" column="29" selection-start-line="73" selection-start-column="29" selection-end-line="73" selection-end-column="29" />
<folding>
<element signature="e#1275#1276#0" expanded="true" />
<element signature="e#1317#1318#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
@ -139,6 +122,9 @@
</list>
</option>
</component>
<component name="Git.Settings">
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
</component>
<component name="HighlightingSettingsPerFile">
<setting file="file://$PROJECT_DIR$/src/autovermietung/helper/Database.java" root0="SKIP_INSPECTION" />
</component>
@ -161,9 +147,9 @@
<option value="$PROJECT_DIR$/src/autovermietung/models/Kunde.java" />
<option value="$PROJECT_DIR$/src/autovermietung/helper/Tastatur.java" />
<option value="$PROJECT_DIR$/src/autovermietung/models/Pkw.java" />
<option value="$PROJECT_DIR$/src/autovermietung/helper/Database.java" />
<option value="$PROJECT_DIR$/src/autovermietung/helper/Shop.java" />
<option value="$PROJECT_DIR$/src/autovermietung/Main.java" />
<option value="$PROJECT_DIR$/src/autovermietung/helper/Shop.java" />
<option value="$PROJECT_DIR$/src/autovermietung/helper/Database.java" />
</list>
</option>
</component>
@ -174,11 +160,13 @@
<option name="height" value="999" />
</component>
<component name="ProjectId" id="1jpLXsrDCTp0Xd4C5LNjJSceSTF" />
<component name="ProjectLevelVcsManager" settingsEditedManually="true" />
<component name="ProjectView">
<navigator proportions="" version="1">
<foldersAlwaysOnTop value="true" />
</navigator>
<panes>
<pane id="PackagesPane" />
<pane id="ProjectPane">
<subPane>
<expand>
@ -222,6 +210,13 @@
<item name="autovermietung" type="462c0819:PsiDirectoryNode" />
<item name="helper" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="autovermietung-int" type="b2602c69:ProjectViewProjectNode" />
<item name="autovermietung-int" type="462c0819:PsiDirectoryNode" />
<item name="src" type="462c0819:PsiDirectoryNode" />
<item name="autovermietung" type="462c0819:PsiDirectoryNode" />
<item name="models" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="autovermietung-int" type="b2602c69:ProjectViewProjectNode" />
<item name="External Libraries" type="cb654da1:ExternalLibrariesNode" />
@ -231,7 +226,6 @@
</subPane>
</pane>
<pane id="Scope" />
<pane id="PackagesPane" />
</panes>
</component>
<component name="PropertiesComponent">
@ -239,11 +233,12 @@
<property name="GenerateAntBuildDialog.enableUiFormCompile" value="true" />
<property name="GenerateAntBuildDialog.forceTargetJdk" value="true" />
<property name="GenerateAntBuildDialog.outputFileNameProperty" value="autovermietung" />
<property name="SHARE_PROJECT_CONFIGURATION_FILES" value="true" />
<property name="last_opened_file_path" value="$PROJECT_DIR$/database.properties" />
<property name="project.structure.last.edited" value="Artifacts" />
<property name="project.structure.proportion" value="0.15" />
<property name="project.structure.side.proportion" value="0.2" />
<property name="settings.editor.selected.configurable" value="preferences.lookFeel" />
<property name="settings.editor.selected.configurable" value="vcs.Git" />
</component>
<component name="RecentsManager">
<key name="MoveFile.RECENT_KEYS">
@ -311,7 +306,7 @@
<layout>
<window_info id="Favorites" order="0" sideWeight="0.50117373" side_tool="true" weight="0.15063593" />
<window_info id="Designer" order="1" />
<window_info content_ui="combo" id="Project" order="2" sideWeight="0.4988263" visible="true" weight="0.1518283" />
<window_info content_ui="combo" id="Project" order="2" sideWeight="0.4988263" visible="true" weight="0.15302067" />
<window_info id="Structure" order="3" sideWeight="0.5013123" side_tool="true" weight="0.15063593" />
<window_info anchor="bottom" id="Terminal" order="0" weight="0.32992125" />
<window_info anchor="bottom" id="Event Log" order="1" sideWeight="0.50039744" side_tool="true" weight="0.20866142" />
@ -441,87 +436,61 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/autovermietung/models/Pkw.java">
<entry file="file://$PROJECT_DIR$/src/autovermietung/helper/Tastatur.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="532">
<caret line="68" column="22" selection-start-line="68" selection-start-column="22" selection-end-line="68" selection-end-column="22" />
<folding>
<element signature="e#1099#1100#0" expanded="true" />
<element signature="e#1134#1135#0" expanded="true" />
<element signature="e#1190#1191#0" expanded="true" />
<element signature="e#1238#1239#0" expanded="true" />
<element signature="e#1582#1583#0" expanded="true" />
<element signature="e#1608#1609#0" expanded="true" />
<element signature="e#1643#1644#0" expanded="true" />
<element signature="e#1673#1674#0" expanded="true" />
<element signature="e#1700#1701#0" expanded="true" />
<element signature="e#1726#1727#0" expanded="true" />
<element signature="e#1761#1762#0" expanded="true" />
<element signature="e#1791#1792#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/autovermietung/helper/Database.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="260">
<caret line="150" lean-forward="true" selection-start-line="150" selection-end-line="150" />
<state relative-caret-position="676">
<caret line="127" column="50" selection-start-line="127" selection-start-column="50" selection-end-line="127" selection-end-column="50" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/autovermietung/models/Modell.java">
<entry file="file://$PROJECT_DIR$/src/autovermietung/models/Pkw.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="867">
<caret line="73" column="29" selection-start-line="73" selection-start-column="29" selection-end-line="73" selection-end-column="29" />
<folding>
<element signature="e#1275#1276#0" expanded="true" />
<element signature="e#1317#1318#0" expanded="true" />
</folding>
<state relative-caret-position="816">
<caret line="68" column="22" selection-start-line="68" selection-start-column="22" selection-end-line="68" selection-end-column="22" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/autovermietung/models/Kunde.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="935">
<state relative-caret-position="833">
<caret line="73" column="25" selection-start-line="73" selection-start-column="25" selection-end-line="73" selection-end-column="25" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/autovermietung/models/Modell.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="833">
<caret line="73" column="29" selection-start-line="73" selection-start-column="29" selection-end-line="73" selection-end-column="29" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/autovermietung/Main.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="702">
<caret line="89" column="66" selection-start-line="89" selection-start-column="66" selection-end-line="89" selection-end-column="66" />
<folding>
<element signature="e#427#428#0" expanded="true" />
<element signature="e#453#454#0" expanded="true" />
<element signature="e#488#489#0" expanded="true" />
<element signature="e#518#519#0" expanded="true" />
<element signature="e#1232#1233#0" expanded="true" />
<element signature="e#1270#1271#0" expanded="true" />
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/autovermietung/helper/Shop.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="770">
<caret line="158" column="34" selection-start-line="158" selection-start-column="34" selection-end-line="158" selection-end-column="34" />
<state relative-caret-position="2703">
<caret line="159" column="41" selection-start-line="159" selection-start-column="41" selection-end-line="159" selection-end-column="41" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/autovermietung/Main.java">
<entry file="file://$PROJECT_DIR$/src/autovermietung/helper/Database.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="770">
<caret line="95" column="63" selection-start-line="95" selection-start-column="63" selection-end-line="95" selection-end-column="63" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/autovermietung/helper/Tastatur.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="986">
<caret line="127" column="50" selection-start-line="127" selection-start-column="50" selection-end-line="127" selection-end-column="50" />
<state relative-caret-position="391">
<caret line="87" selection-start-line="87" selection-end-line="87" />
<folding>
<element signature="imports" expanded="true" />
</folding>

View file

@ -16,6 +16,7 @@ public class Main {
ArrayList<Modell> modelle;
ArrayList<Pkw> pkws;
int auswahl = 99;
int toDelete = 999;
do {
kunden = Database.liesKunden();
@ -41,9 +42,9 @@ public class Main {
break;
// Auto löschen aus der Datenbank
case 9:
auswahl = Shop.autoEntfernen(pkws, modelle, kunden);
Database.deletePkw(pkws.get(auswahl));
pkws.remove(auswahl);
toDelete = Shop.autoEntfernen(pkws, modelle, kunden);
Database.deletePkw(pkws.get(toDelete));
pkws.remove(toDelete);
break;
}
@ -59,7 +60,7 @@ public class Main {
switch (auswahl) {
// Erstellen eines Auto Modells
case 1:
Shop.modellErstellen(modelle);
modelle.add(Shop.modellErstellen(modelle));
break;
// Anzeigen aller Auto Modelle
case 2:
@ -68,9 +69,9 @@ public class Main {
break;
// Löschen eines Auto Modells
case 9:
auswahl = Shop.modellEntfernen(modelle);
Database.deleteModell(modelle.get(auswahl));
modelle.remove(auswahl);
toDelete = Shop.modellEntfernen(modelle);
Database.deleteModell(modelle.get(toDelete));
modelle.remove(toDelete);
break;
}
@ -86,7 +87,7 @@ public class Main {
switch (auswahl) {
// Erstellen eines neues Kunden
case 1:
Shop.kundeErstellen(kunden);
kunden.add(Shop.kundeErstellen(kunden));
break;
// Anzeigen aller eingetragenen Kunden
case 2:
@ -95,9 +96,9 @@ public class Main {
break;
// Löschen eines Kunden in der Datenbank
case 9:
auswahl = Shop.kundenEntfernen(kunden);
Database.deleteKunde(kunden.get(auswahl));
kunden.remove(auswahl);
toDelete = Shop.kundenEntfernen(kunden);
Database.deleteKunde(kunden.get(toDelete));
kunden.remove(toDelete);
}
// Updaten aller Kunden in der Kunden Liste.

View file

@ -84,7 +84,15 @@ public class Database {
int mnr = auto.getMnr();
int knr = auto.getKnr();
PreparedStatement updatePkw = conn.prepareStatement("REPLACE INTO pkw VALUES(\"" + kennzeichen + "\", \"" + erstzulassung + "\", " + tachostand + ", \"" + farbe + "\", \"" + ausleihdatum + "\", " + mnr + ", " + knr + ");");
String updatePkwSQL = "REPLACE INTO pkw VALUES(?, ?, ?, ?, ?, ?, ?);";
PreparedStatement updatePkw = conn.prepareStatement(updatePkwSQL);
updatePkw.setString(1, kennzeichen);
updatePkw.setDate(2, erstzulassung);
updatePkw.setInt(3, tachostand);
updatePkw.setString(4, farbe);
updatePkw.setDate(5, ausleihdatum);
updatePkw.setInt(6, mnr);
updatePkw.setInt(7, knr);
updatePkw.executeQuery();
conn.close();
@ -122,8 +130,15 @@ public class Database {
String telefon = kunde.getTelefon();
int personr = kunde.getPersonr();
PreparedStatement updateKunde = conn.prepareStatement("REPLACE INTO kunde VALUES(" + knr + ", " + vorname + ", " + nachname + ", " + anschrift + ", " + telefon + ", " + personr + ";");
updateKunde.executeQuery();
String updateKundeSQL = "REPLACE INTO kunde VALUES(?, ?, ?, ?, ?, ?);";
PreparedStatement updateKunde = conn.prepareStatement(updateKundeSQL);
updateKunde.setInt(1, knr);
updateKunde.setString(2, vorname);
updateKunde.setString(3, nachname);
updateKunde.setString(4, anschrift);
updateKunde.setString(5, telefon);
updateKunde.setInt(6, personr);
updateKunde.executeUpdate();
conn.close();
} catch(Exception e) {
@ -160,11 +175,21 @@ public class Database {
float kmpreis = modell.getKmpreis();
float pauschale = modell.getPauschale();
PreparedStatement updateModell = conn.prepareStatement("REPLACE INTO modell VALUES(" + mnr + ", " + modellname + ", " + hubraum + ", " + leistung + ", " + kmpreis + ", " + pauschale + ";");
updateModell.executeQuery();
String replaceModellSQL = "REPLACE INTO modell VALUES(?, ?, ?, ?, ?, ?);";
PreparedStatement updateModell = conn.prepareStatement(replaceModellSQL);
updateModell.setInt(1, mnr);
updateModell.setString(2, modellname);
updateModell.setInt(3, hubraum);
updateModell.setInt(4, leistung);
updateModell.setFloat(5, kmpreis);
updateModell.setFloat(6, pauschale);
updateModell.executeUpdate();
conn.close();
} catch(Exception e) {
if(e.equals("java.sql.SQLIntegrityConstraintViolationException")) {
System.out.println("Diese Aktion kann nicht augeführt werden, weil diese Modell in Benutzung ist.");
}
System.out.println(e);
}
}

View file

@ -4,7 +4,6 @@ import autovermietung.models.Kunde;
import autovermietung.models.Modell;
import autovermietung.models.Pkw;
import java.sql.Array;
import java.sql.Date;
import java.time.LocalDate;
import java.util.ArrayList;
@ -102,7 +101,7 @@ public class Shop {
System.out.print("Bitte die Farbe des Fahrzeugs angeben: ");
String f = Tastatur.liesString();
System.out.println("Bitte das Ausleihdatum angeben(YYYY-MM-DD oder heute): ");
System.out.print("Bitte das Ausleihdatum angeben(YYYY-MM-DD oder heute): ");
String aTemp = Tastatur.liesString();
Date a;
if(aTemp.equals("heute")) {