Académique Documents
Professionnel Documents
Culture Documents
CASE 2
CASE 3
CASE 4
CASE 5
CASE 6
CASE 7
CASE 8
CASE 9
CASE 10
CASE11
CODES
LOGIN.java
LOGIN_PANEL METHODS
BUTTON_LOGIN
try { void Select(String query) throws SQLException {
Select("Select * from Employees where Firstname ||' '|| Lastname='" + conn = null;
username.getModel().getSelectedItem().toString().trim()+ "' and AccountPassword ='" stmt = null;
+ password.getText().trim() + "'"); rs = null;
if(rs.next()==true){ conn = DriverManager.getConnection(URL, null, null);
JOptionPane.showMessageDialog(null, "Logged in Successfully!"); stmt = conn.createStatement();
if(rs.getString("Position").equals("Admin") || rs.getString("Position").equals("Manager")){ rs = stmt.executeQuery(query);
Main.admin=true; }
} void insertt(String query) throws SQLException{
Main.cashier=username.getModel().getSelectedItem().toString(); conn = null;
Main.address=rs.getString("Address"); stmt = null;
Main c = new Main(); rs = null;
c.setVisible(true); conn = DriverManager.getConnection(URL, null, null);
this.hide(); stmt = conn.createStatement();
}else{ i= stmt.executeUpdate(query);
JOptionPane.showMessageDialog(null, "Logged in ERROR!"); }
}
CloseConn(); void CloseConn() throws SQLException {
rs.close();
} stmt.close();
catch (HeadlessException e){ conn.close();
} }
catch (SQLException ex) {
Logger.getLogger(LogIn.class.getName()).log(Level.SEVERE, null, ex);
}
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, Logger.getLogger(Main.class.getName()).log(Level.SEVERE,
null, ex); null, ex);
} }
};
} else { }
btnsel.setEnabled(true);
txtsearch.setEnabled(true);
btnsearch.setEnabled(true);
lstprod.setEnabled(true);
a = true;
transno = +1;
try {
NewTrans();
} catch (SQLException ex) {
Logger.getLogger(Main.class.getName()).log(Level.SEVERE,
null, ex);
}
btnok.setText("CASH PAYMENT");
}
}