Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.awt.*;
- import java.awt.event.ActionEvent;
- import java.awt.event.ActionListener;
- import java.sql.Connection;
- import java.sql.DriverManager;
- import java.sql.PreparedStatement;
- import java.sql.ResultSet;
- import java.sql.SQLException;
- import java.sql.Statement;
- import javax.swing.*;
- import javax.swing.border.*;
- /*
- * Created by JFormDesigner on Fri Mar 23 15:47:20 GST 2012
- */
- /**
- * @author Mozammil Khodabacchas
- */
- public class RegistrationInterface extends JPanel implements ActionListener {
- private JMenuBar mnubar;
- private JMenu mnufile;
- private JMenuItem mnuexit;
- private JMenu mnuhelp;
- private JMenuItem mnuabout;
- private JLabel lbltitle;
- private JPanel hspacetitle;
- private JPanel pnltop;
- private JPanel vspaceselectsem;
- private JLabel lblsem;
- private JTextField txtsem;
- private JPanel vspacecourse;
- private JLabel lblsid;
- private JTextField txtstudent;
- private JLabel lblscheduleid;
- private JTextField txtscheduleid;
- private JPanel hspacepnlbottom;
- private JPanel pnlbottom;
- private JPanel vpsaceleft;
- private JLabel lblc1;
- private JTextField txtc1;
- private JLabel lblc2;
- private JTextField txtc2;
- private JLabel lblc3;
- private JTextField txtc3;
- private JLabel lblc4;
- private JTextField txtc4;
- private JLabel lblca1;
- private JTextField txtca1;
- private JLabel lblca2;
- private JTextField txtca2;
- private JPanel hspacebtns;
- private JPanel pnlbtns;
- private JButton btnregister;
- private JButton btnviewcourses;
- private JButton btnexit;
- static Connection con;
- static Statement stat1,stat2,stat3,stat4,stat5,stat6,stat7,stat8,stat9,stat10,stat11,stat12,stat;
- Student currentstudent;
- int semester;
- public RegistrationInterface(Student mystudent,int semester)
- {
- this.semester = semester;
- currentstudent = mystudent;
- initComponents();
- }
- private void initComponents() {
- // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
- // Generated using JFormDesigner Evaluation license - Mozammil Khodabacchas
- mnubar = new JMenuBar();
- mnufile = new JMenu();
- mnuexit = new JMenuItem();
- mnuhelp = new JMenu();
- mnuabout = new JMenuItem();
- lbltitle = new JLabel();
- hspacetitle = new JPanel(null);
- pnltop = new JPanel();
- vspaceselectsem = new JPanel(null);
- lblsem = new JLabel();
- txtsem = new JTextField();
- vspacecourse = new JPanel(null);
- lblsid = new JLabel();
- txtstudent = new JTextField();
- lblscheduleid = new JLabel();
- txtscheduleid = new JTextField();
- hspacepnlbottom = new JPanel(null);
- pnlbottom = new JPanel();
- vpsaceleft = new JPanel(null);
- lblc1 = new JLabel();
- txtc1 = new JTextField();
- lblc2 = new JLabel();
- txtc2 = new JTextField();
- lblc3 = new JLabel();
- txtc3 = new JTextField();
- lblc4 = new JLabel();
- txtc4 = new JTextField();
- lblca1 = new JLabel();
- txtca1 = new JTextField();
- lblca2 = new JLabel();
- txtca2 = new JTextField();
- hspacebtns = new JPanel(null);
- pnlbtns = new JPanel();
- btnregister = new JButton();
- btnregister.addActionListener(this);
- btnviewcourses = new JButton();
- btnexit = new JButton();
- //======== this ========
- // JFormDesigner evaluation mark
- setBorder(new javax.swing.border.CompoundBorder(
- new javax.swing.border.TitledBorder(new javax.swing.border.EmptyBorder(0, 0, 0, 0),
- "", javax.swing.border.TitledBorder.CENTER,
- javax.swing.border.TitledBorder.BOTTOM, new java.awt.Font("Dialog", java.awt.Font.BOLD, 12),
- java.awt.Color.red), getBorder())); addPropertyChangeListener(new java.beans.PropertyChangeListener(){public void propertyChange(java.beans.PropertyChangeEvent e){if("border".equals(e.getPropertyName()))throw new RuntimeException();}});
- setLayout(new GridBagLayout());
- ((GridBagLayout)getLayout()).columnWidths = new int[] {510, 0};
- ((GridBagLayout)getLayout()).rowHeights = new int[] {0, 0, 0, 0, 12, 195, 0};
- ((GridBagLayout)getLayout()).columnWeights = new double[] {0.0, 1.0E-4};
- ((GridBagLayout)getLayout()).rowWeights = new double[] {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0E-4};
- //======== mnubar ========
- {
- //======== mnufile ========
- {
- mnufile.setText("File");
- //---- mnuexit ----
- mnuexit.setText("Exit");
- mnufile.add(mnuexit);
- }
- mnubar.add(mnufile);
- //======== mnuhelp ========
- {
- mnuhelp.setText("Help");
- //---- mnuabout ----
- mnuabout.setText("About");
- mnuhelp.add(mnuabout);
- }
- mnubar.add(mnuhelp);
- }
- add(mnubar, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0,
- GridBagConstraints.CENTER, GridBagConstraints.BOTH,
- new Insets(0, 0, 5, 0), 0, 0));
- //---- lbltitle ----
- lbltitle.setText("Create a schedule");
- lbltitle.setFont(new Font("Tahoma", Font.BOLD, 14));
- add(lbltitle, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0,
- GridBagConstraints.CENTER, GridBagConstraints.VERTICAL,
- new Insets(0, 0, 5, 0), 0, 0));
- add(hspacetitle, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0,
- GridBagConstraints.CENTER, GridBagConstraints.BOTH,
- new Insets(0, 0, 5, 0), 0, 0));
- //======== pnltop ========
- {
- pnltop.setLayout(new GridBagLayout());
- ((GridBagLayout)pnltop.getLayout()).columnWidths = new int[] {26, 76, 59, 25, 84, 78, 28, 62, 0};
- ((GridBagLayout)pnltop.getLayout()).rowHeights = new int[] {23, 0};
- ((GridBagLayout)pnltop.getLayout()).columnWeights = new double[] {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0E-4};
- ((GridBagLayout)pnltop.getLayout()).rowWeights = new double[] {0.0, 1.0E-4};
- pnltop.add(vspaceselectsem, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0,
- GridBagConstraints.CENTER, GridBagConstraints.BOTH,
- new Insets(0, 0, 0, 5), 0, 0));
- //---- lblsem ----
- lblsem.setText("Semester: ");
- pnltop.add(lblsem, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0,
- GridBagConstraints.WEST, GridBagConstraints.VERTICAL,
- new Insets(0, 0, 0, 5), 0, 0));
- pnltop.add(txtsem, new GridBagConstraints(2, 0, 1, 1, 0.0, 0.0,
- GridBagConstraints.CENTER, GridBagConstraints.BOTH,
- new Insets(0, 0, 0, 5), 0, 0));
- txtsem.setText(Integer.toString(semester));
- pnltop.add(vspacecourse, new GridBagConstraints(3, 0, 1, 1, 0.0, 0.0,
- GridBagConstraints.CENTER, GridBagConstraints.BOTH,
- new Insets(0, 0, 0, 5), 0, 0));
- //---- lblsid ----
- lblsid.setText("Student ID: ");
- pnltop.add(lblsid, new GridBagConstraints(4, 0, 1, 1, 0.0, 0.0,
- GridBagConstraints.CENTER, GridBagConstraints.BOTH,
- new Insets(0, 0, 0, 5), 0, 0));
- pnltop.add(txtstudent, new GridBagConstraints(5, 0, 1, 1, 0.0, 0.0,
- GridBagConstraints.CENTER, GridBagConstraints.BOTH,
- new Insets(0, 0, 0, 5), 0, 0));
- txtstudent.setText(Integer.toString(currentstudent.getstudentid()));
- //---- lblscheduleid ----
- lblscheduleid.setText("Schedule ID: ");
- pnltop.add(lblscheduleid, new GridBagConstraints(6, 0, 1, 1, 0.0, 0.0,
- GridBagConstraints.CENTER, GridBagConstraints.BOTH,
- new Insets(0, 0, 0, 5), 0, 0));
- pnltop.add(txtscheduleid, new GridBagConstraints(7, 0, 1, 1, 0.0, 0.0,
- GridBagConstraints.CENTER, GridBagConstraints.BOTH,
- new Insets(0, 0, 0, 0), 0, 0));
- }
- add(pnltop, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0,
- GridBagConstraints.CENTER, GridBagConstraints.BOTH,
- new Insets(0, 0, 5, 0), 0, 0));
- add(hspacepnlbottom, new GridBagConstraints(0, 4, 1, 1, 0.0, 0.0,
- GridBagConstraints.CENTER, GridBagConstraints.BOTH,
- new Insets(0, 0, 5, 0), 0, 0));
- //======== pnlbottom ========
- {
- pnlbottom.setLayout(new GridBagLayout());
- ((GridBagLayout)pnlbottom.getLayout()).columnWidths = new int[] {55, 0, 200, 0};
- ((GridBagLayout)pnlbottom.getLayout()).rowHeights = new int[] {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
- ((GridBagLayout)pnlbottom.getLayout()).columnWeights = new double[] {0.0, 0.0, 0.0, 1.0E-4};
- ((GridBagLayout)pnlbottom.getLayout()).rowWeights = new double[] {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0E-4};
- pnlbottom.add(vpsaceleft, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0,
- GridBagConstraints.CENTER, GridBagConstraints.BOTH,
- new Insets(0, 0, 5, 5), 0, 0));
- //---- lblc1 ----
- lblc1.setText("Enter Course 1: ");
- pnlbottom.add(lblc1, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0,
- GridBagConstraints.CENTER, GridBagConstraints.BOTH,
- new Insets(0, 0, 5, 5), 0, 0));
- pnlbottom.add(txtc1, new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0,
- GridBagConstraints.CENTER, GridBagConstraints.BOTH,
- new Insets(0, 0, 5, 0), 0, 0));
- //---- lblc2 ----
- lblc2.setText("Enter Course 2:");
- pnlbottom.add(lblc2, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0,
- GridBagConstraints.CENTER, GridBagConstraints.BOTH,
- new Insets(0, 0, 5, 5), 0, 0));
- pnlbottom.add(txtc2, new GridBagConstraints(2, 2, 1, 1, 0.0, 0.0,
- GridBagConstraints.CENTER, GridBagConstraints.BOTH,
- new Insets(0, 0, 5, 0), 0, 0));
- //---- lblc3 ----
- lblc3.setText("Enter Course 3: ");
- pnlbottom.add(lblc3, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0,
- GridBagConstraints.CENTER, GridBagConstraints.BOTH,
- new Insets(0, 0, 5, 5), 0, 0));
- pnlbottom.add(txtc3, new GridBagConstraints(2, 3, 1, 1, 0.0, 0.0,
- GridBagConstraints.CENTER, GridBagConstraints.BOTH,
- new Insets(0, 0, 5, 0), 0, 0));
- //---- lblc4 ----
- lblc4.setText("Enter Course 4: ");
- pnlbottom.add(lblc4, new GridBagConstraints(1, 4, 1, 1, 0.0, 0.0,
- GridBagConstraints.CENTER, GridBagConstraints.BOTH,
- new Insets(0, 0, 5, 5), 0, 0));
- pnlbottom.add(txtc4, new GridBagConstraints(2, 4, 1, 1, 0.0, 0.0,
- GridBagConstraints.CENTER, GridBagConstraints.BOTH,
- new Insets(0, 0, 5, 0), 0, 0));
- //---- lblca1 ----
- lblca1.setText("Enter Alternate Course 1: ");
- pnlbottom.add(lblca1, new GridBagConstraints(1, 5, 1, 1, 0.0, 0.0,
- GridBagConstraints.CENTER, GridBagConstraints.BOTH,
- new Insets(0, 0, 5, 5), 0, 0));
- pnlbottom.add(txtca1, new GridBagConstraints(2, 5, 1, 1, 0.0, 0.0,
- GridBagConstraints.CENTER, GridBagConstraints.BOTH,
- new Insets(0, 0, 5, 0), 0, 0));
- //---- lblca2 ----
- lblca2.setText("Enter Alternate Course 2: ");
- pnlbottom.add(lblca2, new GridBagConstraints(1, 6, 1, 1, 0.0, 0.0,
- GridBagConstraints.CENTER, GridBagConstraints.BOTH,
- new Insets(0, 0, 5, 5), 0, 0));
- pnlbottom.add(txtca2, new GridBagConstraints(2, 6, 1, 1, 0.0, 0.0,
- GridBagConstraints.CENTER, GridBagConstraints.BOTH,
- new Insets(0, 0, 5, 0), 0, 0));
- pnlbottom.add(hspacebtns, new GridBagConstraints(0, 7, 1, 1, 0.0, 0.0,
- GridBagConstraints.CENTER, GridBagConstraints.BOTH,
- new Insets(0, 0, 5, 5), 0, 0));
- //======== pnlbtns ========
- {
- pnlbtns.setLayout(new GridBagLayout());
- ((GridBagLayout)pnlbtns.getLayout()).columnWidths = new int[] {0, 0, 0, 0};
- ((GridBagLayout)pnlbtns.getLayout()).rowHeights = new int[] {0, 0};
- ((GridBagLayout)pnlbtns.getLayout()).columnWeights = new double[] {0.0, 0.0, 0.0, 1.0E-4};
- ((GridBagLayout)pnlbtns.getLayout()).rowWeights = new double[] {0.0, 1.0E-4};
- //---- btnregister ----
- btnregister.setText("Register");
- pnlbtns.add(btnregister, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0,
- GridBagConstraints.CENTER, GridBagConstraints.BOTH,
- new Insets(0, 0, 0, 5), 0, 0));
- //---- btnviewcourses ----
- btnviewcourses.setText("View Courses");
- pnlbtns.add(btnviewcourses, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0,
- GridBagConstraints.CENTER, GridBagConstraints.BOTH,
- new Insets(0, 0, 0, 5), 0, 0));
- btnviewcourses.addActionListener(this);
- //---- btnexit ----
- btnexit.setText("Exit");
- pnlbtns.add(btnexit, new GridBagConstraints(2, 0, 1, 1, 0.0, 0.0,
- GridBagConstraints.CENTER, GridBagConstraints.BOTH,
- new Insets(0, 0, 0, 0), 0, 0));
- }
- pnlbottom.add(pnlbtns, new GridBagConstraints(2, 8, 1, 1, 0.0, 0.0,
- GridBagConstraints.CENTER, GridBagConstraints.BOTH,
- new Insets(0, 0, 0, 0), 0, 0));
- }
- add(pnlbottom, new GridBagConstraints(0, 5, 1, 1, 0.0, 0.0,
- GridBagConstraints.CENTER, GridBagConstraints.BOTH,
- new Insets(0, 0, 0, 0), 0, 0));
- // JFormDesigner - End of component initialization //GEN-END:initComponents
- }
- public void actionPerformed(ActionEvent e)
- {
- if(e.getSource()==btnviewcourses)
- {
- try {
- viewcourses vc = new viewcourses();
- } catch (ClassNotFoundException e1) {
- // TODO Auto-generated catch block
- e1.printStackTrace();
- } catch (SQLException e1) {
- // TODO Auto-generated catch block
- e1.printStackTrace();
- }
- }
- else if(e.getSource()==btnregister)
- {
- String course1,course2,course3,course4,course5,course6;
- course1 = txtc1.getText();
- course2 = txtc2.getText();
- course3 = txtc3.getText();
- course4 = txtc4.getText();
- course5 = txtca1.getText();
- course6 = txtca2.getText();
- ResultSet numc1,numc2,numc3,numc4,numca1,numca2;
- ResultSet status1,status2,status3,status4,status5,status6;
- try {
- Class.forName("com.mysql.jdbc.Driver");
- con = DriverManager.getConnection("jdbc:mysql://localhost/test","daro","");
- stat1 = con.createStatement();
- stat2 = con.createStatement();
- stat3 = con.createStatement();
- stat4 = con.createStatement();
- stat5 = con.createStatement();
- stat6 = con.createStatement();
- stat7 = con.createStatement();
- stat8 = con.createStatement();
- stat9 = con.createStatement();
- stat10 = con.createStatement();
- stat11= con.createStatement();
- stat12 = con.createStatement();
- stat = con.createStatement();
- numc1 = stat1.executeQuery("Select *"+"FROM courseuom WHERE coursename='"+course1+"'");
- numc1.next();
- numc2 = stat2.executeQuery("Select *"+"FROM courseuom WHERE coursename='"+course1+"'");
- numc2.next();
- numc3 = stat3.executeQuery("Select *"+"FROM courseuom WHERE coursename='"+course1+"'");
- numc3.next();
- numc4 = stat4.executeQuery("Select *"+"FROM courseuom WHERE coursename='"+course1+"'");
- numc4.next();
- numca1 = stat5.executeQuery("Select *"+"FROM courseuom WHERE coursename='"+course1+"'");
- numca1.next();
- numca2 = stat6.executeQuery("Select *"+"FROM courseuom WHERE coursename='"+course1+"'");
- numca2.next();
- status1 = stat7.executeQuery("SELECT *"+"FROM courseofferinguom WHERE coursenumber='"+Integer.parseInt(numc1.getString(1))+"'");
- status1.next();
- status2 = stat8.executeQuery("SELECT *"+"FROM courseofferinguom WHERE coursenumber='"+Integer.parseInt(numc2.getString(1))+"'");
- status2.next();
- status3 = stat9.executeQuery("SELECT *"+"FROM courseofferinguom WHERE coursenumber='"+Integer.parseInt(numc3.getString(1))+"'");
- status3.next();
- status4 = stat10.executeQuery("SELECT *"+"FROM courseofferinguom WHERE coursenumber='"+Integer.parseInt(numc4.getString(1))+"'");
- status4.next();
- status5 = stat11.executeQuery("SELECT *"+"FROM courseofferinguom WHERE coursenumber='"+Integer.parseInt(numca1.getString(1))+"'");
- status5.next();
- status6 = stat12.executeQuery("SELECT *"+"FROM courseofferinguom WHERE coursenumber='"+Integer.parseInt(numca2.getString(1))+"'");
- status6.next();
- if(status1.getString(8).equals("open")&&status2.getString(8).equals("open")&&status3.getString(8).equals("open")&&
- status4.getString(8).equals("open"))
- {
- stat.executeUpdate("INSERT INTO scheduleuom(semester,studentid,courseofferingnumber) VALUES ('"+semester+"','"+currentstudent.getstudentid()+"','"+Integer.parseInt(status1.getString(1))+"')");
- stat.executeUpdate("INSERT INTO scheduleuom(semester,studentid,courseofferingnumber) VALUES ('"+semester+"','"+currentstudent.getstudentid()+"','"+Integer.parseInt(status2.getString(1))+"')");
- stat.executeUpdate("INSERT INTO scheduleuom(semester,studentid,courseofferingnumber) VALUES ('"+semester+"','"+currentstudent.getstudentid()+"','"+Integer.parseInt(status3.getString(1))+"')");
- stat.executeUpdate("INSERT INTO scheduleuom(semester,studentid,courseofferingnumber) VALUES ('"+semester+"','"+currentstudent.getstudentid()+"','"+Integer.parseInt(status4.getString(1))+"')");
- String x = "";
- JOptionPane.showMessageDialog(null,"You have successfully Registered for 4 modules",x, JOptionPane.PLAIN_MESSAGE);
- }
- /*else if(status1.getString(8).equals("open")&&status2.getString(8).equals("open")&&status3.getString(8).equals("open")&&
- status4.getString(8).equals("close"))
- {
- stat.executeUpdate("INSERT INTO scheduleuom " + "VALUES ('"+semester+"','"+currentstudent.getstudentid()+"','"+Integer.parseInt(status1.getString(1))+"')");
- stat.executeUpdate("INSERT INTO scheduleuom " + "VALUES ('"+semester+"','"+currentstudent.getstudentid()+"','"+Integer.parseInt(status2.getString(1))+"')");
- stat.executeUpdate("INSERT INTO scheduleuom " + "VALUES ('"+semester+"','"+currentstudent.getstudentid()+"','"+Integer.parseInt(status3.getString(1))+"')");
- stat.executeUpdate("INSERT INTO scheduleuom " + "VALUES ('"+semester+"','"+currentstudent.getstudentid()+"','"+Integer.parseInt(status5.getString(1))+"')");
- String x = "";
- JOptionPane.showMessageDialog(null,"You have successfully Registered for 4 modules",x, JOptionPane.PLAIN_MESSAGE);
- }
- else if(status1.getString(8).equals("open")&&status2.getString(8).equals("open")&&status3.getString(8).equals("close")&&
- status4.getString(8).equals("close"))
- {
- stat.executeUpdate("INSERT INTO scheduleuom " + "VALUES ('"+semester+"','"+currentstudent.getstudentid()+"','"+Integer.parseInt(status1.getString(1))+"')");
- stat.executeUpdate("INSERT INTO scheduleuom " + "VALUES ('"+semester+"','"+currentstudent.getstudentid()+"','"+Integer.parseInt(status2.getString(1))+"')");
- stat.executeUpdate("INSERT INTO scheduleuom " + "VALUES ('"+semester+"','"+currentstudent.getstudentid()+"','"+Integer.parseInt(status5.getString(1))+"')");
- stat.executeUpdate("INSERT INTO scheduleuom " + "VALUES ('"+semester+"','"+currentstudent.getstudentid()+"','"+Integer.parseInt(status6.getString(1))+"')");
- String x = "";
- JOptionPane.showMessageDialog(null,"You have successfully Registered for 4 modules",x, JOptionPane.PLAIN_MESSAGE);
- }
- else if(status1.getString(8).equals("open")&&status2.getString(8).equals("close")&&status3.getString(8).equals("close")&&
- status4.getString(8).equals("close"))
- {
- String x = "";
- JOptionPane.showMessageDialog(null,"Sorry more than 2 of the courses are closed",x, JOptionPane.PLAIN_MESSAGE);
- }
- else if(status1.getString(8).equals("close")&&status2.getString(8).equals("open")&&status3.getString(8).equals("open")&&
- status4.getString(8).equals("open"))
- {
- stat.executeUpdate("INSERT INTO scheduleuom " + "VALUES ('"+semester+"','"+currentstudent.getstudentid()+"','"+Integer.parseInt(status5.getString(1))+"')");
- stat.executeUpdate("INSERT INTO scheduleuom " + "VALUES ('"+semester+"','"+currentstudent.getstudentid()+"','"+Integer.parseInt(status2.getString(1))+"')");
- stat.executeUpdate("INSERT INTO scheduleuom " + "VALUES ('"+semester+"','"+currentstudent.getstudentid()+"','"+Integer.parseInt(status3.getString(1))+"')");
- stat.executeUpdate("INSERT INTO scheduleuom " + "VALUES ('"+semester+"','"+currentstudent.getstudentid()+"','"+Integer.parseInt(status4.getString(1))+"')");
- String x = "";
- JOptionPane.showMessageDialog(null,"You have successfully Registered for 4 modules",x, JOptionPane.PLAIN_MESSAGE);
- }
- else if(status1.getString(8).equals("close")&&status2.getString(8).equals("close")&&status3.getString(8).equals("open")&&
- status4.getString(8).equals("open"))
- {
- stat.executeUpdate("INSERT INTO scheduleuom " + "VALUES ('"+semester+"','"+currentstudent.getstudentid()+"','"+Integer.parseInt(status5.getString(1))+"')");
- stat.executeUpdate("INSERT INTO scheduleuom " + "VALUES ('"+semester+"','"+currentstudent.getstudentid()+"','"+Integer.parseInt(status6.getString(1))+"')");
- stat.executeUpdate("INSERT INTO scheduleuom " + "VALUES ('"+semester+"','"+currentstudent.getstudentid()+"','"+Integer.parseInt(status3.getString(1))+"')");
- stat.executeUpdate("INSERT INTO scheduleuom " + "VALUES ('"+semester+"','"+currentstudent.getstudentid()+"','"+Integer.parseInt(status4.getString(1))+"')");
- String x = "";
- JOptionPane.showMessageDialog(null,"You have successfully Registered for 4 modules",x, JOptionPane.PLAIN_MESSAGE);
- }
- else if(status1.getString(8).equals("open")&&status2.getString(8).equals("open")&&status3.getString(8).equals("open")&&
- status4.getString(8).equals("close"))
- {
- stat.executeUpdate("INSERT INTO scheduleuom " + "VALUES ('"+semester+"','"+currentstudent.getstudentid()+"','"+Integer.parseInt(status1.getString(1))+"')");
- stat.executeUpdate("INSERT INTO scheduleuom " + "VALUES ('"+semester+"','"+currentstudent.getstudentid()+"','"+Integer.parseInt(status2.getString(1))+"')");
- stat.executeUpdate("INSERT INTO scheduleuom " + "VALUES ('"+semester+"','"+currentstudent.getstudentid()+"','"+Integer.parseInt(status3.getString(1))+"')");
- stat.executeUpdate("INSERT INTO scheduleuom " + "VALUES ('"+semester+"','"+currentstudent.getstudentid()+"','"+Integer.parseInt(status5.getString(1))+"')");
- String x = "";
- JOptionPane.showMessageDialog(null,"You have successfully Registered for 4 modules",x, JOptionPane.PLAIN_MESSAGE);
- }
- else if(status1.getString(8).equals("open")&&status2.getString(8).equals("close")&&status3.getString(8).equals("open")&&
- status4.getString(8).equals("open"))
- {
- stat.executeUpdate("INSERT INTO scheduleuom " + "VALUES ('"+semester+"','"+currentstudent.getstudentid()+"','"+Integer.parseInt(status1.getString(1))+"')");
- stat.executeUpdate("INSERT INTO scheduleuom " + "VALUES ('"+semester+"','"+currentstudent.getstudentid()+"','"+Integer.parseInt(status5.getString(1))+"')");
- stat.executeUpdate("INSERT INTO scheduleuom " + "VALUES ('"+semester+"','"+currentstudent.getstudentid()+"','"+Integer.parseInt(status3.getString(1))+"')");
- stat.executeUpdate("INSERT INTO scheduleuom " + "VALUES ('"+semester+"','"+currentstudent.getstudentid()+"','"+Integer.parseInt(status4.getString(1))+"')");
- String x = "";
- JOptionPane.showMessageDialog(null,"You have successfully Registered for 4 modules",x, JOptionPane.PLAIN_MESSAGE);
- }
- else if(status1.getString(8).equals("open")&&status2.getString(8).equals("close")&&status3.getString(8).equals("open")&&
- status4.getString(8).equals("close"))
- {
- stat.executeUpdate("INSERT INTO scheduleuom " + "VALUES ('"+semester+"','"+currentstudent.getstudentid()+"','"+Integer.parseInt(status1.getString(1))+"')");
- stat.executeUpdate("INSERT INTO scheduleuom " + "VALUES ('"+semester+"','"+currentstudent.getstudentid()+"','"+Integer.parseInt(status5.getString(1))+"')");
- stat.executeUpdate("INSERT INTO scheduleuom " + "VALUES ('"+semester+"','"+currentstudent.getstudentid()+"','"+Integer.parseInt(status3.getString(1))+"')");
- stat.executeUpdate("INSERT INTO scheduleuom " + "VALUES ('"+semester+"','"+currentstudent.getstudentid()+"','"+Integer.parseInt(status6.getString(1))+"')");
- String x = "";
- JOptionPane.showMessageDialog(null,"You have successfully Registered for 4 modules",x, JOptionPane.PLAIN_MESSAGE);
- }
- else if(status1.getString(8).equals("open")&&status2.getString(8).equals("close")&&status3.getString(8).equals("close")&&
- status4.getString(8).equals("open"))
- {
- stat.executeUpdate("INSERT INTO scheduleuom " + "VALUES ('"+semester+"','"+currentstudent.getstudentid()+"','"+Integer.parseInt(status1.getString(1))+"')");
- stat.executeUpdate("INSERT INTO scheduleuom " + "VALUES ('"+semester+"','"+currentstudent.getstudentid()+"','"+Integer.parseInt(status5.getString(1))+"')");
- stat.executeUpdate("INSERT INTO scheduleuom " + "VALUES ('"+semester+"','"+currentstudent.getstudentid()+"','"+Integer.parseInt(status6.getString(1))+"')");
- stat.executeUpdate("INSERT INTO scheduleuom " + "VALUES ('"+semester+"','"+currentstudent.getstudentid()+"','"+Integer.parseInt(status4.getString(1))+"')");
- String x = "";
- JOptionPane.showMessageDialog(null,"You have successfully Registered for 4 modules",x, JOptionPane.PLAIN_MESSAGE);
- }
- else if(status1.getString(8).equals("close")&&status2.getString(8).equals("open")&&status3.getString(8).equals("open")&&
- status4.getString(8).equals("close"))
- {
- stat.executeUpdate("INSERT INTO scheduleuom " + "VALUES ('"+semester+"','"+currentstudent.getstudentid()+"','"+Integer.parseInt(status5.getString(1))+"')");
- stat.executeUpdate("INSERT INTO scheduleuom " + "VALUES ('"+semester+"','"+currentstudent.getstudentid()+"','"+Integer.parseInt(status2.getString(1))+"')");
- stat.executeUpdate("INSERT INTO scheduleuom " + "VALUES ('"+semester+"','"+currentstudent.getstudentid()+"','"+Integer.parseInt(status3.getString(1))+"')");
- stat.executeUpdate("INSERT INTO scheduleuom " + "VALUES ('"+semester+"','"+currentstudent.getstudentid()+"','"+Integer.parseInt(status6.getString(1))+"')");
- String x = "";
- JOptionPane.showMessageDialog(null,"You have successfully Registered for 4 modules",x, JOptionPane.PLAIN_MESSAGE);
- }
- else if(status1.getString(8).equals("close")&&status2.getString(8).equals("open")&&status3.getString(8).equals("close")&&
- status4.getString(8).equals("open"))
- {
- stat.executeUpdate("INSERT INTO scheduleuom " + "VALUES ('"+semester+"','"+currentstudent.getstudentid()+"','"+Integer.parseInt(status5.getString(1))+"')");
- stat.executeUpdate("INSERT INTO scheduleuom " + "VALUES ('"+semester+"','"+currentstudent.getstudentid()+"','"+Integer.parseInt(status2.getString(1))+"')");
- stat.executeUpdate("INSERT INTO scheduleuom " + "VALUES ('"+semester+"','"+currentstudent.getstudentid()+"','"+Integer.parseInt(status6.getString(1))+"')");
- stat.executeUpdate("INSERT INTO scheduleuom " + "VALUES ('"+semester+"','"+currentstudent.getstudentid()+"','"+Integer.parseInt(status4.getString(1))+"')");
- String x = "";
- JOptionPane.showMessageDialog(null,"You have successfully Registered for 4 modules",x, JOptionPane.PLAIN_MESSAGE);
- }
- else if(status1.getString(8).equals("close")&&status2.getString(8).equals("open")&&status3.getString(8).equals("close")&&
- status4.getString(8).equals("close"))
- {
- String x = "";
- JOptionPane.showMessageDialog(null,"Sorry more than 2 of the courses are closed",x, JOptionPane.PLAIN_MESSAGE);
- }
- else if(status1.getString(8).equals("close")&&status2.getString(8).equals("close")&&status3.getString(8).equals("open")&&
- status4.getString(8).equals("close"))
- {
- String x = "";
- JOptionPane.showMessageDialog(null,"Sorry more than 2 of the courses are closed",x, JOptionPane.PLAIN_MESSAGE);
- }
- else if(status1.getString(8).equals("close")&&status2.getString(8).equals("close")&&status3.getString(8).equals("close")&&
- status4.getString(8).equals("open"))
- {
- String x = "";
- JOptionPane.showMessageDialog(null,"Sorry more than 2 of the courses are closed",x, JOptionPane.PLAIN_MESSAGE);
- }*/
- else
- {
- String x = "";
- JOptionPane.showMessageDialog(null,"Sorry more than 2 of the courses are closed",x, JOptionPane.PLAIN_MESSAGE);
- }
- }
- catch(Exception e1) {
- System.out.println("Error" +e1);
- }
- }
- }
- }
- /*public static void main(String[] args) {
- JFrame f = new JFrame();
- f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- f.getContentPane().add(new RegistrationInterface());
- f.setVisible(true);
- f.setSize(550,450);
- f.setResizable(false);
- }*/
Add Comment
Please, Sign In to add comment