Asiakas luokka muokattu, asiakashallinta muokattu, asiakasikkunaan lisätty laskutustiedot välilehti

Signed-off-by: laurimaaninka <lauri.maaninka@gmail.com>
This commit is contained in:
2026-04-12 22:31:21 +03:00
parent fac9334688
commit 6601a588c2
7 changed files with 232 additions and 116 deletions
@@ -38,14 +38,16 @@ public class Tietokanta {
handleException(e);
}
//Lisää laskutustietokenttä Asiakkaat tauluun
try (Connection conn = haeYhteys()) {
Statement stmt = conn.createStatement();
stmt.execute("alter table asiakkaat add column laskutustieto TEXT");
}
catch (SQLException e) {
if (!e.getMessage().contains("duplicate column name: laskutustieto")) {
handleException(e);
//Lisää laskutustiedot asiakastauluun
String[] sarakkeet = {"laskutusosoite", "yhteyshenkilönNimi", "yhteyshenkilönPuhelinnumero", "yhteyshenkilönSähköposti"};
for (String sarake : sarakkeet) {
try (Connection conn = haeYhteys()) {
PreparedStatement stmt = conn.prepareStatement("alter table asiakkaat add column " + sarake + " varchar(255)");
stmt.execute();
} catch (SQLException e) {
if (!e.getMessage().contains("duplicate column name")) {
handleException(e);
}
}
}
}