From d29481aa978accf8e3bbe9fe38ba59c80cd0e932 Mon Sep 17 00:00:00 2001 From: divassahu Date: Sat, 5 Nov 2022 18:39:24 +0530 Subject: [PATCH] project updated --- AddMoneyClient.java | 199 -------- ChangePassword.java | 153 ------ ClientInformation.java | 409 ---------------- ClientInformationAdvisor.java | 227 --------- ClientInformationEdit.java | 440 ------------------ CreateAccount.java | 251 ---------- DBConnector.java | 19 - GenerateReport.java | 31 -- GlobalVariable.java | 102 ---- GlobalVariableExternalRecipient.java | 65 --- GlobalVariableOfficeAdvisorEmail.java | 23 - Login.java | 215 --------- Manager1.java | 260 ----------- New Text Document.txt | 1 - OfficeAdvisorClientInformation.java | 301 ------------ OfficeAdvisorTransaction.java | 115 ----- OnlineBanking/.classpath | 11 + OnlineBanking/.gitignore | 1 + OnlineBanking/.project | 17 + .../org.eclipse.core.resources.prefs | 2 + .../.settings/org.eclipse.jdt.core.prefs | 14 + OnlineBanking/src/Accounts/Access.java | 163 +++++++ OnlineBanking/src/BankingDao/BankingSys.java | 19 + .../src/BankingDao/BankingSysImp.java | 348 ++++++++++++++ OnlineBanking/src/CusDetail/Customer.java | 55 +++ OnlineBanking/src/Dbc/Connections.java | 31 ++ README.md | 2 - Transaction.java | 164 ------- TransferMoney.java | 394 ---------------- democombo.java | 77 --- dummy.txt | 0 officeAdvisor.java | 119 ----- 32 files changed, 661 insertions(+), 3567 deletions(-) delete mode 100644 AddMoneyClient.java delete mode 100644 ChangePassword.java delete mode 100644 ClientInformation.java delete mode 100644 ClientInformationAdvisor.java delete mode 100644 ClientInformationEdit.java delete mode 100644 CreateAccount.java delete mode 100644 DBConnector.java delete mode 100644 GenerateReport.java delete mode 100644 GlobalVariable.java delete mode 100644 GlobalVariableExternalRecipient.java delete mode 100644 GlobalVariableOfficeAdvisorEmail.java delete mode 100644 Login.java delete mode 100644 Manager1.java delete mode 100644 New Text Document.txt delete mode 100644 OfficeAdvisorClientInformation.java delete mode 100644 OfficeAdvisorTransaction.java create mode 100644 OnlineBanking/.classpath create mode 100644 OnlineBanking/.gitignore create mode 100644 OnlineBanking/.project create mode 100644 OnlineBanking/.settings/org.eclipse.core.resources.prefs create mode 100644 OnlineBanking/.settings/org.eclipse.jdt.core.prefs create mode 100644 OnlineBanking/src/Accounts/Access.java create mode 100644 OnlineBanking/src/BankingDao/BankingSys.java create mode 100644 OnlineBanking/src/BankingDao/BankingSysImp.java create mode 100644 OnlineBanking/src/CusDetail/Customer.java create mode 100644 OnlineBanking/src/Dbc/Connections.java delete mode 100644 README.md delete mode 100644 Transaction.java delete mode 100644 TransferMoney.java delete mode 100644 democombo.java delete mode 100644 dummy.txt delete mode 100644 officeAdvisor.java diff --git a/AddMoneyClient.java b/AddMoneyClient.java deleted file mode 100644 index 51604e9..0000000 --- a/AddMoneyClient.java +++ /dev/null @@ -1,199 +0,0 @@ -package bankingsystemswing; - -import java.awt.EventQueue; - -import javax.swing.JFrame; -import javax.swing.JLabel; -import javax.swing.JOptionPane; - -import java.awt.Font; -import javax.swing.JTextField; -import javax.swing.JButton; -import java.awt.event.ActionListener; -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.awt.event.ActionEvent; - -public class AddMoneyClient { - - private JFrame frame; - private JTextField textField; - - /** - * Launch the application. - */ - public static void main(String[] args) { - EventQueue.invokeLater(new Runnable() { - public void run() { - try { - AddMoneyClient window = new AddMoneyClient(); - window.frame.setVisible(true); - } catch (Exception e) { - e.printStackTrace(); - } - } - }); - } - - /** - * Create the application. - */ - public AddMoneyClient() { - initialize(); - } - - /** - * Initialize the contents of the frame. - */ - - private String emailID; - - public void setEmailID(String emailID) { - this.emailID = emailID; - } - - Connection connection = null; - - // Balance textField - JLabel lblNewLabel_3; - - // main - private void initialize() { - - System.out.println(emailID); - - try { - connection = DBConnector.getConnection(); - } catch (ClassNotFoundException e2) { - // TODO Auto-generated catch block - e2.printStackTrace(); - } catch (SQLException e2) { - // TODO Auto-generated catch block - e2.printStackTrace(); - } - frame = new JFrame(); - frame.setBounds(100, 100, 446, 321); - frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); - frame.getContentPane().setLayout(null); - - JLabel lblNewLabel = new JLabel("ADD MONEY "); - lblNewLabel.setFont(new Font("Tahoma", Font.PLAIN, 16)); - lblNewLabel.setBounds(174, 11, 115, 14); - frame.getContentPane().add(lblNewLabel); - - JLabel lblMoneyToBe = new JLabel("Money to be added to the account:"); - lblMoneyToBe.setBounds(141, 36, 178, 14); - frame.getContentPane().add(lblMoneyToBe); - - textField = new JTextField(); - textField.setBounds(130, 125, 218, 20); - frame.getContentPane().add(textField); - textField.setColumns(10); - - JLabel lblNewLabel_1 = new JLabel("Acc Number"); - lblNewLabel_1.setFont(new Font("Tahoma", Font.PLAIN, 14)); - lblNewLabel_1.setBounds(174, 61, 100, 20); - frame.getContentPane().add(lblNewLabel_1); - - // Account Number Text Field - String query3 = "select accountNo from clienttable where email = ?"; - - try { - PreparedStatement pst1 = connection.prepareStatement(query3); - pst1.setString(1, GlobalVariable.getInstance().getLogin()); - ResultSet rs1 = pst1.executeQuery(); - while (rs1.next()) { - lblNewLabel_1.setText(rs1.getString("accountNo")); - } - } catch (SQLException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); - } - - JLabel lblNewLabel_2 = new JLabel("\u20AC"); - lblNewLabel_2.setBounds(107, 128, 13, 14); - frame.getContentPane().add(lblNewLabel_2); - - // Get the balance - - JButton btnNewButton = new JButton("ADD"); - btnNewButton.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - - emailID = GlobalVariable.getInstance().getLogin(); - - if (!textField.getText().isEmpty()) { - - String query1 = "select balance from balancetable where email = ?"; - String query2 = "update balancetable set balance = ? where email = ?"; - - try { - - PreparedStatement pst = connection.prepareStatement(query1); - pst.setString(1, GlobalVariable.getInstance().getLogin()); - ResultSet rs = pst.executeQuery(); - float money = 0; - while (rs.next()) { - money = rs.getFloat("balance"); - } - pst = connection.prepareStatement(query2); - money += Float.parseFloat(textField.getText()); - pst.setFloat(1, money); - pst.setString(2, GlobalVariable.getInstance().getLogin()); - pst.execute(); - String MoneyString = String.valueOf(money); - lblNewLabel_3.setText(MoneyString); - - } catch (Exception e1) { - e1.getStackTrace(); - } - JOptionPane.showMessageDialog(frame, "Amount added Successfully to your account"); - } else { - JOptionPane.showMessageDialog(frame, "Please enter the money!!!"); - } - } - }); - btnNewButton.setBounds(171, 156, 89, 23); - frame.getContentPane().add(btnNewButton); - - JLabel lblYourTotalBalance = new JLabel("Your Total Balance is : \u20AC"); - lblYourTotalBalance.setFont(new Font("Tahoma", Font.PLAIN, 14)); - lblYourTotalBalance.setBounds(49, 207, 188, 23); - frame.getContentPane().add(lblYourTotalBalance); - - lblNewLabel_3 = new JLabel("Acc Balance"); - lblNewLabel_3.setFont(new Font("Tahoma", Font.PLAIN, 16)); - lblNewLabel_3.setBounds(247, 209, 127, 28); - frame.getContentPane().add(lblNewLabel_3); - - // BAlance Text Field - String query4 = "select balance from balancetable where email = ?"; - - try { - PreparedStatement pst2 = connection.prepareStatement(query4); - pst2.setString(1, GlobalVariable.getInstance().getLogin()); - ResultSet rs2 = pst2.executeQuery(); - while (rs2.next()) { - lblNewLabel_3.setText(rs2.getString("balance")); - } - } catch (SQLException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); - } - - // BACK to the main window - JButton btnNewButton_1 = new JButton("BACK"); - btnNewButton_1.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - frame.dispose(); - ClientInformation ci = new ClientInformation(); - ci.frmClientInformation.setVisible(true); - } - }); - btnNewButton_1.setBounds(10, 248, 89, 23); - frame.getContentPane().add(btnNewButton_1); - } - -} diff --git a/ChangePassword.java b/ChangePassword.java deleted file mode 100644 index c26fa26..0000000 --- a/ChangePassword.java +++ /dev/null @@ -1,153 +0,0 @@ -package bankingsystemswing; - -import java.awt.EventQueue; - -import javax.swing.JFrame; -import javax.swing.JLabel; -import javax.swing.JOptionPane; - -import java.awt.Font; -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; - -import javax.swing.JTextField; -import javax.swing.WindowConstants; - -import org.apache.commons.codec.digest.DigestUtils; - -import javax.swing.JButton; -import java.awt.event.ActionListener; -import java.awt.event.ActionEvent; - -public class ChangePassword { - - JFrame frame; - private JTextField textField; - private JTextField textField_1; - private JTextField textField_2; - - /** - * Launch the application. - */ - public static void main(String[] args) { - EventQueue.invokeLater(new Runnable() { - public void run() { - try { - ChangePassword window = new ChangePassword(); - window.frame.setVisible(true); - window.frame.setTitle("Password Change"); - window.frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); - } catch (Exception e) { - e.printStackTrace(); - } - } - }); - } - - /** - * Create the application. - */ - public ChangePassword() { - initialize(); - } - - /** - * Initialize the contents of the frame. - */ - Connection connection = null; - - private void initialize() { - try { - connection = DBConnector.getConnection(); - } catch (ClassNotFoundException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); - } catch (SQLException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); - } - frame = new JFrame(); - frame.setBounds(100, 100, 479, 251); - frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); - frame.getContentPane().setLayout(null); - - JLabel lblNewLabel = new JLabel("CHANGE PASSWORD"); - lblNewLabel.setFont(new Font("Tahoma", Font.PLAIN, 14)); - lblNewLabel.setBounds(158, 11, 209, 34); - frame.getContentPane().add(lblNewLabel); - - JLabel lblNewLabel_1 = new JLabel("Old Password"); - lblNewLabel_1.setBounds(75, 68, 108, 19); - frame.getContentPane().add(lblNewLabel_1); - - //Password old encrypted - textField = new JTextField(); - textField.setBounds(212, 67, 155, 20); - frame.getContentPane().add(textField); - textField.setColumns(10); - String encryptedPassword = DigestUtils.md5Hex(textField.getText()); - - - JLabel lblNewLabel_2 = new JLabel("New Password"); - lblNewLabel_2.setBounds(75, 98, 108, 14); - frame.getContentPane().add(lblNewLabel_2); - - // Password encrypted New - textField_1 = new JTextField(); - textField_1.setBounds(212, 95, 155, 20); - frame.getContentPane().add(textField_1); - textField_1.setColumns(10); - String encryptedPasswordNew = DigestUtils.md5Hex(textField_1.getText()); - - JLabel lblNewLabel_3 = new JLabel("Confirm Password"); - lblNewLabel_3.setBounds(75, 123, 127, 14); - frame.getContentPane().add(lblNewLabel_3); - - textField_2 = new JTextField(); - textField_2.setBounds(212, 120, 155, 20); - frame.getContentPane().add(textField_2); - textField_2.setColumns(10); - - // Change password - JButton btnNewButton = new JButton("CHANGE"); - btnNewButton.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent arg0) { - - String query1 = "select password from accounts where email = ?"; - String query = "update accounts set password = ? where email = ?"; - try { - PreparedStatement pst = connection.prepareStatement(query1); - pst.setString(1, GlobalVariable.getInstance().getLogin()); - ResultSet rs = pst.executeQuery(); - System.out.println("inside change password : " + GlobalVariable.getInstance().getLogin()); - while (rs.next()) { - GlobalVariable.getInstance().setPassword(rs.getString("password")); - } - System.out - .println("inside change password password : " + GlobalVariable.getInstance().getPassword()); - - if (GlobalVariable.getInstance().getPassword().equals(encryptedPassword)) { - pst = connection.prepareStatement(query); - pst.setString(1, encryptedPasswordNew); - pst.setString(2, GlobalVariable.getInstance().getLogin()); - pst.executeUpdate(); - JOptionPane.showMessageDialog(frame, "Password Changed Sucessfully"); - frame.setVisible(false); - } else { - JOptionPane.showMessageDialog(frame, "Please enter correct password"); - } - - } catch (SQLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - } - }); - btnNewButton.setBounds(189, 166, 127, 23); - frame.getContentPane().add(btnNewButton); - - } -} diff --git a/ClientInformation.java b/ClientInformation.java deleted file mode 100644 index 83f0db7..0000000 --- a/ClientInformation.java +++ /dev/null @@ -1,409 +0,0 @@ -package bankingsystemswing; - -import java.awt.EventQueue; - -import javax.swing.JFrame; -import javax.swing.JPanel; -import java.awt.BorderLayout; -import javax.swing.JLabel; -import javax.swing.JButton; -import java.awt.Panel; -import javax.swing.JTabbedPane; - - - -import java.awt.Font; -import java.awt.Color; -import java.awt.event.ActionListener; -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.awt.event.ActionEvent; - -public class ClientInformation { - - JFrame frmClientInformation; - - /** - * Launch the application. - */ - public static void main(String[] args) { - EventQueue.invokeLater(new Runnable() { - public void run() { - try { - ClientInformation window = new ClientInformation(); - window.frmClientInformation.setVisible(true); - } catch (Exception e) { - e.printStackTrace(); - } - } - }); - } - - /** - * Create the application. - */ - public ClientInformation() { - initialize(); - } - - - - /** - * Initialize the contents of the frame. - */ - Connection connection = null; - - private void initialize() { - try { - connection = DBConnector.getConnection(); - } catch (ClassNotFoundException e2) { - // TODO Auto-generated catch block - e2.printStackTrace(); - } catch (SQLException e2) { - // TODO Auto-generated catch block - e2.printStackTrace(); - } - frmClientInformation = new JFrame(); - frmClientInformation.setTitle("Client Information"); - frmClientInformation.setResizable(false); - frmClientInformation.setBounds(100, 100, 819, 499); - frmClientInformation.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); - frmClientInformation.getContentPane().setLayout(null); - - JLabel lblSwissBank = new JLabel("SWISS BANK"); - lblSwissBank.setForeground(Color.BLUE); - lblSwissBank.setFont(new Font("Tahoma", Font.PLAIN, 18)); - lblSwissBank.setBounds(10, 11, 145, 40); - frmClientInformation.getContentPane().add(lblSwissBank); - - JButton btnNewButton = new JButton("INFORMATION"); - btnNewButton.setFont(new Font("Tahoma", Font.PLAIN, 8)); - btnNewButton.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent arg0) { - } - }); - btnNewButton.setBounds(10, 54, 89, 23); - frmClientInformation.getContentPane().add(btnNewButton); - - JButton btnNewButton_1 = new JButton("TRANSACTION"); - btnNewButton_1.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - frmClientInformation.dispose(); - Transaction transaction = new Transaction(); - transaction.main(null); - - } - }); - btnNewButton_1.setFont(new Font("Tahoma", Font.PLAIN, 8)); - btnNewButton_1.setBounds(10, 88, 89, 23); - frmClientInformation.getContentPane().add(btnNewButton_1); - - JButton btnNewButton_2 = new JButton("TRANSFER"); - btnNewButton_2.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - - frmClientInformation.dispose(); - TransferMoney transfermoney = new TransferMoney(); - transfermoney.frame.setVisible(true); - - } - }); - btnNewButton_2.setFont(new Font("Tahoma", Font.PLAIN, 8)); - btnNewButton_2.setBounds(10, 122, 89, 23); - frmClientInformation.getContentPane().add(btnNewButton_2); - - JPanel panel = new JPanel(); - panel.setBounds(109, 54, 694, 331); - frmClientInformation.getContentPane().add(panel); - panel.setLayout(null); - - JLabel lblNewLabel = new JLabel("ACC No:"); - lblNewLabel.setBounds(10, 24, 71, 14); - panel.add(lblNewLabel); - - JLabel lblNewLabel_1 = new JLabel("EmailID:"); - lblNewLabel_1.setBounds(10, 49, 71, 14); - panel.add(lblNewLabel_1); - - JLabel lblNewLabel_2 = new JLabel("Telephone:"); - lblNewLabel_2.setBounds(10, 99, 71, 14); - panel.add(lblNewLabel_2); - - JLabel lbltelephone = new JLabel("New label"); - lbltelephone.setFont(new Font("Tahoma", Font.PLAIN, 11)); - lbltelephone.setBounds(123, 99, 204, 14); - panel.add(lbltelephone); - - JLabel lblNewLabel_5 = new JLabel("Address:"); - lblNewLabel_5.setBounds(48, 124, 71, 14); - panel.add(lblNewLabel_5); - - JLabel lblAccno = new JLabel("New label"); - lblAccno.setFont(new Font("Tahoma", Font.PLAIN, 11)); - lblAccno.setBounds(125, 24, 202, 14); - panel.add(lblAccno); - - JLabel lblemail = new JLabel("New label"); - lblemail.setFont(new Font("Tahoma", Font.PLAIN, 11)); - lblemail.setBounds(123, 49, 204, 14); - panel.add(lblemail); - - JLabel lblGender = new JLabel("Gender:"); - lblGender.setBounds(10, 74, 71, 14); - panel.add(lblGender); - - JLabel lblgender = new JLabel("New label"); - lblgender.setFont(new Font("Tahoma", Font.PLAIN, 11)); - lblgender.setBounds(123, 74, 204, 14); - panel.add(lblgender); - - JLabel lblNewLabel_4 = new JLabel("House No:"); - lblNewLabel_4.setBounds(10, 149, 73, 14); - panel.add(lblNewLabel_4); - - JLabel lblNewLabel_6 = new JLabel("Neighbourhood:"); - lblNewLabel_6.setBounds(10, 174, 98, 14); - panel.add(lblNewLabel_6); - - JLabel lblNewLabel_8 = new JLabel("City:"); - lblNewLabel_8.setBounds(10, 199, 71, 14); - panel.add(lblNewLabel_8); - - JLabel lblNewLabel_9 = new JLabel("Country:"); - lblNewLabel_9.setBounds(10, 226, 71, 14); - panel.add(lblNewLabel_9); - - JLabel lblNewLabel_10 = new JLabel("Zip Code:"); - lblNewLabel_10.setBounds(10, 251, 71, 14); - panel.add(lblNewLabel_10); - - JLabel lblNewLabel_11 = new JLabel("Occupation:"); - lblNewLabel_11.setBounds(10, 276, 84, 14); - panel.add(lblNewLabel_11); - - JLabel lblNewLabel_12 = new JLabel("Mobile:"); - lblNewLabel_12.setBounds(10, 301, 71, 14); - panel.add(lblNewLabel_12); - - JLabel lblhouse = new JLabel("New label"); - lblhouse.setFont(new Font("Tahoma", Font.PLAIN, 11)); - lblhouse.setBounds(123, 149, 204, 14); - panel.add(lblhouse); - - JLabel lblneighbour = new JLabel("New label"); - lblneighbour.setFont(new Font("Tahoma", Font.PLAIN, 11)); - lblneighbour.setBounds(123, 174, 204, 14); - panel.add(lblneighbour); - - JLabel lblcity = new JLabel("New label"); - lblcity.setBounds(123, 199, 204, 14); - panel.add(lblcity); - - JLabel lblcountry = new JLabel("New label"); - lblcountry.setBounds(123, 226, 204, 14); - panel.add(lblcountry); - - JLabel lblzip = new JLabel("New label"); - lblzip.setBounds(125, 251, 202, 14); - panel.add(lblzip); - - JLabel lblOccupation = new JLabel("New label"); - lblOccupation.setFont(new Font("Tahoma", Font.PLAIN, 11)); - lblOccupation.setBounds(123, 276, 204, 14); - panel.add(lblOccupation); - - JLabel lblMobile = new JLabel("New label"); - lblMobile.setBounds(123, 301, 204, 14); - panel.add(lblMobile); - - JLabel lblNewLabel_13 = new JLabel("Nationality:"); - lblNewLabel_13.setBounds(386, 24, 78, 14); - panel.add(lblNewLabel_13); - - JLabel lblNewLabel_14 = new JLabel("Married:"); - lblNewLabel_14.setBounds(386, 49, 78, 14); - panel.add(lblNewLabel_14); - - JLabel lblNewLabel_15 = new JLabel("Spouce Name:"); - lblNewLabel_15.setBounds(386, 74, 98, 14); - panel.add(lblNewLabel_15); - - JLabel lblNewLabel_16 = new JLabel("Birth Place:"); - lblNewLabel_16.setBounds(386, 99, 78, 14); - panel.add(lblNewLabel_16); - - JLabel lblNewLabel_17 = new JLabel("Children:"); - lblNewLabel_17.setBounds(386, 124, 78, 14); - panel.add(lblNewLabel_17); - - JLabel lblNewLabel_18 = new JLabel("Bank Agency:"); - lblNewLabel_18.setBounds(386, 149, 78, 14); - panel.add(lblNewLabel_18); - - JLabel lblNewLabel_19 = new JLabel("DOB:"); - lblNewLabel_19.setBounds(386, 174, 78, 14); - panel.add(lblNewLabel_19); - - JLabel lblNewLabel_20 = new JLabel("IBAN"); - lblNewLabel_20.setBounds(455, 276, 46, 14); - panel.add(lblNewLabel_20); - - JLabel lbliban = new JLabel("New label"); - lbliban.setFont(new Font("Tahoma", Font.PLAIN, 14)); - lbliban.setBounds(337, 294, 347, 25); - panel.add(lbliban); - - JLabel lblNewLabel_22 = new JLabel("BIC Code:"); - lblNewLabel_22.setBounds(386, 251, 78, 14); - panel.add(lblNewLabel_22); - - JLabel lblnationality = new JLabel("New label"); - lblnationality.setBounds(497, 24, 187, 14); - panel.add(lblnationality); - - JLabel lblmarried = new JLabel("New label"); - lblmarried.setBounds(497, 49, 187, 14); - panel.add(lblmarried); - - JLabel lblSpouce = new JLabel("New label"); - lblSpouce.setBounds(497, 74, 187, 14); - panel.add(lblSpouce); - - JLabel lblBirthPlace = new JLabel("New label"); - lblBirthPlace.setBounds(497, 99, 187, 14); - panel.add(lblBirthPlace); - - JLabel lblChildren = new JLabel("New label"); - lblChildren.setBounds(497, 124, 187, 14); - panel.add(lblChildren); - - JLabel lblAgency = new JLabel("New label"); - lblAgency.setBounds(497, 149, 187, 14); - panel.add(lblAgency); - - JLabel lblDOB = new JLabel("New label"); - lblDOB.setBounds(497, 174, 187, 14); - panel.add(lblDOB); - - JLabel lblBIC = new JLabel("New label"); - lblBIC.setBounds(497, 251, 187, 14); - panel.add(lblBIC); - - JLabel lblFirstName = new JLabel("New label"); - lblFirstName.setFont(new Font("Tahoma", Font.PLAIN, 14)); - lblFirstName.setBounds(266, 20, 238, 14); - frmClientInformation.getContentPane().add(lblFirstName); - - JLabel lblNewLabel_7 = new JLabel("BALANCE"); - lblNewLabel_7.setBounds(227, 412, 83, 14); - frmClientInformation.getContentPane().add(lblNewLabel_7); - - - // Edit the information page - JButton btnEdit = new JButton("Edit"); - btnEdit.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - - frmClientInformation.dispose(); - ClientInformationEdit cfe = new ClientInformationEdit(); - cfe.frame.setVisible(true); - } - }); - btnEdit.setBounds(681, 408, 89, 23); - frmClientInformation.getContentPane().add(btnEdit); - - JButton btnAddMoney = new JButton("ADD MONEY"); - btnAddMoney.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - - frmClientInformation.dispose(); - AddMoneyClient.main(null); - } - }); - btnAddMoney.setFont(new Font("Tahoma", Font.PLAIN, 8)); - btnAddMoney.setBounds(10, 156, 89, 23); - frmClientInformation.getContentPane().add(btnAddMoney); - - JLabel lblLastName = new JLabel("New label"); - lblLastName.setFont(new Font("Tahoma", Font.PLAIN, 14)); - lblLastName.setBounds(514, 20, 221, 14); - frmClientInformation.getContentPane().add(lblLastName); - - JLabel label = new JLabel("New label"); - label.setFont(new Font("Tahoma", Font.PLAIN, 16)); - label.setBounds(354, 408, 221, 19); - frmClientInformation.getContentPane().add(label); - - JLabel lblNewLabel_3 = new JLabel("\u20AC"); - lblNewLabel_3.setFont(new Font("Tahoma", Font.PLAIN, 16)); - lblNewLabel_3.setBounds(320, 408, 24, 19); - frmClientInformation.getContentPane().add(lblNewLabel_3); - - - - - // To get the data from the database - //String email11 = ; - //String query = "select firstName,lastName,dateOfBirth,gender,telephone,house,neighbourhood,city,country,zipcode,occupation,mobile,nationality,Married,spouceName,birthPlace,children,bankAgency,email,iban,BIC,accountNo from clienttable where email= ?"; - String query = "SELECT * FROM clienttable WHERE email = ?"; - String query2 = "select balance from balancetable where email =?"; - ResultSet rs = null; - PreparedStatement pst = null; - try { - pst = connection.prepareStatement(query); - System.out.println(GlobalVariable.getInstance().getLogin()); - pst.setString(1, GlobalVariable.getInstance().getLogin()); - - //System.out.println(email11); - pst.setString(1, GlobalVariable.getInstance().getLogin()); - - rs = pst.executeQuery(); - - while(rs.next()) - { - lblFirstName.setText(rs.getString("firstName")); - lblLastName.setText(rs.getString("lastName")); - lblAccno.setText(rs.getString("accountNo")); - lblemail.setText(rs.getString("email")); - lblgender.setText(rs.getString("gender")); - lbltelephone.setText(rs.getString("telephone")); - lblhouse.setText(rs.getString("house")); - lblneighbour.setText(rs.getString("neighbourhood")); - lblcity.setText(rs.getString("city")); - lblcountry.setText(rs.getString("country")); - lblzip.setText(rs.getString("zipcode")); - lblOccupation.setText(rs.getString("occupation")); - lblMobile.setText(rs.getString("mobile")); - lblnationality.setText(rs.getString("nationality")); - lblmarried.setText(rs.getString("Married")); - lblSpouce.setText(rs.getString("spouceName")); - lblBirthPlace.setText(rs.getString("birthPlace")); - lblChildren.setText(rs.getString("children")); - lblAgency.setText(rs.getString("bankAgency")); - lblDOB.setText(rs.getString("dateOfBirth")); - lblBIC.setText(rs.getString("BIC")); - lbliban.setText(rs.getString("iban")); - } - - pst = connection.prepareStatement(query2); - - pst.setString(1, GlobalVariable.getInstance().getLogin()); - - rs = pst.executeQuery(); - while(rs.next()) - { - label.setText(rs.getString("balance")); - } - - } catch (SQLException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); - } finally { - // pst.close(); - // rs.close(); - } - - } -} diff --git a/ClientInformationAdvisor.java b/ClientInformationAdvisor.java deleted file mode 100644 index 22a55d4..0000000 --- a/ClientInformationAdvisor.java +++ /dev/null @@ -1,227 +0,0 @@ -package bankingsystemswing; - -import java.awt.EventQueue; - -import javax.swing.JFrame; -import javax.swing.JLabel; -import javax.swing.JTextField; -import javax.swing.JRadioButton; - -public class ClientInformationAdvisor { - - private JFrame frame; - private JTextField textField; - private JTextField textField_1; - private JTextField textField_2; - private JTextField textField_3; - private JTextField textField_4; - private JTextField textField_5; - private JTextField textField_6; - private JTextField textField_7; - private JTextField textField_8; - private JTextField textField_9; - private JTextField textField_10; - private JTextField textField_11; - private JTextField textField_12; - private JTextField textField_13; - private JTextField textField_14; - private JTextField textField_15; - - /** - * Launch the application. - */ - public static void main(String[] args) { - EventQueue.invokeLater(new Runnable() { - public void run() { - try { - ClientInformationAdvisor window = new ClientInformationAdvisor(); - window.frame.setVisible(true); - } catch (Exception e) { - e.printStackTrace(); - } - } - }); - } - - /** - * Create the application. - */ - public ClientInformationAdvisor() { - initialize(); - } - - /** - * Initialize the contents of the frame. - */ - private void initialize() { - frame = new JFrame(); - frame.setBounds(100, 100, 596, 453); - frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); - frame.getContentPane().setLayout(null); - - JLabel label = new JLabel("First Name"); - label.setBounds(20, 51, 65, 14); - frame.getContentPane().add(label); - - textField = new JTextField(); - textField.setColumns(10); - textField.setBounds(130, 48, 117, 20); - frame.getContentPane().add(textField); - - JLabel label_1 = new JLabel("Last Name"); - label_1.setBounds(20, 87, 65, 14); - frame.getContentPane().add(label_1); - - textField_1 = new JTextField(); - textField_1.setColumns(10); - textField_1.setBounds(130, 87, 117, 20); - frame.getContentPane().add(textField_1); - - JLabel label_2 = new JLabel("DOB"); - label_2.setBounds(20, 122, 46, 14); - frame.getContentPane().add(label_2); - - textField_2 = new JTextField(); - textField_2.setColumns(10); - textField_2.setBounds(130, 122, 117, 20); - frame.getContentPane().add(textField_2); - - JLabel label_3 = new JLabel("Account Type"); - label_3.setBounds(20, 159, 89, 14); - frame.getContentPane().add(label_3); - - textField_3 = new JTextField(); - textField_3.setColumns(10); - textField_3.setBounds(130, 159, 117, 20); - frame.getContentPane().add(textField_3); - - JLabel label_4 = new JLabel("Gender"); - label_4.setBounds(20, 197, 46, 14); - frame.getContentPane().add(label_4); - - JRadioButton radioButton = new JRadioButton("Male"); - radioButton.setBounds(107, 193, 58, 23); - frame.getContentPane().add(radioButton); - - JRadioButton radioButton_1 = new JRadioButton("Female"); - radioButton_1.setBounds(167, 193, 59, 23); - frame.getContentPane().add(radioButton_1); - - textField_4 = new JTextField(); - textField_4.setColumns(10); - textField_4.setBounds(130, 229, 117, 20); - frame.getContentPane().add(textField_4); - - JLabel label_5 = new JLabel("Telephone"); - label_5.setBounds(20, 232, 65, 14); - frame.getContentPane().add(label_5); - - JLabel label_6 = new JLabel("Married"); - label_6.setBounds(20, 268, 46, 14); - frame.getContentPane().add(label_6); - - JRadioButton radioButton_2 = new JRadioButton("Yes"); - radioButton_2.setBounds(117, 264, 48, 23); - frame.getContentPane().add(radioButton_2); - - JRadioButton radioButton_3 = new JRadioButton("No"); - radioButton_3.setBounds(165, 264, 46, 23); - frame.getContentPane().add(radioButton_3); - - textField_5 = new JTextField(); - textField_5.setColumns(10); - textField_5.setBounds(127, 300, 120, 20); - frame.getContentPane().add(textField_5); - - JLabel label_7 = new JLabel("Spouce Name:"); - label_7.setBounds(20, 303, 97, 14); - frame.getContentPane().add(label_7); - - JLabel label_8 = new JLabel("Bank Agency"); - label_8.setBounds(20, 328, 89, 14); - frame.getContentPane().add(label_8); - - textField_6 = new JTextField(); - textField_6.setColumns(10); - textField_6.setBounds(125, 325, 122, 20); - frame.getContentPane().add(textField_6); - - textField_7 = new JTextField(); - textField_7.setColumns(10); - textField_7.setBounds(407, 323, 116, 20); - frame.getContentPane().add(textField_7); - - JLabel label_9 = new JLabel("Email"); - label_9.setBounds(351, 320, 46, 14); - frame.getContentPane().add(label_9); - - textField_8 = new JTextField(); - textField_8.setColumns(10); - textField_8.setBounds(407, 292, 116, 20); - frame.getContentPane().add(textField_8); - - JLabel label_10 = new JLabel("Children"); - label_10.setBounds(331, 295, 66, 14); - frame.getContentPane().add(label_10); - - textField_9 = new JTextField(); - textField_9.setColumns(10); - textField_9.setBounds(407, 257, 116, 20); - frame.getContentPane().add(textField_9); - - JLabel label_11 = new JLabel("Birth Place"); - label_11.setBounds(331, 260, 78, 14); - frame.getContentPane().add(label_11); - - textField_10 = new JTextField(); - textField_10.setColumns(10); - textField_10.setBounds(407, 221, 116, 20); - frame.getContentPane().add(textField_10); - - JLabel label_12 = new JLabel("Nationality"); - label_12.setBounds(331, 224, 78, 14); - frame.getContentPane().add(label_12); - - textField_11 = new JTextField(); - textField_11.setColumns(10); - textField_11.setBounds(407, 186, 116, 20); - frame.getContentPane().add(textField_11); - - JLabel label_13 = new JLabel("Mobile"); - label_13.setBounds(351, 189, 46, 14); - frame.getContentPane().add(label_13); - - textField_12 = new JTextField(); - textField_12.setColumns(10); - textField_12.setBounds(407, 148, 116, 20); - frame.getContentPane().add(textField_12); - - JLabel label_14 = new JLabel("Occupation"); - label_14.setBounds(331, 151, 78, 14); - frame.getContentPane().add(label_14); - - textField_13 = new JTextField(); - textField_13.setColumns(10); - textField_13.setBounds(407, 114, 138, 20); - frame.getContentPane().add(textField_13); - - textField_14 = new JTextField(); - textField_14.setColumns(10); - textField_14.setBounds(407, 79, 138, 20); - frame.getContentPane().add(textField_14); - - textField_15 = new JTextField(); - textField_15.setColumns(10); - textField_15.setBounds(407, 48, 138, 20); - frame.getContentPane().add(textField_15); - - JLabel label_15 = new JLabel("Address"); - label_15.setBounds(331, 51, 66, 14); - frame.getContentPane().add(label_15); - - JLabel label_16 = new JLabel("CLIENT INFORMATION EDIT"); - label_16.setBounds(219, 11, 156, 14); - frame.getContentPane().add(label_16); - } - -} diff --git a/ClientInformationEdit.java b/ClientInformationEdit.java deleted file mode 100644 index 53e3b22..0000000 --- a/ClientInformationEdit.java +++ /dev/null @@ -1,440 +0,0 @@ -package bankingsystemswing; - -import java.awt.EventQueue; - -import javax.swing.JFrame; -import javax.swing.JLabel; -import javax.swing.JOptionPane; -import javax.swing.JTextField; -import javax.swing.JRadioButton; -import javax.swing.JTextPane; -import javax.swing.ButtonGroup; -import javax.swing.JButton; -import java.awt.event.ActionListener; -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.Random; -import java.awt.event.ActionEvent; -import javax.swing.JComboBox; -import javax.swing.JPasswordField; -import java.awt.Font; -import java.awt.Color; -import com.toedter.calendar.JDateChooser; - -public class ClientInformationEdit { - - JFrame frame; - private JTextField textField; - private JTextField textField_1; - private JTextField textField_4; - private JTextField textFieldhouse; - private JTextField textFieldneighbourhood; - private JTextField textFieldcity; - private JTextField textField_8; - private JTextField textField_9; - private JTextField textField_10; - private JTextField textField_11; - private JTextField textField_12; - private JTextField textField_13; - private JTextField textField_14; - - /** - * Launch the application. - */ - public static void main(String[] args) { - EventQueue.invokeLater(new Runnable() { - public void run() { - try { - ClientInformationEdit window = new ClientInformationEdit(); - window.frame.setVisible(true); - } catch (Exception e) { - e.printStackTrace(); - } - } - }); - } - - /** - * Create the application. - */ - public ClientInformationEdit() { - initialize(); - } - - /** - * Initialize the contents of the frame. - */ - private String married; - private String gender; - Connection connection = null; - - private String accountType; - private JTextField textFieldCountry; - private JTextField textFieldZipcode; - private JTextField textField_2; - - private void initialize() { - try { - connection = DBConnector.getConnection(); - } catch (ClassNotFoundException e2) { - // TODO Auto-generated catch block - e2.printStackTrace(); - } catch (SQLException e2) { - // TODO Auto-generated catch block - e2.printStackTrace(); - } - frame = new JFrame(); - frame.setBounds(100, 100, 604, 457); - frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); - frame.getContentPane().setLayout(null); - - JLabel lblClientInformationEdit = new JLabel("CLIENT INFORMATION EDIT"); - lblClientInformationEdit.setForeground(Color.BLUE); - lblClientInformationEdit.setFont(new Font("Tahoma", Font.PLAIN, 16)); - lblClientInformationEdit.setBounds(107, 5, 283, 31); - frame.getContentPane().add(lblClientInformationEdit); - - JLabel lblNewLabel = new JLabel("First Name"); - lblNewLabel.setBounds(25, 47, 65, 14); - frame.getContentPane().add(lblNewLabel); - - JLabel lblNewLabel_1 = new JLabel("Last Name"); - lblNewLabel_1.setBounds(25, 75, 65, 14); - frame.getContentPane().add(lblNewLabel_1); - - JLabel lblNewLabel_2 = new JLabel("DOB"); - lblNewLabel_2.setBounds(25, 126, 46, 14); - frame.getContentPane().add(lblNewLabel_2); - - JLabel lblNewLabel_4 = new JLabel("Gender"); - lblNewLabel_4.setBounds(25, 185, 46, 14); - frame.getContentPane().add(lblNewLabel_4); - - textField = new JTextField(); - textField.setBounds(135, 47, 117, 20); - frame.getContentPane().add(textField); - textField.setColumns(10); - - textField_1 = new JTextField(); - textField_1.setBounds(135, 75, 117, 20); - frame.getContentPane().add(textField_1); - textField_1.setColumns(10); - - JRadioButton rdbtnMale = new JRadioButton("Male"); - rdbtnMale.addActionListener(new ActionListener() { - // gender radiobutton selection - public void actionPerformed(ActionEvent e) { - if (rdbtnMale.isSelected()) - gender = "M"; - } - }); - rdbtnMale.setBounds(112, 181, 58, 23); - frame.getContentPane().add(rdbtnMale); - - JRadioButton rdbtnfemale = new JRadioButton("Female"); - rdbtnfemale.addActionListener(new ActionListener() { - // gender radiobutton selection - public void actionPerformed(ActionEvent e) { - - if (rdbtnfemale.isSelected()) - gender = "F"; - } - }); - rdbtnfemale.setBounds(172, 181, 59, 23); - frame.getContentPane().add(rdbtnfemale); - - ButtonGroup bg1 = new ButtonGroup(); - bg1.add(rdbtnMale); - bg1.add(rdbtnfemale); - - JLabel lblNewLabel_5 = new JLabel("Telephone"); - lblNewLabel_5.setBounds(25, 220, 65, 14); - frame.getContentPane().add(lblNewLabel_5); - - textField_4 = new JTextField(); - textField_4.setBounds(135, 217, 117, 20); - frame.getContentPane().add(textField_4); - textField_4.setColumns(10); - - JLabel lblAddress = new JLabel("Address"); - lblAddress.setBounds(442, 11, 66, 14); - frame.getContentPane().add(lblAddress); - - textFieldhouse = new JTextField(); - textFieldhouse.setBounds(412, 36, 138, 20); - frame.getContentPane().add(textFieldhouse); - textFieldhouse.setColumns(10); - - textFieldneighbourhood = new JTextField(); - textFieldneighbourhood.setBounds(412, 67, 138, 20); - frame.getContentPane().add(textFieldneighbourhood); - textFieldneighbourhood.setColumns(10); - - textFieldcity = new JTextField(); - textFieldcity.setBounds(412, 102, 138, 20); - frame.getContentPane().add(textFieldcity); - textFieldcity.setColumns(10); - - - JLabel lblNewLabel_6 = new JLabel("Occupation"); - lblNewLabel_6.setBounds(324, 215, 78, 14); - frame.getContentPane().add(lblNewLabel_6); - - textField_8 = new JTextField(); - textField_8.setBounds(421, 209, 116, 20); - frame.getContentPane().add(textField_8); - textField_8.setColumns(10); - - JLabel lblNewLabel_7 = new JLabel("Mobile"); - lblNewLabel_7.setBounds(344, 253, 46, 14); - frame.getContentPane().add(lblNewLabel_7); - - textField_9 = new JTextField(); - textField_9.setBounds(421, 247, 116, 20); - frame.getContentPane().add(textField_9); - textField_9.setColumns(10); - - JLabel lblNewLabel_8 = new JLabel("Nationality"); - lblNewLabel_8.setBounds(324, 288, 78, 14); - frame.getContentPane().add(lblNewLabel_8); - - textField_10 = new JTextField(); - textField_10.setBounds(421, 282, 116, 20); - frame.getContentPane().add(textField_10); - textField_10.setColumns(10); - - JLabel lblNewLabel_9 = new JLabel("Married"); - lblNewLabel_9.setBounds(25, 256, 46, 14); - frame.getContentPane().add(lblNewLabel_9); - - JRadioButton rdbtnYes = new JRadioButton("Yes"); - rdbtnYes.addActionListener(new ActionListener() { - // Married radiobutton action - public void actionPerformed(ActionEvent e) { - if (rdbtnYes.isSelected()) - married = "yes"; - - } - }); - rdbtnYes.setBounds(122, 252, 48, 23); - frame.getContentPane().add(rdbtnYes); - - JRadioButton rdbtnNo = new JRadioButton("No"); - rdbtnNo.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - if (rdbtnNo.isSelected()) - married = "no"; - } - }); - rdbtnNo.setBounds(170, 252, 46, 23); - frame.getContentPane().add(rdbtnNo); - - ButtonGroup bg2 = new ButtonGroup(); - bg2.add(rdbtnYes); - bg2.add(rdbtnNo); - - JLabel lblSpouceName = new JLabel("Spouce Name:"); - lblSpouceName.setBounds(25, 291, 97, 14); - frame.getContentPane().add(lblSpouceName); - - textField_11 = new JTextField(); - textField_11.setBounds(132, 288, 120, 20); - frame.getContentPane().add(textField_11); - textField_11.setColumns(10); - - JLabel lblBirthPlace = new JLabel("Birth Place"); - lblBirthPlace.setBounds(324, 324, 78, 14); - frame.getContentPane().add(lblBirthPlace); - - textField_12 = new JTextField(); - textField_12.setBounds(421, 318, 116, 20); - frame.getContentPane().add(textField_12); - textField_12.setColumns(10); - - JLabel lblChildren = new JLabel("Children"); - lblChildren.setBounds(324, 359, 66, 14); - frame.getContentPane().add(lblChildren); - - textField_13 = new JTextField(); - textField_13.setBounds(421, 353, 116, 20); - frame.getContentPane().add(textField_13); - textField_13.setColumns(10); - - JLabel lblBankAgency = new JLabel("Bank Agency"); - lblBankAgency.setBounds(25, 316, 89, 14); - frame.getContentPane().add(lblBankAgency); - - textField_14 = new JTextField(); - textField_14.setBounds(130, 313, 122, 20); - frame.getContentPane().add(textField_14); - textField_14.setColumns(10); - - - JButton btnDone = new JButton("Done"); - btnDone.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - - // inserting into the database - - String query ="update clienttable set firstName = ?,lastName = ?,dateOfBirth = ?,gender = ?,telephone = ?,house = ?,neighbourhood = ?,city = ?,country = ?, zipcode = ?,occupation = ?,mobile = ?,nationality = ?,Married = ?,spouceName = ?,birthPlace = ?,children = ?,bankAgency = ? where email = ?"; - try { - PreparedStatement pst= connection.prepareStatement(query); - pst.setString(1,textField.getText()); - pst.setString(2,textField_1.getText()); - pst.setString(3,textField_2.getText()); - pst.setString(4, gender); - pst.setString(5,textField_4.getText() ); - pst.setString(6,textFieldhouse.getText() ); - pst.setString(7,textFieldneighbourhood.getText() ); - pst.setString(8,textFieldcity.getText() ); - pst.setString(9,textFieldCountry.getText() ); - pst.setString(10,textFieldZipcode.getText() ); - pst.setString(11, textField_8.getText()); - pst.setString(12, textField_9.getText()); - pst.setString(13, textField_10.getText()); - pst.setString(14, married); - pst.setString(15, textField_11.getText() ); - pst.setString(16, textField_12.getText()); - pst.setString(17,textField_13.getText()); - pst.setString(18, textField_14.getText()); - pst.setString(19, GlobalVariable.getInstance().getLogin()); - pst.executeUpdate(); - - JOptionPane.showMessageDialog(null, "Data updated successfully"); - - } catch (SQLException e1) { - - e1.printStackTrace(); } - - } - }); - btnDone.setBounds(489, 384, 89, 23); - frame.getContentPane().add(btnDone); - - // Back button takes to the login page - JButton btnNewButton = new JButton("Back"); - btnNewButton.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - frame.dispose(); - ClientInformation cif = new ClientInformation(); - cif.frmClientInformation.setVisible(true); - - } - }); - btnNewButton.setBounds(10, 384, 89, 23); - frame.getContentPane().add(btnNewButton); - - JLabel lblNewLabel_3 = new JLabel("Password"); - lblNewLabel_3.setBounds(25, 151, 78, 14); - frame.getContentPane().add(lblNewLabel_3); - - - //Change password - JButton btnNewButton_1 = new JButton("Change Password"); - btnNewButton_1.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent arg0) { - - ChangePassword cp = new ChangePassword(); - cp.frame.setVisible(true); - - } - }); - btnNewButton_1.setBounds(135, 147, 117, 23); - frame.getContentPane().add(btnNewButton_1); - - textFieldCountry = new JTextField(); - textFieldCountry.setBounds(412, 133, 138, 20); - frame.getContentPane().add(textFieldCountry); - textFieldCountry.setColumns(10); - - textFieldZipcode = new JTextField(); - textFieldZipcode.setBounds(412, 164, 138, 20); - frame.getContentPane().add(textFieldZipcode); - textFieldZipcode.setColumns(10); - - JLabel lblNewLabel_10 = new JLabel("House"); - lblNewLabel_10.setBounds(326, 39, 76, 14); - frame.getContentPane().add(lblNewLabel_10); - - JLabel lblNewLabel_11 = new JLabel("Neighbourhood"); - lblNewLabel_11.setBounds(283, 70, 119, 14); - frame.getContentPane().add(lblNewLabel_11); - - JLabel lblNewLabel_12 = new JLabel("City"); - lblNewLabel_12.setBounds(293, 105, 97, 14); - frame.getContentPane().add(lblNewLabel_12); - - JLabel lblNewLabel_13 = new JLabel("Country"); - lblNewLabel_13.setBounds(303, 136, 99, 14); - frame.getContentPane().add(lblNewLabel_13); - - JLabel lblNewLabel_14 = new JLabel("Zip Code"); - lblNewLabel_14.setBounds(301, 167, 101, 14); - frame.getContentPane().add(lblNewLabel_14); - - textField_2 = new JTextField(); - textField_2.setBounds(135, 116, 86, 20); - frame.getContentPane().add(textField_2); - textField_2.setColumns(10); - - JLabel lblNewLabel_15 = new JLabel("YYYY-MM-DD"); - lblNewLabel_15.setBounds(135, 102, 117, 14); - frame.getContentPane().add(lblNewLabel_15); - - - - - - String query3 = "select firstName,lastName,dateOfBirth,telephone,house,neighbourhood,city,country,zipcode,occupation,mobile,nationality,spouceName,birthPlace,children,bankAgency,gender,Married from clienttable where email = ?"; - try { - PreparedStatement pst3 = connection.prepareStatement(query3); - pst3.setString(1, GlobalVariable.getInstance().getLogin()); - ResultSet rs2 = pst3.executeQuery(); - while (rs2.next()) { - textField.setText(rs2.getString("firstName")); - textField_1.setText(rs2.getString("lastName")); - textField_2.setText(rs2.getString("dateOfBirth")); - textField_4.setText(rs2.getString("telephone")); - textFieldhouse.setText(rs2.getString("house")); - textFieldneighbourhood.setText(rs2.getString("neighbourhood")); - textFieldcity.setText(rs2.getString("city")); - textFieldCountry.setText(rs2.getString("country")); - textFieldZipcode.setText(rs2.getString("zipcode")); - textField_8.setText(rs2.getString("occupation")); - textField_9.setText(rs2.getString("mobile")); - textField_10.setText(rs2.getString("nationality")); - textField_11.setText(rs2.getString("spouceName")); - textField_12.setText(rs2.getString("birthPlace")); - textField_13.setText(rs2.getString("children")); - textField_14.setText(rs2.getString("bankAgency")); - if(rs2.getString("gender").equals("M")) - { - rdbtnMale.setSelected(true); - rdbtnfemale.setSelected(false); - - }else - { - rdbtnMale.setSelected(false); - rdbtnfemale.setSelected(true); - } - - if(rs2.getString("Married").equals("yes")) - { - rdbtnYes.setSelected(true); - rdbtnNo.setSelected(false); - }else - { - rdbtnYes.setSelected(false); - rdbtnNo.setSelected(true); - } - - - } - } catch (Exception e2 ) { - e2.printStackTrace(); - } - - } -} diff --git a/CreateAccount.java b/CreateAccount.java deleted file mode 100644 index 30163b8..0000000 --- a/CreateAccount.java +++ /dev/null @@ -1,251 +0,0 @@ -package bankingsystemswing; - -import java.awt.EventQueue; - -import javax.swing.JFrame; -import javax.swing.JLabel; -import javax.swing.JOptionPane; - -import java.awt.Font; -import javax.swing.JTextField; - -import org.apache.commons.codec.digest.DigestUtils; - -import javax.swing.JPasswordField; -import javax.swing.JRadioButton; -import javax.swing.ButtonGroup; -import javax.swing.JButton; -import java.awt.event.ActionListener; -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.SQLException; -import java.util.Random; -import java.awt.event.ActionEvent; - -public class CreateAccount { - - JFrame frame; - private JTextField textField_2; - private JTextField textField_3; - private JPasswordField passwordField; - private JPasswordField passwordField_1; - - /** - * Launch the application. - */ - public static void main(String[] args) { - EventQueue.invokeLater(new Runnable() { - public void run() { - try { - CreateAccount window = new CreateAccount(); - window.frame.setVisible(true); - } catch (Exception e) { - e.printStackTrace(); - } - } - }); - } - - /** - * Create the application. - */ - public CreateAccount() { - initialize(); - } - - /** - * Initialize the contents of the frame. - */ - - Connection connection = null; - private String person; - - private void initialize() { - try { - connection = DBConnector.getConnection(); - } catch (ClassNotFoundException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); - } catch (SQLException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); - } - frame = new JFrame(); - frame.setBounds(100, 100, 634, 367); - frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); - frame.getContentPane().setLayout(null); - - JLabel lblNewLabel = new JLabel("CREATE AN ACCOUNT"); - lblNewLabel.setFont(new Font("Tahoma", Font.PLAIN, 16)); - lblNewLabel.setBounds(224, 21, 187, 41); - frame.getContentPane().add(lblNewLabel); - - JLabel lblNewLabel_3 = new JLabel("UserName"); - lblNewLabel_3.setBounds(39, 103, 79, 14); - frame.getContentPane().add(lblNewLabel_3); - - textField_2 = new JTextField(); - textField_2.setBounds(129, 100, 122, 20); - frame.getContentPane().add(textField_2); - textField_2.setColumns(10); - - JLabel lblNewLabel_4 = new JLabel("Email"); - lblNewLabel_4.setBounds(311, 103, 46, 14); - frame.getContentPane().add(lblNewLabel_4); - - textField_3 = new JTextField(); - textField_3.setBounds(367, 100, 151, 20); - frame.getContentPane().add(textField_3); - textField_3.setColumns(10); - - JLabel lblNewLabel_5 = new JLabel("Password"); - lblNewLabel_5.setBounds(39, 175, 65, 14); - frame.getContentPane().add(lblNewLabel_5); - - //Password to md5 - passwordField = new JPasswordField(); - passwordField.setBounds(129, 172, 122, 20); - frame.getContentPane().add(passwordField); - String encrpytedPassword = DigestUtils.md5Hex(passwordField.getText()); - - - JLabel lblNewLabel_6 = new JLabel("Confirm Password"); - lblNewLabel_6.setBounds(263, 175, 117, 14); - frame.getContentPane().add(lblNewLabel_6); - - passwordField_1 = new JPasswordField(); - passwordField_1.setBounds(390, 172, 122, 20); - frame.getContentPane().add(passwordField_1); - - JLabel lblNewLabel_7 = new JLabel("Account Type"); - lblNewLabel_7.setBounds(112, 224, 79, 14); - frame.getContentPane().add(lblNewLabel_7); - - JRadioButton rdbtnNewRadioButton = new JRadioButton("Client"); - rdbtnNewRadioButton.addActionListener(new ActionListener() { - - // Selection of the radio button - public void actionPerformed(ActionEvent arg0) { - if (rdbtnNewRadioButton.isSelected()) - person = "C"; - } - }); - rdbtnNewRadioButton.setBounds(208, 220, 65, 23); - frame.getContentPane().add(rdbtnNewRadioButton); - - JRadioButton rdbtnNewRadioButton_1 = new JRadioButton("Office Advisor"); - rdbtnNewRadioButton_1.addActionListener(new ActionListener() { - - // Radio button selection Office Advisor - public void actionPerformed(ActionEvent e) { - if (rdbtnNewRadioButton_1.isSelected()) - person = "A"; - } - }); - rdbtnNewRadioButton_1.setBounds(275, 220, 105, 23); - frame.getContentPane().add(rdbtnNewRadioButton_1); - - JRadioButton rdbtnNewRadioButton_2 = new JRadioButton("Manager"); - rdbtnNewRadioButton_2.addActionListener(new ActionListener() { - - // Radio button selection Manager - public void actionPerformed(ActionEvent e) { - if (rdbtnNewRadioButton_2.isSelected()) - person = "M"; - } - }); - rdbtnNewRadioButton_2.setBounds(381, 220, 109, 23); - frame.getContentPane().add(rdbtnNewRadioButton_2); - - // Button Group - ButtonGroup bg = new ButtonGroup(); - bg.add(rdbtnNewRadioButton); - bg.add(rdbtnNewRadioButton_1); - bg.add(rdbtnNewRadioButton_2); - - // Create Account button - Random rand = new Random(); - JButton btnNewButton = new JButton("CREATE"); - btnNewButton.addActionListener(new ActionListener() { - - // Create an account button action - public void actionPerformed(ActionEvent e) { - - // for creating an account number - String accountNumber = null; - String IBAN = null; - String BIC = null; - - accountNumber = "SWISSFR" + rand.nextInt(9999) + 1; - - BIC = "" + rand.nextInt(9999) + 1; - - IBAN = "FR" + rand.nextInt(9999) + BIC + 1 + rand.nextInt(9999) + 1 + accountNumber; - - if (person.equals("C")) { - String query = "insert into accounts(email,password,account_type,username) values(?,?,?,?)"; - String query2 = "insert into clienttable(accountNo,iban,BIC,accountType,email) values (?,?,?,?,?)"; - - try { - PreparedStatement pst = connection.prepareStatement(query); - - pst.setString(1, textField_3.getText()); - pst.setString(2, encrpytedPassword); - pst.setString(3, person); - pst.setString(4, textField_2.getText()); - pst.execute(); - pst = connection.prepareStatement(query2); - pst.setString(1, accountNumber); - pst.setString(2, IBAN); - pst.setString(3, BIC); - pst.setString(4, person); - pst.setString(5, textField_3.getText()); - pst.execute(); - - } catch (SQLException e1) { - - e1.printStackTrace(); - } - } - - if(person.equals("A") || person.equals("M")) - { - String query = "insert into accounts(email,password,account_type,username) values(?,?,?,?)"; - try { - PreparedStatement pst = connection.prepareStatement(query); - - pst.setString(1, textField_3.getText()); - pst.setString(2, encrpytedPassword); - pst.setString(3, person); - pst.setString(4, textField_2.getText()); - pst.execute(); - } catch (SQLException e1) { - - e1.printStackTrace(); - } - } - - JOptionPane.showMessageDialog(frame, "Account Created Successfully"); - - frame.dispose(); - Login log = new Login(); - log.frame.setVisible(true); - - } - }); - btnNewButton.setBounds(268, 266, 89, 23); - frame.getContentPane().add(btnNewButton); - - // BACK BUTTON TAKES TO the login screen - JButton btnNewButton_1 = new JButton("BACK"); - btnNewButton_1.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - frame.dispose(); - Login login1 = new Login(); - login1.frame.setVisible(true); - } - }); - btnNewButton_1.setBounds(10, 294, 89, 23); - frame.getContentPane().add(btnNewButton_1); - } -} diff --git a/DBConnector.java b/DBConnector.java deleted file mode 100644 index 312dc51..0000000 --- a/DBConnector.java +++ /dev/null @@ -1,19 +0,0 @@ -package bankingsystemswing; - -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; - -public class DBConnector { - - public static Connection getConnection() throws SQLException, ClassNotFoundException { - Class.forName("com.mysql.cj.jdbc.Driver"); - - Connection connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/banksystem", "root", ""); - - return connection; - - } -} diff --git a/GenerateReport.java b/GenerateReport.java deleted file mode 100644 index 56a4fa2..0000000 --- a/GenerateReport.java +++ /dev/null @@ -1,31 +0,0 @@ -package bankingsystemswing; - -import java.io.FileOutputStream; -import java.io.OutputStream; - -import org.apache.poi.hssf.usermodel.HSSFWorkbook; -import org.apache.poi.sl.usermodel.Sheet; -import org.apache.poi.ss.usermodel.Cell; -import org.apache.poi.ss.usermodel.Row; -import org.apache.poi.ss.usermodel.Workbook; - -public class GenerateReport { - - GenerateReport() - { - Workbook wb = new HSSFWorkbook(); - - try(OutputStream fileOut = new FileOutputStream("Generated Report.xls")) { - Sheet sheet1 = (Sheet) wb.createSheet("Main Sheet"); - - Row row = ((org.apache.poi.ss.usermodel.Sheet) sheet1).createRow(2); - Cell cell = row.createCell(5); - cell.setCellValue("Satyenda Chandan is there!!! !!!!! !!!"); - wb.write(fileOut); - - }catch(Exception e) { - System.out.println(e.getMessage()); - } - - } -} diff --git a/GlobalVariable.java b/GlobalVariable.java deleted file mode 100644 index 286cf8f..0000000 --- a/GlobalVariable.java +++ /dev/null @@ -1,102 +0,0 @@ -package bankingsystemswing; - -import java.sql.ResultSet; - -public class GlobalVariable { - - private static GlobalVariable instance = null; - - private String login; - private String iban1; - private String accountNumber; - private String bic; - private Float balance; - private String filename; - private String password; - ResultSet rs2 ; - - //Email - public String getLogin() { - return login; - } - - public void setLogin(String login) { - this.login = login; - } - - //IBAN - public String getIban1() { - return iban1; - } - - public void setIban1(String iban1) { - this.iban1 = iban1; - } - - //Account Number - public String getAccountNumber() { - return accountNumber; - } - - public void setAccountNumber(String accountNumber) { - this.accountNumber = accountNumber; - } - - //BIC Code - public String getBicNumber() { - return bic; - } - - public void setBicNumber(String bic) { - this.bic = bic; - } - - //Balance - public Float getBalance() { - return balance; - } - - public void setBalance(Float balance) { - this.balance = balance; - } - - //File name - public String getFileName() { - return filename; - } - - public void setFileName(String filename) { - this.filename = filename; - } - - //ResultSet rs2 - - public void setResultSet(ResultSet prepare) - { - this.rs2 = prepare; - - } - - public ResultSet getResultSet() - { - return rs2; - } - - - //Password - public String getPassword() { - return password; - } - - public void setPassword(String Password) { - this.password = Password; - } - - - public static synchronized GlobalVariable getInstance() { - if (instance == null) - instance = new GlobalVariable(); - return instance; - } - -} diff --git a/GlobalVariableExternalRecipient.java b/GlobalVariableExternalRecipient.java deleted file mode 100644 index 86d9389..0000000 --- a/GlobalVariableExternalRecipient.java +++ /dev/null @@ -1,65 +0,0 @@ -package bankingsystemswing; - -public class GlobalVariableExternalRecipient { - - private static GlobalVariableExternalRecipient instance = null; - - private String login; - private String iban1; - private String accountNumber; - private String bic; - private Float balance; - - //Email - public String getLogin() { - return login; - } - - public void setLogin(String login) { - this.login = login; - } - - //IBAN - public String getIban1() { - return iban1; - } - - public void setIban1(String iban1) { - this.iban1 = iban1; - } - - //Account Number - public String getAccountNumber() { - return accountNumber; - } - - public void setAccountNumber(String accountNumber) { - this.accountNumber = accountNumber; - } - - //BIC Code - public String getBicNumber() { - return bic; - } - - public void setBicNumber(String bic) { - this.bic = bic; - } - - //Balance - public Float getBalance() { - return balance; - } - - public void setBalance(Float balance) { - this.balance = balance; - } - - - public static synchronized GlobalVariableExternalRecipient getInstance() { - if (instance == null) - instance = new GlobalVariableExternalRecipient(); - return instance; - } - -} diff --git a/GlobalVariableOfficeAdvisorEmail.java b/GlobalVariableOfficeAdvisorEmail.java deleted file mode 100644 index 3ce6da4..0000000 --- a/GlobalVariableOfficeAdvisorEmail.java +++ /dev/null @@ -1,23 +0,0 @@ -package bankingsystemswing; - -public class GlobalVariableOfficeAdvisorEmail { - - private static GlobalVariableOfficeAdvisorEmail instance = null; - - private String email; - - public String getEmail() { - return email; - } - - public void setEmail(String email) { - this.email = email; - } - - public static synchronized GlobalVariableOfficeAdvisorEmail getInstance() { - if (instance == null) - instance = new GlobalVariableOfficeAdvisorEmail(); - return instance; - } - -} diff --git a/Login.java b/Login.java deleted file mode 100644 index 9f973e4..0000000 --- a/Login.java +++ /dev/null @@ -1,215 +0,0 @@ -package bankingsystemswing; - -import java.awt.Button; -import java.awt.EventQueue; -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.Random; - -import javax.swing.JFrame; -import javax.swing.JLabel; -import javax.swing.JOptionPane; -import javax.swing.JTextField; - -import org.apache.commons.codec.digest.DigestUtils; - -import javax.swing.ButtonGroup; -import javax.swing.JButton; -import javax.swing.JPasswordField; -import javax.swing.JRadioButton; -import java.awt.event.ActionListener; -import java.awt.event.ActionEvent; -import java.awt.Font; -import java.awt.Color; - -public class Login { - - JFrame frame; - private JTextField textField; - private JPasswordField passwordField; - private String emailID; - - /** - * Launch the application. - */ - public static void main(String[] args) { - EventQueue.invokeLater(new Runnable() { - public void run() { - try { - Login window = new Login(); - window.frame.setVisible(true); - } catch (Exception e) { - e.printStackTrace(); - } - } - }); - } - - /** - * Create the application. - */ - public Login() { - initialize(); - } - - /** - * Initialize the contents of the frame. - */ - Connection connection = null; - private String accountType; - private String accountNumber; - - private void initialize() { - - try { - connection = DBConnector.getConnection(); - } catch (ClassNotFoundException e1) { - - e1.printStackTrace(); - } catch (SQLException e1) { - - e1.printStackTrace(); - } - - frame = new JFrame(); - frame.setBounds(100, 100, 450, 300); - frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); - frame.getContentPane().setLayout(null); - - JLabel lblNewLabel = new JLabel("Email"); - lblNewLabel.setBounds(63, 77, 89, 14); - frame.getContentPane().add(lblNewLabel); - - JLabel lblNewLabel_1 = new JLabel("SWISS BANK SYSTEM"); - lblNewLabel_1.setForeground(Color.BLUE); - lblNewLabel_1.setFont(new Font("Tahoma", Font.PLAIN, 14)); - lblNewLabel_1.setBounds(151, 11, 212, 27); - frame.getContentPane().add(lblNewLabel_1); - - textField = new JTextField(); - textField.setBounds(173, 74, 155, 20); - frame.getContentPane().add(textField); - textField.setColumns(10); - - // Encrpyted password - passwordField = new JPasswordField(); - passwordField.setBounds(173, 111, 155, 20); - frame.getContentPane().add(passwordField); - String encryptedPassword = DigestUtils.md5Hex(passwordField.getText()); - - JLabel lblNewLabel_2 = new JLabel("password"); - lblNewLabel_2.setBounds(63, 114, 89, 14); - frame.getContentPane().add(lblNewLabel_2); - - JButton btnNewButton = new JButton("Login"); - btnNewButton.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - - emailID = textField.getText(); - - AddMoneyClient amc = new AddMoneyClient(); - amc.setEmailID(emailID); - - String query = "select email, password,account_type from accounts where email=? and password =? and account_type = ? "; - - try { - PreparedStatement pst = connection.prepareStatement(query); - pst.setString(1, textField.getText()); - pst.setString(2, encryptedPassword ); - pst.setString(3, accountType); - ResultSet rs = pst.executeQuery(); - - int count = 0; - - while (rs.next()) { - count++; - accountType = rs.getString("account_type"); - - } - - if (count == 1 && accountType.equals("C")) { - - GlobalVariable.getInstance().setLogin(textField.getText()); - frame.dispose(); - ClientInformation window = new ClientInformation(); - window.frmClientInformation.setVisible(true); - - } else if (count == 1 && accountType.equals("M")) { - frame.dispose(); - Manager1 window = new Manager1(); - window.frame.setVisible(true); - } else if (count == 1 && accountType.equals("A")) { - frame.dispose(); - officeAdvisor window = new officeAdvisor(); - window.frame.setVisible(true); - } else if (count > 1 || count == 0) { - JOptionPane.showMessageDialog(frame, "Enter Correct password"); - } - } catch (SQLException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); - } - - } - }); - btnNewButton.setBounds(176, 178, 89, 23); - frame.getContentPane().add(btnNewButton); - - JRadioButton rbClient = new JRadioButton("Client"); - rbClient.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - - if (rbClient.isSelected()) - accountType = "C"; - - } - }); - rbClient.setBounds(94, 148, 89, 23); - frame.getContentPane().add(rbClient); - - JRadioButton rbAdvisor = new JRadioButton("Advisor"); - rbAdvisor.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - if (rbAdvisor.isSelected()) - accountType = "A"; - } - }); - rbAdvisor.setBounds(193, 148, 92, 23); - frame.getContentPane().add(rbAdvisor); - - JRadioButton rbManager = new JRadioButton("Manager"); - rbManager.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - if (rbManager.isSelected()) - accountType = "M"; - } - }); - rbManager.setBounds(295, 148, 109, 23); - frame.getContentPane().add(rbManager); - - ButtonGroup bg = new ButtonGroup(); - bg.add(rbClient); - bg.add(rbAdvisor); - bg.add(rbManager); - - // CREATE ACCOUNT FRAME - JButton btnCreateAccount = new JButton("CREATE ACCOUNT"); - btnCreateAccount.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - frame.dispose(); - CreateAccount ca = new CreateAccount(); - ca.frame.setVisible(true); - } - }); - btnCreateAccount.setBounds(282, 227, 142, 23); - frame.getContentPane().add(btnCreateAccount); - - JLabel lblNewLabel_3 = new JLabel("Login"); - lblNewLabel_3.setBounds(203, 49, 46, 14); - frame.getContentPane().add(lblNewLabel_3); - - } -} diff --git a/Manager1.java b/Manager1.java deleted file mode 100644 index 69f5b80..0000000 --- a/Manager1.java +++ /dev/null @@ -1,260 +0,0 @@ -package bankingsystemswing; - -import java.awt.EventQueue; - -import javax.swing.JFrame; -import javax.swing.JLabel; -import javax.swing.JOptionPane; - -import java.awt.Font; -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Time; -import java.text.DateFormat; -import java.text.ParseException; -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Date; -import java.util.regex.Pattern; - -import javax.swing.JButton; -import javax.swing.JFileChooser; -import javax.swing.JTable; - -import org.apache.poi.hssf.usermodel.HSSFRow; -import org.apache.poi.hssf.usermodel.HSSFSheet; -import org.apache.poi.hssf.usermodel.HSSFWorkbook; - -import javax.swing.JScrollPane; -import com.toedter.calendar.JDateChooser; - -import net.proteanit.sql.DbUtils; -import java.awt.event.ActionListener; -import java.io.File; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.IOException; -import java.awt.event.ActionEvent; - -public class Manager1 extends Thread { - - JFrame frame; - private JTable table; - - /** - * Launch the application. - */ - public static void main(String[] args) { - EventQueue.invokeLater(new Runnable() { - public void run() { - try { - Manager1 window = new Manager1(); - window.frame.setVisible(true); - } catch (Exception e) { - e.printStackTrace(); - } - } - }); - } - - /** - * Create the application. - */ - public Manager1() { - initialize(); - } - - /** - * Initialize the contents of the frame. - */ - - Connection connection = null; - - JDateChooser dateChooser; - JDateChooser dateChooser_1; - - private void initialize() { - try { - connection = DBConnector.getConnection(); - } catch (ClassNotFoundException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (SQLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - frame = new JFrame(); - frame.setBounds(100, 100, 699, 506); - frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); - frame.getContentPane().setLayout(null); - - JLabel lblNewLabel = new JLabel("MANAGER"); - lblNewLabel.setFont(new Font("Tahoma", Font.PLAIN, 16)); - lblNewLabel.setBounds(282, 22, 134, 31); - frame.getContentPane().add(lblNewLabel); - - // Get the data for a defined period - JButton btnNewButton = new JButton("SHOW"); - btnNewButton.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent arg0) { - - String date1 = dateChooser.getDate().toString(); - String date[] = date1.split(" "); - - if (date[1].equalsIgnoreCase("jan")) { - date[1] = "01"; - } else if (date[1].equalsIgnoreCase("feb")) { - date[1] = "02"; - } else if (date[1].equalsIgnoreCase("mar")) { - date[1] = "03"; - } else if (date[1].equalsIgnoreCase("apr")) { - date[1] = "04"; - } else if (date[1].equalsIgnoreCase("may")) { - date[1] = "05"; - } else if (date[1].equalsIgnoreCase("jun")) { - date[1] = "06"; - } else if (date[1].equalsIgnoreCase("jul")) { - date[1] = "07"; - } else if (date[1].equalsIgnoreCase("aug")) { - date[1] = "08"; - } else if (date[1].equalsIgnoreCase("sep")) { - date[1] = "09"; - } else if (date[1].equalsIgnoreCase("oct")) { - date[1] = "10"; - } else if (date[1].equalsIgnoreCase("nov")) { - date[1] = "11"; - } else if (date[1].equalsIgnoreCase("dec")) { - date[1] = "12"; - } - String date2 = date[5] + "-" + date[1] + "-" + date[2]; - - String date3 = dateChooser_1.getDate().toString(); - String date4[] = date3.split(" "); - - if (date4[1].equalsIgnoreCase("jan")) { - date4[1] = "01"; - } else if (date4[1].equalsIgnoreCase("feb")) { - date4[1] = "02"; - } else if (date4[1].equalsIgnoreCase("mar")) { - date4[1] = "03"; - } else if (date4[1].equalsIgnoreCase("apr")) { - date4[1] = "04"; - } else if (date4[1].equalsIgnoreCase("may")) { - date4[1] = "05"; - } else if (date4[1].equalsIgnoreCase("jun")) { - date4[1] = "06"; - } else if (date4[1].equalsIgnoreCase("jul")) { - date4[1] = "07"; - } else if (date4[1].equalsIgnoreCase("aug")) { - date4[1] = "08"; - } else if (date4[1].equalsIgnoreCase("sep")) { - date4[1] = "09"; - } else if (date4[1].equalsIgnoreCase("oct")) { - date4[1] = "10"; - } else if (date4[1].equalsIgnoreCase("nov")) { - date4[1] = "11"; - } else if (date4[1].equalsIgnoreCase("dec")) { - date4[1] = "12"; - } - - String date5 = date4[5] + "-" + date4[1] + "-" + date4[2]; - - String query = "select clienttable.firstName,clienttable.lastName,clienttable.email, transactiontable.debit as deposit from clienttable join transactiontable on\r\n" - + "clienttable.email = transactiontable.email where transactiontable.dateOfTransaction between ? and ?"; - - try { - - - PreparedStatement pst = connection.prepareStatement(query); - pst.setString(1, date2); - pst.setString(2, date5); - ResultSet rs = pst.executeQuery(); - - table.setModel(DbUtils.resultSetToTableModel(rs)); - GlobalVariable.getInstance().setResultSet(pst.executeQuery()); - - - } catch (SQLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - } - }); - btnNewButton.setBounds(271, 102, 89, 23); - frame.getContentPane().add(btnNewButton); - - JScrollPane scrollPane = new JScrollPane(); - scrollPane.setBounds(10, 146, 663, 280); - frame.getContentPane().add(scrollPane); - - table = new JTable(); - scrollPane.setViewportView(table); - - // Generate Report using Apache POI - JButton btnNewButton_1 = new JButton("GENERATE REPORT"); - btnNewButton_1.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent arg0) { - - // TO DO - JFileChooser chooser = new JFileChooser(); - chooser.showOpenDialog(null); - File f = chooser.getSelectedFile(); - GlobalVariable.getInstance().setFileName(f.getAbsolutePath()); - System.out.println(GlobalVariable.getInstance().getFileName()); - - JOptionPane.showMessageDialog(frame, "File Saved Sucessfully"); - - HSSFWorkbook workbook = new HSSFWorkbook(); - HSSFSheet sheet = workbook.createSheet("lawix10"); - HSSFRow rowhead = sheet.createRow(0); - rowhead.createCell(0).setCellValue("First Name"); - rowhead.createCell(1).setCellValue("Last Name"); - rowhead.createCell(2).setCellValue("Email"); - rowhead.createCell(3).setCellValue("Deposit"); - - ResultSet rs3 = GlobalVariable.getInstance().getResultSet(); - int i = 1; - try { - while (rs3.next()) { - HSSFRow row = sheet.createRow((short) i); - row.createCell((short) 0).setCellValue(rs3.getString("clienttable.firstName")); - row.createCell((short) 1).setCellValue(rs3.getString("clienttable.lastName")); - row.createCell((short) 2).setCellValue(rs3.getString("clienttable.email")); - row.createCell((short) 3).setCellValue(rs3.getString("deposit")); - i++; - - } - - String yemi = GlobalVariable.getInstance().getFileName(); - System.out.println("yemi " + yemi); - FileOutputStream fileOut = new FileOutputStream(yemi); - workbook.write(fileOut); - fileOut.close(); - - } catch (SQLException | IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - } - }); - btnNewButton_1.setBounds(487, 433, 134, 23); - frame.getContentPane().add(btnNewButton_1); - - dateChooser = new JDateChooser(); - dateChooser.setBounds(77, 65, 134, 20); - frame.getContentPane().add(dateChooser); - - JLabel lblNewLabel_1 = new JLabel("TO"); - lblNewLabel_1.setBounds(292, 64, 46, 14); - frame.getContentPane().add(lblNewLabel_1); - - dateChooser_1 = new JDateChooser(); - dateChooser_1.setBounds(438, 65, 134, 20); - frame.getContentPane().add(dateChooser_1); - - } -} diff --git a/New Text Document.txt b/New Text Document.txt deleted file mode 100644 index 1271944..0000000 --- a/New Text Document.txt +++ /dev/null @@ -1 +0,0 @@ -new file \ No newline at end of file diff --git a/OfficeAdvisorClientInformation.java b/OfficeAdvisorClientInformation.java deleted file mode 100644 index fd7fafd..0000000 --- a/OfficeAdvisorClientInformation.java +++ /dev/null @@ -1,301 +0,0 @@ -package bankingsystemswing; - -import java.awt.EventQueue; - -import javax.swing.JFrame; -import javax.swing.JLabel; -import java.awt.Font; -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; - -import javax.swing.JButton; -import java.awt.event.ActionListener; -import java.awt.event.ActionEvent; - -public class OfficeAdvisorClientInformation { - - JFrame frame; - - /** - * Launch the application. - */ - public static void main(String[] args) { - EventQueue.invokeLater(new Runnable() { - public void run() { - try { - OfficeAdvisorClientInformation window = new OfficeAdvisorClientInformation(); - window.frame.setVisible(true); - } catch (Exception e) { - e.printStackTrace(); - } - } - }); - } - - /** - * Create the application. - */ - public OfficeAdvisorClientInformation() { - initialize(); - } - - /** - * Initialize the contents of the frame. - */ - - Connection connection = null; - - private void initialize() { - - try { - connection = DBConnector.getConnection(); - } catch (ClassNotFoundException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); - } catch (SQLException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); - } - frame = new JFrame(); - frame.setBounds(100, 100, 664, 561); - frame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); - frame.getContentPane().setLayout(null); - - JLabel lblClientInformation = new JLabel("CLIENT INFORMATION"); - lblClientInformation.setFont(new Font("Tahoma", Font.PLAIN, 16)); - lblClientInformation.setBounds(274, 11, 187, 31); - frame.getContentPane().add(lblClientInformation); - - JLabel lblFirstName = new JLabel("First Name"); - lblFirstName.setBounds(24, 71, 82, 14); - frame.getContentPane().add(lblFirstName); - - JLabel lblLastName = new JLabel("Last Name"); - lblLastName.setBounds(24, 96, 82, 14); - frame.getContentPane().add(lblLastName); - - JLabel lblDob = new JLabel("DOB"); - lblDob.setBounds(23, 121, 46, 14); - frame.getContentPane().add(lblDob); - - JLabel label = new JLabel(""); - label.setBounds(24, 146, 62, 14); - frame.getContentPane().add(label); - - JLabel lblGender = new JLabel("Gender"); - lblGender.setBounds(24, 146, 46, 14); - frame.getContentPane().add(lblGender); - - JLabel lblTelephone = new JLabel("Telephone"); - lblTelephone.setBounds(24, 184, 82, 14); - frame.getContentPane().add(lblTelephone); - - JLabel lblMarried = new JLabel("Married"); - lblMarried.setBounds(24, 209, 62, 14); - frame.getContentPane().add(lblMarried); - - JLabel lblSpouceName = new JLabel("Spouce Name"); - lblSpouceName.setBounds(24, 234, 94, 14); - frame.getContentPane().add(lblSpouceName); - - JLabel lblBankAgency = new JLabel("Bank Agency"); - lblBankAgency.setBounds(23, 259, 83, 14); - frame.getContentPane().add(lblBankAgency); - - JLabel lblAddress = new JLabel("Address"); - lblAddress.setBounds(24, 284, 69, 14); - frame.getContentPane().add(lblAddress); - - JLabel lblhouse = new JLabel("New label"); - lblhouse.setBounds(124, 284, 202, 14); - frame.getContentPane().add(lblhouse); - - JLabel lblneighbourhood = new JLabel("New label"); - lblneighbourhood.setBounds(124, 309, 202, 14); - frame.getContentPane().add(lblneighbourhood); - - JLabel lblcity = new JLabel("New label"); - lblcity.setBounds(124, 334, 202, 14); - frame.getContentPane().add(lblcity); - - JLabel lblcountry = new JLabel("New label"); - lblcountry.setBounds(124, 359, 202, 14); - frame.getContentPane().add(lblcountry); - - JLabel lblzip = new JLabel("New label"); - lblzip.setBounds(124, 384, 202, 14); - frame.getContentPane().add(lblzip); - - JLabel lblBankagency = new JLabel("New label"); - lblBankagency.setBounds(124, 259, 202, 14); - frame.getContentPane().add(lblBankagency); - - JLabel lblSpouce = new JLabel("New label"); - lblSpouce.setBounds(124, 234, 202, 14); - frame.getContentPane().add(lblSpouce); - - JLabel lblNewLabel = new JLabel("New label"); - lblNewLabel.setBounds(124, 209, 202, 14); - frame.getContentPane().add(lblNewLabel); - - JLabel lblNewLabel_1 = new JLabel("New label"); - lblNewLabel_1.setBounds(124, 184, 202, 14); - frame.getContentPane().add(lblNewLabel_1); - - JLabel lblNewLabel_2 = new JLabel("New label"); - lblNewLabel_2.setBounds(124, 146, 202, 14); - frame.getContentPane().add(lblNewLabel_2); - - JLabel lblNewLabel_3 = new JLabel("New label"); - lblNewLabel_3.setBounds(124, 121, 202, 14); - frame.getContentPane().add(lblNewLabel_3); - - JLabel lblNewLabel_4 = new JLabel("New label"); - lblNewLabel_4.setBounds(124, 96, 202, 14); - frame.getContentPane().add(lblNewLabel_4); - - JLabel lblNewLabel_5 = new JLabel("New label"); - lblNewLabel_5.setBounds(124, 71, 202, 14); - frame.getContentPane().add(lblNewLabel_5); - - JLabel lblOccupation = new JLabel("Occupation"); - lblOccupation.setBounds(370, 71, 82, 14); - frame.getContentPane().add(lblOccupation); - - JLabel lblNationality = new JLabel("Nationality"); - lblNationality.setBounds(370, 96, 82, 14); - frame.getContentPane().add(lblNationality); - - JLabel lblMobile = new JLabel("Mobile"); - lblMobile.setBounds(370, 121, 62, 14); - frame.getContentPane().add(lblMobile); - - JLabel lblBirthPlace = new JLabel("Birth Place"); - lblBirthPlace.setBounds(370, 146, 82, 14); - frame.getContentPane().add(lblBirthPlace); - - JLabel lblChildren = new JLabel("Children"); - lblChildren.setBounds(370, 171, 72, 14); - frame.getContentPane().add(lblChildren); - - - //Back button dispose frame - JButton btnBack = new JButton("Back"); - btnBack.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent arg0) { - frame.dispose(); - - } - }); - btnBack.setBounds(10, 422, 89, 23); - frame.getContentPane().add(btnBack); - - //Show Transaction of the client when clicked - JButton btnShowTransaction = new JButton("Show Transaction "); - btnShowTransaction.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent arg0) { - - OfficeAdvisorTransaction oat = new OfficeAdvisorTransaction(); - oat.frame.setVisible(true); - - - } - }); - btnShowTransaction.setBounds(233, 422, 121, 23); - frame.getContentPane().add(btnShowTransaction); - - JLabel lblBalance = new JLabel("BALANCE"); - lblBalance.setFont(new Font("Tahoma", Font.PLAIN, 14)); - lblBalance.setBounds(387, 259, 94, 23); - frame.getContentPane().add(lblBalance); - - JLabel lblNewLabel_6 = new JLabel("New label"); - lblNewLabel_6.setBounds(378, 309, 74, 14); - frame.getContentPane().add(lblNewLabel_6); - - JLabel lblNewLabel_7 = new JLabel("\u20AC"); - lblNewLabel_7.setBounds(457, 309, 46, 14); - frame.getContentPane().add(lblNewLabel_7); - - JLabel lbloccup = new JLabel("New label"); - lbloccup.setBounds(478, 71, 160, 14); - frame.getContentPane().add(lbloccup); - - JLabel lblnation = new JLabel("New label"); - lblnation.setBounds(478, 96, 160, 14); - frame.getContentPane().add(lblnation); - - JLabel lblmobile = new JLabel("New label"); - lblmobile.setBounds(478, 121, 160, 14); - frame.getContentPane().add(lblmobile); - - JLabel lblbirthplc = new JLabel("New label"); - lblbirthplc.setBounds(478, 146, 160, 14); - frame.getContentPane().add(lblbirthplc); - - JLabel lblchild = new JLabel("New label"); - lblchild.setBounds(478, 171, 160, 14); - frame.getContentPane().add(lblchild); - - String query = "Select firstName,LastName,dateOfBirth,telephone,house,neighbourhood,city,country,zipcode,occupation,mobile,nationality,Married,spouceName,birthPlace,children,bankAgency from clienttable where email=?"; - - try { - PreparedStatement pst = connection.prepareStatement(query); - officeAdvisor oa = new officeAdvisor(); - - pst.setString(1,GlobalVariableOfficeAdvisorEmail.getInstance().getEmail() ); - ResultSet rs = pst.executeQuery(); - - while(rs.next()) - { - lblNewLabel_5.setText(rs.getString("firstName")); - lblNewLabel_4.setText(rs.getString("lastName")); - lblNewLabel_3.setText(rs.getString("dateOfBirth")); - lblNewLabel_1.setText(rs.getString("telephone")); - lblhouse.setText(rs.getString("house")); - lblneighbourhood.setText(rs.getString("neighbourhood")); - lblcity.setText(rs.getString("city")); - lblcountry.setText(rs.getString("country")); - lblzip.setText(rs.getString("zipcode")); - lblNewLabel.setText(rs.getString("Married")); - lblSpouce.setText(rs.getString("spouceName")); - lblBankagency.setText(rs.getString("bankAgency")); - lbloccup.setText(rs.getString("occupation")); - lblnation.setText(rs.getString("nationality")); - lblmobile.setText(rs.getString("mobile")); - lblbirthplc.setText(rs.getString("birthPlace")); - lblchild.setText(rs.getString("children")); - - - } - - } catch (SQLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - - //For Balance - - String query2 = "select balance from balancetable where email=?"; - try { - PreparedStatement pst1 = connection.prepareStatement(query2); - pst1.setString(1, GlobalVariableOfficeAdvisorEmail.getInstance().getEmail()); - - ResultSet rs2 = pst1.executeQuery(); - - while(rs2.next()) { - - lblNewLabel_6.setText(rs2.getString("balance")); - - } - } catch (SQLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - - } -} diff --git a/OfficeAdvisorTransaction.java b/OfficeAdvisorTransaction.java deleted file mode 100644 index 194d822..0000000 --- a/OfficeAdvisorTransaction.java +++ /dev/null @@ -1,115 +0,0 @@ -package bankingsystemswing; - -import java.awt.EventQueue; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; - -import javax.swing.JButton; -import javax.swing.JFrame; -import javax.swing.JScrollPane; -import javax.swing.JTable; - -import net.proteanit.sql.DbUtils; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; -import javax.swing.ListSelectionModel; - -public class OfficeAdvisorTransaction { - - JFrame frame; - - /** - * Launch the application. - */ - public static void main(String[] args) { - EventQueue.invokeLater(new Runnable() { - public void run() { - try { - OfficeAdvisorTransaction window = new OfficeAdvisorTransaction(); - window.frame.setVisible(true); - } catch (Exception e) { - e.printStackTrace(); - } - } - }); - } - - /** - * Create the application. - */ - public OfficeAdvisorTransaction() { - initialize(); - } - - /** - * Initialize the contents of the frame. - */ - - Connection connection = null; - private JTable table; - private JScrollPane scrollPane; - - private JButton btnBack; - - private void initialize() { - - try { - connection = DBConnector.getConnection(); - - } catch (ClassNotFoundException e1) { - - e1.printStackTrace(); - } catch (SQLException e1) { - - e1.printStackTrace(); - } - - frame = new JFrame(); - frame.setBounds(100, 100, 1061, 601); - frame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); - frame.getContentPane().setLayout(null); - - scrollPane = new JScrollPane(); - scrollPane.setBounds(10, 11, 1025, 506); - frame.getContentPane().add(scrollPane); - - table = new JTable(); - table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); - table.setColumnSelectionAllowed(true); - table.setCellSelectionEnabled(false); - table.setEnabled(true); - table.isEnabled(); - - - - - - scrollPane.setViewportView(table); - try { - String query = "Select * from transactiontable where email=?"; - PreparedStatement pst = connection.prepareStatement(query); - pst.setString(1, GlobalVariableOfficeAdvisorEmail.getInstance().getEmail()); - ResultSet rs = pst.executeQuery(); - table.setModel(DbUtils.resultSetToTableModel(rs)); - - btnBack = new JButton("Back"); - btnBack.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - - frame.dispose(); - - } - }); - btnBack.setBounds(0, 528, 89, 23); - frame.getContentPane().add(btnBack); - } catch (Exception e) { - e.printStackTrace(); - } - - } - -} diff --git a/OnlineBanking/.classpath b/OnlineBanking/.classpath new file mode 100644 index 0000000..3ff4df2 --- /dev/null +++ b/OnlineBanking/.classpath @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/OnlineBanking/.gitignore b/OnlineBanking/.gitignore new file mode 100644 index 0000000..ae3c172 --- /dev/null +++ b/OnlineBanking/.gitignore @@ -0,0 +1 @@ +/bin/ diff --git a/OnlineBanking/.project b/OnlineBanking/.project new file mode 100644 index 0000000..4a52026 --- /dev/null +++ b/OnlineBanking/.project @@ -0,0 +1,17 @@ + + + OnlineBanking + + + + + + org.eclipse.jdt.core.javabuilder + + + + + + org.eclipse.jdt.core.javanature + + diff --git a/OnlineBanking/.settings/org.eclipse.core.resources.prefs b/OnlineBanking/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..99f26c0 --- /dev/null +++ b/OnlineBanking/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +encoding/=UTF-8 diff --git a/OnlineBanking/.settings/org.eclipse.jdt.core.prefs b/OnlineBanking/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..b635231 --- /dev/null +++ b/OnlineBanking/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,14 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=18 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=18 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=18 diff --git a/OnlineBanking/src/Accounts/Access.java b/OnlineBanking/src/Accounts/Access.java new file mode 100644 index 0000000..8e7e0ed --- /dev/null +++ b/OnlineBanking/src/Accounts/Access.java @@ -0,0 +1,163 @@ +package Accounts; + +import java.util.Scanner; + +import BankingDao.BankingSysImp; + +public class Access { + + + public static void main(String[] args) { + Scanner sc = new Scanner(System.in); + BankingSysImp ban = new BankingSysImp(); + + System.out.println("Login as "); + System.out.println("1.Admin"); + System.out.println("2.Customer"); + + int res = sc.nextInt(); + + if (res == 2) { + + System.out.println("Enter customer's email id---"); + String email = sc.next(); + System.out.println("Enter passWord---"); + int pass = sc.nextInt(); + ban.loginCus(email, pass); + + while (ban.getFlag()) { + System.out.println("Enter your choice----"); + System.out.println("1.Transfer money to another account"); + System.out.println("2.Show history"); + System.out.println("3.Exit"); + + int choice = sc.nextInt(); + + if (choice == 1) { + System.out.println("Enter the account no. in which you want to transfer the money"); + int act2 = sc.nextInt(); + System.out.println("Enter the amount"); + int mon = sc.nextInt(); + ban.withdrwal(ban.getAct(), mon); + ban.deposit(act2, mon); + + } else if (choice == 2) { + ban.showhis(ban.getAct()); + } else if (choice == 3) + break; + else + System.out.println("Invalid choice please select valid choice"); + + } + + } else if (res == 1) { + System.out.println("Enter Admin email id-"); + String email = sc.next(); + System.out.println("Enter Admin passWord-"); + int pass = sc.nextInt(); + ban.checkAct(email, pass); + + while (ban.getFlag()) { + System.out.println("Enter your choice----"); + System.out.println("1.Add new customer"); + System.out.println("2.Edit existing account detail"); + System.out.println("3.Remove existing account"); + System.out.println("4.View particular account details by account number"); + System.out.println("5.View all customer's accounts"); + System.out.println("6. deposit or withdrawl"); + System.out.println("7.Exit"); + + int choice = sc.nextInt(); + + if (choice == 7) + break; + else if (choice == 6) { + System.out.println("1.for deposit"); + System.out.println("2.for withdrawl"); + + int ch = sc.nextInt(); + + if (ch == 1) { + System.out.println("Enter account number---"); + int act = sc.nextInt(); + System.out.println("Enter amount for deposit-------"); + int rupees = sc.nextInt(); + ban.deposit(act, rupees); + } + if (ch == 2) { + System.out.println("Enter account number---"); + int act = sc.nextInt(); + System.out.println("Enter amount for withdrawl-------"); + int rupees = sc.nextInt(); + ban.withdrwal(act, rupees); + } + + } else if (choice == 1) { + System.out.println("Enter account number"); + int act = sc.nextInt(); + System.out.println("Enter customer name-- "); + sc.nextLine(); + String name = sc.nextLine(); + + System.out.println("Enter customer email ---"); + String emai = sc.next(); + System.out.println("Set customer passWord-"); + int ps = sc.nextInt(); + System.out.println("Set customer balance----"); + int bal = sc.nextInt(); + ban.insertCus(act, name, emai, ps, bal); + + } else if (choice == 2) { + + System.out.println("Give the account number of customer which you want to edit"); + int actNo = sc.nextInt(); + System.out.println("Select what you want to change-----"); + + System.out.println("1.Customer name"); + + System.out.println("2.Customer email----"); + + + System.out.println("3.Customer passWord"); + + int option = sc.nextInt(); + if (option == 1) { + System.out.println("Enter new name===="); + sc.nextLine(); + String naam = sc.nextLine(); + ban.editName(actNo, naam); + } else if (option == 2) { + System.out.println("Enter new email===="); + sc.nextLine(); + String naam = sc.nextLine(); + ban.editEmail(actNo, naam); + + } else if (option == 3) { + System.out.println("Enter new passWord==="); + + int naam = sc.nextInt(); + ban.editpass(actNo, naam); + + } else + System.out.println("Please enter correct choice"); + + } else if (choice == 3) { + System.out.println("Enter the account number of customer which you want to delete"); + int act = sc.nextInt(); + ban.deleteRecord(act); + + } else if (choice == 4) { + System.out.println("Enter the account number of customer which you want to see the detail"); + int act = sc.nextInt(); + ban.displayPerticular(act); + + } else if (choice == 5) + ban.displayAll(); + + } + System.out.println("======Thanks for visiting======="); + } else + System.out.println("Invalid choice"); + } + +} diff --git a/OnlineBanking/src/BankingDao/BankingSys.java b/OnlineBanking/src/BankingDao/BankingSys.java new file mode 100644 index 0000000..ebd7fec --- /dev/null +++ b/OnlineBanking/src/BankingDao/BankingSys.java @@ -0,0 +1,19 @@ +package BankingDao; + +public interface BankingSys { + + abstract void insertCus(int cusId,String name,String cusEmail,int pass,int bal); + abstract void deleteRecord(int actNo); + abstract void displayPerticular(int actNo); + abstract void displayAll(); + abstract void editName(int actNo,String name); + abstract void editEmail(int actNo,String email); + abstract void editpass(int actNo,int pass); + abstract void deposit(int actNo,int rs); + abstract void withdrwal(int actNo,int rs); + abstract void loginCus(String email,int pass); + abstract void showhis(int act); + + + +} diff --git a/OnlineBanking/src/BankingDao/BankingSysImp.java b/OnlineBanking/src/BankingDao/BankingSysImp.java new file mode 100644 index 0000000..4cab497 --- /dev/null +++ b/OnlineBanking/src/BankingDao/BankingSysImp.java @@ -0,0 +1,348 @@ +package BankingDao; + +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import Dbc.Connections; + +public class BankingSysImp implements BankingSys { + boolean flag = false; + int count = 0; + int act = 0; + + public int getAct() { + return act; + } + + public void setAct(int act) { + this.act = act; + } + + public int getCount() { + return count; + } + + public void setCount(int count) { + this.count = count; + } + + public void setFlag(boolean flag) { + this.flag = flag; + } + + public boolean getFlag() { + return flag; + } + + public void checkAct(String em, int ps) { + count++; + + Connection con = Connections.getConnection(); + try { + PreparedStatement act = con.prepareStatement("select * from Accountant"); + ResultSet rs = act.executeQuery(); + + while (rs.next()) { + + String email = rs.getString("email"); + + int password = rs.getInt("pass"); + + if (em.equalsIgnoreCase(email) && password == ps) { + flag = true; + System.out.println(" Admin logged in successfully "); + System.out.println(); + + } else + System.out.println("invalid credentials!!"); + System.out.println("Please try again"); + } + } catch (SQLException ex) { + ex.getMessage(); + } + + } + + @Override + public void insertCus(int cusId, String name, String cusEmail, int pass, int bal) { + System.out.println(count); + if (flag) { + Connection con = Connections.getConnection(); + try { + PreparedStatement act = con.prepareStatement("insert into customer values(?,?,?,?,?)"); + act.setInt(1, cusId); + act.setString(2, name); + act.setString(3, cusEmail); + act.setInt(4, pass); + act.setInt(5, bal); + + int x = act.executeUpdate(); + System.out.println(x + "record added successfully"); + System.out.println(); + + } catch (SQLException e) { + e.printStackTrace(); + } + } else + System.out.println("kindly login first!!!!"); + System.out.println(); + + } + + @Override + public void deleteRecord(int actNo) { + + Connection con = Connections.getConnection(); + + try { + PreparedStatement ps = con.prepareStatement("delete from customer where actNo=?"); + ps.setInt(1, actNo); + int x = ps.executeUpdate(); + System.out.println(x + " record deleted sucessfully"); + System.out.println(); + } catch (SQLException e) { + System.out.println("Record not found"); + System.out.println(); + } + + } + + @Override + public void displayPerticular(int actNo) { + Connection con = Connections.getConnection(); + try { + PreparedStatement ps = con.prepareStatement("select * from customer where actNo=?"); + ps.setInt(1, actNo); + ResultSet rs = ps.executeQuery(); + display(rs); + } catch (SQLException e) { + e.printStackTrace(); + } + + } + + public void display(ResultSet rs) { + if (rs == null) + System.out.println("No record found"); + System.out.println(); + try { + while (rs.next()) { + System.out.println("customer account number- " + rs.getInt("actNo")); + System.out.println(); + System.out.println("customer name- " + rs.getString("name")); + System.out.println(); + System.out.println("customer email- " + rs.getString("email")); + System.out.println(); + System.out.println("customer password- " + rs.getInt("pass")); + System.out.println(); + System.out.println("customer balance - " + rs.getString("bal")); + System.out.println(); + System.out.print("=========================================="); + } + + } catch (SQLException e) { + e.printStackTrace(); + } + } + + @Override + public void displayAll() { + + Connection con = Connections.getConnection(); + try { + PreparedStatement ps = con.prepareStatement("select * from customer "); + ResultSet rs = ps.executeQuery(); + display(rs); + } catch (SQLException e) { + e.printStackTrace(); + } + + } + + @Override + public void editName(int actNo, String name) { + + Connection con = Connections.getConnection(); + try { + PreparedStatement ps = con.prepareStatement("update customer set name=? where actNo=? "); + ps.setString(1, name); + ps.setInt(2, actNo); + + int x = ps.executeUpdate(); + if (x > 0) + System.out.println(x + " row affeted"); + + } catch (SQLException e) { + System.out.println("not updated try again"); + } + } + + @Override + public void editEmail(int actNo, String email) { + Connection con = Connections.getConnection(); + try { + PreparedStatement ps = con.prepareStatement("update customer set email=? where actNo=? "); + ps.setString(1, email); + ps.setInt(2, actNo); + int x = ps.executeUpdate(); + if (x > 0) + System.out.println(x + " row affeted"); + + } catch (SQLException e) { + System.out.println("not updated try again"); + } + + } + + @Override + public void editpass(int actNo, int pass) { + Connection con = Connections.getConnection(); + try { + PreparedStatement ps = con.prepareStatement("update customer set pass=? where actNo=? "); + ps.setInt(1, pass); + ps.setInt(2, actNo); + int x = ps.executeUpdate(); + if (x > 0) + System.out.println(x + " row affeted"); + + } catch (SQLException e) { + System.out.println("not updated try again"); + } + + } + + @Override + public void deposit(int actNo, int rsa) { + Connection con = Connections.getConnection(); + try { + PreparedStatement ps1 = con.prepareStatement("select * from customer where actNo=? "); + ps1.setInt(1, actNo); + + ResultSet rs = ps1.executeQuery(); + int rup = rsa; + while (rs.next()) { + rup = rs.getInt("bal"); + + } + + int finalrs = rup + rsa; + PreparedStatement ps = con.prepareStatement("update customer set bal=? where ActNo=?"); + ps.setInt(1, finalrs); + ps.setInt(2, actNo); + int x = ps.executeUpdate(); + if (x > 0) { + pre(actNo, rup + rsa); + + } + } catch (SQLException e) { + System.out.println(e.getMessage()); + System.out.println("not updated try again"); + } + } + + public void pre(int act, int rs) { + + Connection con = Connections.getConnection(); + try { + PreparedStatement his = con.prepareStatement("insert into data values(?,?)"); + his.setInt(1, act); + his.setInt(2, rs); + int x = his.executeUpdate(); + if (x > 0) + System.out.println("Transaction successful!!"); + + } catch (SQLException e) { + + } + + } + + @Override + public void withdrwal(int actNo, int rsa) { + Connection con = Connections.getConnection(); + try { + PreparedStatement ps1 = con.prepareStatement("select * from customer where actNo=? "); + ps1.setInt(1, actNo); + + ResultSet rs = ps1.executeQuery(); + int rup = 0; + while (rs.next()) { + rup = rs.getInt("bal"); + + } + if (rup < rsa) { + System.out.println("Insufficient balance----"); + return; + } + int finalrs = rup - rsa; + + PreparedStatement ps = con.prepareStatement("update customer set bal=? where ActNo=?"); + ps.setInt(1, finalrs); + ps.setInt(2, actNo); + int x = ps.executeUpdate(); + if (x > 0) { + pre(actNo, rup - rsa); + + } + } catch (SQLException e) { + System.out.println(e.getMessage()); + System.out.println(); + System.out.println("not updated try again"); + System.out.println(); + } + + } + + @Override + public void loginCus(String em, int ps) { + count++; + + Connection con = Connections.getConnection(); + try { + PreparedStatement act = con.prepareStatement("select * from customer"); + ResultSet rs = act.executeQuery(); + while (rs.next()) { + + String email = rs.getString("email"); + + int password = rs.getInt("pass"); + + if (em.equalsIgnoreCase(email) && password == ps) { + flag = true; + this.act = rs.getInt("actNo"); + System.out.println("login sucessful from customer id "); + System.out.println(); + return; + + } + + } + if (this.count == 0) + System.out.println("invalid credentials!!"); + } catch (SQLException ex) { + ex.getMessage(); + + } + } + + @Override + public void showhis(int act) { + Connection con = Connections.getConnection(); + + try { + PreparedStatement ps = con.prepareStatement("select * from data where custAct=?"); + ps.setInt(1, act); + + ResultSet rs = ps.executeQuery(); + while (rs.next()) { + System.out.println( + "Account number -" + rs.getInt("custAct") + " Transaction amount-" + rs.getInt("balance")); + } + + } catch (SQLException e) { + System.out.println("No record found----"); + } + + } +} diff --git a/OnlineBanking/src/CusDetail/Customer.java b/OnlineBanking/src/CusDetail/Customer.java new file mode 100644 index 0000000..3bf31cb --- /dev/null +++ b/OnlineBanking/src/CusDetail/Customer.java @@ -0,0 +1,55 @@ +package CusDetail; + +public class Customer { + + private int actNo; + private String name; + private String email; + private int pass; + private int balance; + + + + Customer(){ + + } + public Customer(int actNo, String name, String email, int pass, int balance) { + super(); + this.actNo = actNo; + this.name = name; + this.email = email; + this.pass = pass; + this.balance = balance; + } + public int getActNo() { + return actNo; + } + public void setActNo(int actNo) { + this.actNo = actNo; + } + public String getName() { + return name; + } + public void setName(String name) { + this.name = name; + } + public String getEmail() { + return email; + } + public void setEmail(String email) { + this.email = email; + } + public int getPass() { + return pass; + } + public void setPass(int pass) { + this.pass = pass; + } + public int getBalance() { + return balance; + } + public void setBalance(int balance) { + this.balance = balance; + } + +} diff --git a/OnlineBanking/src/Dbc/Connections.java b/OnlineBanking/src/Dbc/Connections.java new file mode 100644 index 0000000..822ff24 --- /dev/null +++ b/OnlineBanking/src/Dbc/Connections.java @@ -0,0 +1,31 @@ +package Dbc; + +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.SQLException; + +public class Connections { + + + public static Connection getConnection() { + Connection con=null; + try { + Class.forName("com.mysql.cj.jdbc.Driver"); + } catch (ClassNotFoundException e) { + + e.printStackTrace(); + } + + try { + con = DriverManager.getConnection("jdbc:mysql://localhost:3306/banking", "root", "khushi123"); + + } catch (SQLException e) { + + e.printStackTrace(); + } + + + + return con; + } +} diff --git a/README.md b/README.md deleted file mode 100644 index 11ecc8b..0000000 --- a/README.md +++ /dev/null @@ -1,2 +0,0 @@ -# naughty-discussion-3257 -Online banking System application diff --git a/Transaction.java b/Transaction.java deleted file mode 100644 index e19bfaa..0000000 --- a/Transaction.java +++ /dev/null @@ -1,164 +0,0 @@ -package bankingsystemswing; - -import java.awt.EventQueue; - -import javax.swing.JFrame; -import javax.swing.JTable; - -import com.opencsv.CSVWriter; - -import net.proteanit.sql.DbUtils; - -import java.awt.Color; -import javax.swing.JScrollPane; -import java.sql.*; -import javax.swing.*; -import java.awt.event.ActionListener; -import java.io.File; -import java.io.FileWriter; -import java.io.IOException; -import java.awt.event.ActionEvent; - - - -public class Transaction { - - private JFrame frame; - - /** - * Launch the application. - */ - public static void main(String[] args) { - EventQueue.invokeLater(new Runnable() { - public void run() { - try { - Transaction window = new Transaction(); - window.frame.setVisible(true); - } catch (Exception e) { - e.printStackTrace(); - } - } - }); - } - - /** - * Create the application. - */ - public Transaction() { - initialize(); - } - - /** - * Initialize the contents of the frame. - */ - - Connection connection = null; - private JTable table; - private JScrollPane scrollPane; - private JButton btnExport; - private JButton btnBack; - private void initialize() { - try { - connection = DBConnector.getConnection(); - - } catch (ClassNotFoundException e1) { - - e1.printStackTrace(); - } catch (SQLException e1) { - - e1.printStackTrace(); - } - - frame = new JFrame(); - frame.setBounds(100, 100, 1061, 601); - frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); - frame.getContentPane().setLayout(null); - - scrollPane = new JScrollPane(); - scrollPane.setBounds(10, 11, 1025, 506); - frame.getContentPane().add(scrollPane); - - table = new JTable(); - table.setEnabled(false); - scrollPane.setViewportView(table); - try { - String query = "Select * from transactiontable where email = ?"; - PreparedStatement pst = connection.prepareStatement(query); - pst.setString(1, GlobalVariable.getInstance().getLogin()); - ResultSet rs = pst.executeQuery(); - table.setModel(DbUtils.resultSetToTableModel(rs)); - - //Export transaction to csv - btnExport = new JButton("Export"); - btnExport.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent arg0) { - - JFileChooser chooser = new JFileChooser(); - chooser.showOpenDialog(null); - File f = chooser.getSelectedFile(); - String filename = f.getAbsolutePath(); - - try { - //FileWriter fw = new FileWriter(filename); - ResultSet rs2 = pst.executeQuery(); - - CSVWriter writer = new CSVWriter(new FileWriter(filename)); - writer.writeAll(rs2, true,true); - writer.close(); - /*fw.append("id_bankBalance"); - fw.append(","); - fw.append("transaction"); - fw.append(","); - fw.append("debit"); - fw.append(","); - - while(rs2.next()) - { - fw.append(rs2.getString(1)); - fw.append(","); - fw.append(rs2.getString(2)); - fw.append(","); - - fw.append(rs2.getString(3)); - fw.append(","); - fw.append(rs2.getString(4)); - fw.append(","); - fw.append(rs2.getString(5)); - - fw.append("\n"); - - } - fw.flush(); - fw.close();*/ - - JOptionPane.showMessageDialog(frame, "CSV File is created successfully"); - } catch (IOException | SQLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - } - }); - btnExport.setBounds(533, 528, 89, 23); - frame.getContentPane().add(btnExport); - - btnBack = new JButton("Back"); - btnBack.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - - frame.dispose(); - ClientInformation clientinformation = new ClientInformation(); - clientinformation.main(null); - } - }); - btnBack.setBounds(0, 528, 89, 23); - frame.getContentPane().add(btnBack); - } - catch(Exception e){ - e.printStackTrace(); - } - - } - - } - diff --git a/TransferMoney.java b/TransferMoney.java deleted file mode 100644 index 2594fd7..0000000 --- a/TransferMoney.java +++ /dev/null @@ -1,394 +0,0 @@ -package bankingsystemswing; - -import java.awt.EventQueue; - -import javax.swing.JFrame; -import javax.swing.JLabel; -import javax.swing.JOptionPane; -import javax.swing.JTextField; - -import org.apache.poi.util.SystemOutLogger; - -import javax.swing.JButton; -import java.awt.event.ActionListener; -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; -import java.text.DateFormat; -import java.text.SimpleDateFormat; -import java.util.Date; -import java.awt.event.ActionEvent; -import java.awt.Font; - -public class TransferMoney { - - JFrame frame; - private JTextField textField; - private JTextField textField_1; - private JTextField textField_4; - private JTextField textField_5; - - /** - * Launch the application. - */ - public static void main(String[] args) { - EventQueue.invokeLater(new Runnable() { - public void run() { - try { - TransferMoney window = new TransferMoney(); - window.frame.setVisible(true); - } catch (Exception e) { - e.printStackTrace(); - } - } - }); - } - - /** - * Create the application. - */ - public TransferMoney() { - initialize(); - } - - /** - * Initialize the contents of the frame. - */ - Connection connection = null; - private JTextField textField_9; - private JTextField textField_recipientEmailID; - - private void initialize() { - - try { - connection = DBConnector.getConnection(); - } catch (ClassNotFoundException e2) { - - e2.printStackTrace(); - } catch (SQLException e2) { - - e2.printStackTrace(); - } - - frame = new JFrame(); - frame.setBounds(100, 100, 576, 438); - frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); - frame.getContentPane().setLayout(null); - - JLabel lblTransferMoney = new JLabel("Transfer Money"); - lblTransferMoney.setBounds(228, 21, 107, 30); - frame.getContentPane().add(lblTransferMoney); - - textField = new JTextField(); - textField.setBounds(114, 113, 107, 20); - frame.getContentPane().add(textField); - textField.setColumns(10); - - textField_1 = new JTextField(); - textField_1.setBounds(350, 113, 86, 20); - frame.getContentPane().add(textField_1); - textField_1.setColumns(10); - - JLabel lblNewLabel = new JLabel("First Name"); - lblNewLabel.setBounds(30, 116, 77, 14); - frame.getContentPane().add(lblNewLabel); - - JLabel lblNewLabel_1 = new JLabel("Last Name:"); - lblNewLabel_1.setBounds(265, 116, 86, 14); - frame.getContentPane().add(lblNewLabel_1); - - JButton btnTransfer = new JButton("Transfer"); - btnTransfer.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - - //Warning - if(textField_4.getText().isEmpty() || textField.getText().isEmpty() || textField_1.getText().isEmpty() || textField_9.getText().isEmpty() || textField_5.getText().isEmpty()) - { - JOptionPane.showMessageDialog(frame, "Please Enter BIC Code & Name & IBAN & Amount "); - } - - // Transfer Money - - String query2 = "select iban,accountNo,BIC from clienttable where email =? "; - String query6 = "select balance from balancetable where email = ?"; - try { - - PreparedStatement pst4 = connection.prepareStatement(query2); - pst4.setString(1, GlobalVariable.getInstance().getLogin()); - - ResultSet rs4 = pst4.executeQuery(); - while (rs4.next()) { - GlobalVariable.getInstance().setIban1(rs4.getString("iban")); - GlobalVariable.getInstance().setAccountNumber(rs4.getString("accountNo")); - GlobalVariable.getInstance().setBicNumber(rs4.getString("BIC")); - - } - - // balance Prepared Statement - pst4 = connection.prepareStatement(query6); - pst4.setString(1, GlobalVariable.getInstance().getLogin()); - - rs4 = pst4.executeQuery(); - while (rs4.next()) { - GlobalVariable.getInstance().setBalance(rs4.getFloat("balance")); - } - - } catch (SQLException e2) { - - e2.printStackTrace(); - } - - // If IBAN equal transfer money - if (textField_5.getText().toString().equals(GlobalVariable.getInstance().getIban1().toString())) { - Date date = new Date(); - DateFormat dateformat = new SimpleDateFormat("YYYY-MM-DD"); - String dateFormated = dateformat.format(date); - String transactionName = textField.getText() + " " + textField_1.getText(); - String credit = textField_9.getText(); - - // Transaction Table insert - String query3 = "insert into transactiontable(transactionName,credit,dateOfTransaction,email,iban,accountNoRecipient,bicRecipient,bic,accountNo,emailIDRecipient)values(?,?,?,?,?,?,?,?,?,?)"; - - try { - PreparedStatement pst1 = connection.prepareStatement(query3); - pst1.setString(1, transactionName); - pst1.setString(2, credit); - pst1.setString(3, dateFormated); - pst1.setString(4, GlobalVariable.getInstance().getLogin()); - pst1.setString(5, GlobalVariable.getInstance().getIban1()); - pst1.setString(6, GlobalVariable.getInstance().getAccountNumber()); - pst1.setString(7, GlobalVariable.getInstance().getBicNumber()); - pst1.setString(8, textField_4.getText()); - pst1.setString(9, GlobalVariable.getInstance().getAccountNumber()); - pst1.setString(10, GlobalVariable.getInstance().getLogin()); - pst1.execute(); - - } catch (Exception e1) { - e1.printStackTrace(); - } - - } - - // Transfer Money if IBAN not equal - - - if (!(textField_5.getText().toString().equals(GlobalVariable.getInstance().getIban1().toString()))) { - - Date date = new Date(); - DateFormat dateformat = new SimpleDateFormat("YYYY-MM-DD"); - String dateFormated = dateformat.format(date); - String transactionName = textField.getText() + " " + textField_1.getText(); - String debit = textField_9.getText(); - String creditExternal = textField_9.getText(); - - // Balance update - Float updatedBalance = GlobalVariable.getInstance().getBalance() - Float.parseFloat(debit); - - // Transaction Table insert - String query3 = "insert into transactiontable(transactionName,debit,dateOfTransaction,email,iban,accountNoRecipient,bicRecipient,bic,accountNo,emailIDRecipient)values(?,?,?,?,?,?,?,?,?,?)"; - - String query5 = "update balancetable set balance = ? where email = ?"; - - // Update the transaction detail of the external account - String query8 = "select * from clienttable where email = ?"; - String query9 = "insert into transactiontable(transactionName,credit,dateOfTransaction,email,iban,accountNoRecipient,bicRecipient,bic,accountNo,emailIDRecipient)values(?,?,?,?,?,?,?,?,?,?)"; - // Update query balance of external account - String query10 = "select balance from balancetable where email = ?"; - String query11 = "update balancetable set balance = ? where email =?"; - - try { - PreparedStatement pst1 = connection.prepareStatement(query3); - pst1.setString(1, transactionName); - pst1.setString(2, debit); - pst1.setString(3, dateFormated); - pst1.setString(4, GlobalVariable.getInstance().getLogin()); - pst1.setString(5, GlobalVariable.getInstance().getIban1()); - pst1.setString(6, textField_5.getText()); - pst1.setString(7, textField_4.getText()); - pst1.setString(8, GlobalVariable.getInstance().getBicNumber()); - pst1.setString(9, GlobalVariable.getInstance().getAccountNumber()); - pst1.setString(10, textField_recipientEmailID.getText()); - pst1.execute(); - - // query4 - - pst1 = connection.prepareStatement(query5); - pst1.setFloat(1, updatedBalance); - pst1.setString(2, GlobalVariable.getInstance().getLogin()); - pst1.executeUpdate(); - - // query 8 - - pst1 = connection.prepareStatement(query8); - pst1.setString(1, textField_recipientEmailID.getText()); - ResultSet rs8 = pst1.executeQuery(); - while (rs8.next()) { - GlobalVariableExternalRecipient.getInstance().setLogin(rs8.getString("email")); - GlobalVariableExternalRecipient.getInstance().setBicNumber(rs8.getString("BIC")); - GlobalVariableExternalRecipient.getInstance().setIban1(rs8.getString("iban")); - GlobalVariableExternalRecipient.getInstance().setAccountNumber(rs8.getString("accountNo")); - - } - - // query 9 - - pst1 = connection.prepareStatement(query9); - pst1.setString(1, transactionName); - pst1.setString(2, creditExternal); - pst1.setString(3, dateFormated); - pst1.setString(4, GlobalVariableExternalRecipient.getInstance().getLogin()); - pst1.setString(5, GlobalVariableExternalRecipient.getInstance().getIban1()); - pst1.setString(6, GlobalVariable.getInstance().getAccountNumber()); - pst1.setString(7, GlobalVariable.getInstance().getBicNumber()); - pst1.setString(8, textField_4.getText()); - pst1.setString(9, GlobalVariableExternalRecipient.getInstance().getAccountNumber()); - pst1.setString(10, GlobalVariable.getInstance().getLogin()); - pst1.execute(); - - // query10 - pst1 = connection.prepareStatement(query10); - pst1.setString(1, GlobalVariableExternalRecipient.getInstance().getLogin()); - rs8 = pst1.executeQuery(); - while (rs8.next()) { - GlobalVariableExternalRecipient.getInstance().setBalance(rs8.getFloat("balance")); - } - - //query 11 - Float ExternalRecipientBalance = GlobalVariableExternalRecipient.getInstance().getBalance() + Float.parseFloat(textField_9.getText()); - GlobalVariableExternalRecipient.getInstance().setBalance(ExternalRecipientBalance); - pst1 = connection.prepareStatement(query11); - pst1.setFloat(1, ExternalRecipientBalance); - pst1.setString(2, GlobalVariableExternalRecipient.getInstance().getLogin()); - pst1.executeUpdate(); - - } catch (Exception e1) { - e1.printStackTrace(); - } - - } - - // TransferMoney table - String query = "insert into transfermoney (FirstName,LastName,bic,amount,iban) values(?,?,?,?,?)"; - try { - - PreparedStatement pst3 = connection.prepareStatement(query); - pst3.setString(1, textField.getText()); - pst3.setString(2, textField_1.getText()); - pst3.setString(3, textField_4.getText()); - pst3.setFloat(4, Float.parseFloat(textField_9.getText())); - pst3.setString(5, textField_5.getText()); - - pst3.executeUpdate(); - - System.out.println("========================================="); - System.out.println(textField.getText()); - System.out.println(textField_1.getText()); - System.out.println(textField_4.getText()); - System.out.println(textField_9.getText()); - System.out.println( textField_5.getText()); - - - - } catch (SQLException e1) { - - e1.printStackTrace(); - } - - //Transfer Successful dialog box code - Float amm = Float.parseFloat(textField_9.getText()); - if(textField_4.getText().isEmpty() || textField.getText().isEmpty() || textField_1.getText().isEmpty() || textField_5.getText().isEmpty() ) - { - if(amm == 0) - { - //JOptionPane.showMessageDialog(frame, "Transfer Sucessfully amount credited"); - JOptionPane.showMessageDialog(frame, "Please Enter BIC Code & Name & IBAN & Amount "); - - } - JOptionPane.showMessageDialog(frame, "Please Enter BIC Code & Name & IBAN & Amount "); - }else - { - JOptionPane.showMessageDialog(frame, "Transfer Sucessfully amount credited"); - - } - - - - - - } - }); - btnTransfer.setBounds(265, 330, 89, 23); - frame.getContentPane().add(btnTransfer); - - JButton btnBack = new JButton("back"); - btnBack.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - - frame.dispose(); - ClientInformation clientInformation = new ClientInformation(); - clientInformation.main(null); - } - }); - btnBack.setBounds(0, 365, 89, 23); - frame.getContentPane().add(btnBack); - - JLabel lblNewLabel_4 = new JLabel("BIC:"); - lblNewLabel_4.setBounds(289, 178, 46, 14); - frame.getContentPane().add(lblNewLabel_4); - - textField_4 = new JTextField(); - textField_4.setBounds(350, 175, 86, 20); - frame.getContentPane().add(textField_4); - textField_4.setColumns(10); - - JLabel lblNewLabel_5 = new JLabel("IBAN:"); - lblNewLabel_5.setBounds(175, 302, 46, 14); - frame.getContentPane().add(lblNewLabel_5); - - textField_5 = new JTextField(); - textField_5.setBounds(228, 299, 206, 20); - frame.getContentPane().add(textField_5); - textField_5.setColumns(10); - - JLabel lblAmount = new JLabel("AMOUNT"); - lblAmount.setFont(new Font("Tahoma", Font.PLAIN, 14)); - lblAmount.setBounds(338, 203, 98, 30); - frame.getContentPane().add(lblAmount); - - textField_9 = new JTextField(); - textField_9.setBounds(327, 238, 109, 30); - frame.getContentPane().add(textField_9); - textField_9.setColumns(10); - - JLabel lblNewLabel_3 = new JLabel("\u20AC"); - lblNewLabel_3.setBounds(289, 241, 28, 14); - frame.getContentPane().add(lblNewLabel_3); - - // New Transfer resets textField - JButton btnNewButton = new JButton("NEW TRANSFER"); - btnNewButton.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent arg0) { - textField.setText(""); - textField_1.setText(""); - textField_4.setText(""); - textField_recipientEmailID.setText(""); - textField_9.setText(""); - textField_5.setText(""); - - } - }); - btnNewButton.setBounds(400, 365, 130, 23); - frame.getContentPane().add(btnNewButton); - - JLabel lblRecipientEmailId = new JLabel("Recipient Email ID:"); - lblRecipientEmailId.setBounds(30, 162, 130, 14); - frame.getContentPane().add(lblRecipientEmailId); - - textField_recipientEmailID = new JTextField(); - textField_recipientEmailID.setBounds(30, 192, 191, 20); - frame.getContentPane().add(textField_recipientEmailID); - textField_recipientEmailID.setColumns(10); - } -} diff --git a/democombo.java b/democombo.java deleted file mode 100644 index 01b4eb4..0000000 --- a/democombo.java +++ /dev/null @@ -1,77 +0,0 @@ -package bankingsystemswing; - -import java.awt.EventQueue; - -import javax.swing.JFrame; -import javax.swing.JLabel; -import javax.swing.JComboBox; -import java.awt.event.ActionListener; -import java.awt.event.ActionEvent; - -public class democombo { - - private JFrame frame; - - /** - * Launch the application. - */ - public static void main(String[] args) { - EventQueue.invokeLater(new Runnable() { - public void run() { - try { - democombo window = new democombo(); - window.frame.setVisible(true); - } catch (Exception e) { - e.printStackTrace(); - } - } - }); - } - - /** - * Create the application. - */ - public democombo() { - initialize(); - } - - /** - * Initialize the contents of the frame. - */ - private void initialize() { - frame = new JFrame(); - frame.setBounds(100, 100, 450, 300); - frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); - frame.getContentPane().setLayout(null); - - JLabel lblNewLabel = new JLabel("Account Type"); - lblNewLabel.setBounds(45, 77, 77, 14); - frame.getContentPane().add(lblNewLabel); - - JComboBox comboBox = new JComboBox(); - comboBox.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - String accountType = comboBox.getSelectedItem().toString(); - System.out.println(accountType); - if (accountType == "Client") { - accountType = "C"; - } - - else if (accountType == "Officer") { - accountType = "A"; - } else if (accountType == "Manager") { - accountType = "M"; - } - - System.out.println(accountType); - } - }); - comboBox.setBounds(150, 74, 77, 20); - frame.getContentPane().add(comboBox); - comboBox.addItem("Client"); - comboBox.addItem("Officer"); - comboBox.addItem("Manager"); - - } - -} diff --git a/dummy.txt b/dummy.txt deleted file mode 100644 index e69de29..0000000 diff --git a/officeAdvisor.java b/officeAdvisor.java deleted file mode 100644 index a36c18f..0000000 --- a/officeAdvisor.java +++ /dev/null @@ -1,119 +0,0 @@ -package bankingsystemswing; - -import java.awt.EventQueue; -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; - -import javax.swing.JFrame; -import javax.swing.JLabel; -import javax.swing.JOptionPane; -import javax.swing.JTable; -import javax.swing.table.TableModel; - -import net.proteanit.sql.DbUtils; - -import javax.swing.JScrollPane; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; -import javax.swing.JButton; - -public class officeAdvisor { - - JFrame frame; - private JTable table; - - /** - * Launch the application. - */ - public static void main(String[] args) { - EventQueue.invokeLater(new Runnable() { - public void run() { - try { - officeAdvisor window = new officeAdvisor(); - window.frame.setVisible(true); - } catch (Exception e) { - e.printStackTrace(); - } - } - }); - } - - /** - * Create the application. - */ - public officeAdvisor() { - initialize(); - - } - - /** - * Initialize the contents of the frame. - */ - public ClientInformationAdvisor cia = new ClientInformationAdvisor(); - - Connection connection = null; - private JButton btnView; - - private void initialize() { - - try { - connection = DBConnector.getConnection(); - } catch (ClassNotFoundException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); - } catch (SQLException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); - } - - frame = new JFrame(); - frame.setBounds(100, 100, 556, 447); - frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); - frame.getContentPane().setLayout(null); - - JLabel lblOfficeAdvisor = new JLabel("OFFICE ADVISOR"); - lblOfficeAdvisor.setBounds(219, 11, 112, 14); - frame.getContentPane().add(lblOfficeAdvisor); - - JScrollPane scrollPane = new JScrollPane(); - - scrollPane.setBounds(25, 43, 494, 312); - frame.getContentPane().add(scrollPane); - - table = new JTable(); - - /// Mouse clicked event - table.addMouseListener(new MouseAdapter() { - @Override - public void mouseClicked(MouseEvent arg0) { - - boolean a = table.isEditing(); - int index = table.getSelectedRow(); - - GlobalVariableOfficeAdvisorEmail.getInstance().setEmail((String) table.getValueAt(index, 2)); - - OfficeAdvisorClientInformation oaci = new OfficeAdvisorClientInformation(); - oaci.frame.setVisible(true); - - } - }); - scrollPane.setViewportView(table); - - try { - String query = "Select firstName,LastName,email,dateOfBirth,gender from clienttable"; - PreparedStatement pst = connection.prepareStatement(query); - ResultSet rs = pst.executeQuery(); - table.setModel(DbUtils.resultSetToTableModel(rs)); - - btnView = new JButton("view"); - btnView.setBounds(35, 366, 89, 23); - frame.getContentPane().add(btnView); - - } catch (Exception e) { - e.printStackTrace(); - } - - } -}