Guest User

Untitled

a guest
Jul 14th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 27.67 KB | None | 0 0
  1.  
  2. import java.awt.*;
  3. import java.awt.event.ActionEvent;
  4. import java.awt.event.ActionListener;
  5. import java.sql.Connection;
  6. import java.sql.DriverManager;
  7. import java.sql.PreparedStatement;
  8. import java.sql.ResultSet;
  9. import java.sql.SQLException;
  10. import java.sql.Statement;
  11.  
  12. import javax.swing.*;
  13. import javax.swing.border.*;
  14. /*
  15.  * Created by JFormDesigner on Fri Mar 23 15:47:20 GST 2012
  16.  */
  17.  
  18.  
  19.  
  20. /**
  21.  * @author Mozammil Khodabacchas
  22.  */
  23. public class RegistrationInterface extends JPanel implements ActionListener {
  24.     private JMenuBar mnubar;
  25.     private JMenu mnufile;
  26.     private JMenuItem mnuexit;
  27.     private JMenu mnuhelp;
  28.     private JMenuItem mnuabout;
  29.     private JLabel lbltitle;
  30.     private JPanel hspacetitle;
  31.     private JPanel pnltop;
  32.     private JPanel vspaceselectsem;
  33.     private JLabel lblsem;
  34.     private JTextField txtsem;
  35.     private JPanel vspacecourse;
  36.     private JLabel lblsid;
  37.     private JTextField txtstudent;
  38.     private JLabel lblscheduleid;
  39.     private JTextField txtscheduleid;
  40.     private JPanel hspacepnlbottom;
  41.     private JPanel pnlbottom;
  42.     private JPanel vpsaceleft;
  43.     private JLabel lblc1;
  44.     private JTextField txtc1;
  45.     private JLabel lblc2;
  46.     private JTextField txtc2;
  47.     private JLabel lblc3;
  48.     private JTextField txtc3;
  49.     private JLabel lblc4;
  50.     private JTextField txtc4;
  51.     private JLabel lblca1;
  52.     private JTextField txtca1;
  53.     private JLabel lblca2;
  54.     private JTextField txtca2;
  55.     private JPanel hspacebtns;
  56.     private JPanel pnlbtns;
  57.     private JButton btnregister;
  58.     private JButton btnviewcourses;
  59.     private JButton btnexit;
  60.     static Connection con;
  61.     static Statement stat1,stat2,stat3,stat4,stat5,stat6,stat7,stat8,stat9,stat10,stat11,stat12,stat;
  62.     Student currentstudent;
  63.     int semester;
  64.    
  65.     public RegistrationInterface(Student mystudent,int semester)
  66.     {
  67.         this.semester = semester;
  68.         currentstudent = mystudent;
  69.         initComponents();
  70.     }
  71.  
  72.     private void initComponents() {
  73.         // JFormDesigner - Component initialization - DO NOT MODIFY  //GEN-BEGIN:initComponents
  74.         // Generated using JFormDesigner Evaluation license - Mozammil Khodabacchas
  75.         mnubar = new JMenuBar();
  76.         mnufile = new JMenu();
  77.         mnuexit = new JMenuItem();
  78.         mnuhelp = new JMenu();
  79.         mnuabout = new JMenuItem();
  80.         lbltitle = new JLabel();
  81.         hspacetitle = new JPanel(null);
  82.         pnltop = new JPanel();
  83.         vspaceselectsem = new JPanel(null);
  84.         lblsem = new JLabel();
  85.         txtsem = new JTextField();
  86.         vspacecourse = new JPanel(null);
  87.         lblsid = new JLabel();
  88.         txtstudent = new JTextField();
  89.         lblscheduleid = new JLabel();
  90.         txtscheduleid = new JTextField();
  91.         hspacepnlbottom = new JPanel(null);
  92.         pnlbottom = new JPanel();
  93.         vpsaceleft = new JPanel(null);
  94.         lblc1 = new JLabel();
  95.         txtc1 = new JTextField();
  96.         lblc2 = new JLabel();
  97.         txtc2 = new JTextField();
  98.         lblc3 = new JLabel();
  99.         txtc3 = new JTextField();
  100.         lblc4 = new JLabel();
  101.         txtc4 = new JTextField();
  102.         lblca1 = new JLabel();
  103.         txtca1 = new JTextField();
  104.         lblca2 = new JLabel();
  105.         txtca2 = new JTextField();
  106.         hspacebtns = new JPanel(null);
  107.         pnlbtns = new JPanel();
  108.         btnregister = new JButton();
  109.         btnregister.addActionListener(this);
  110.         btnviewcourses = new JButton();
  111.         btnexit = new JButton();
  112.  
  113.         //======== this ========
  114.  
  115.         // JFormDesigner evaluation mark
  116.         setBorder(new javax.swing.border.CompoundBorder(
  117.             new javax.swing.border.TitledBorder(new javax.swing.border.EmptyBorder(0, 0, 0, 0),
  118.                 "", javax.swing.border.TitledBorder.CENTER,
  119.                 javax.swing.border.TitledBorder.BOTTOM, new java.awt.Font("Dialog", java.awt.Font.BOLD, 12),
  120.                 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();}});
  121.  
  122.         setLayout(new GridBagLayout());
  123.         ((GridBagLayout)getLayout()).columnWidths = new int[] {510, 0};
  124.         ((GridBagLayout)getLayout()).rowHeights = new int[] {0, 0, 0, 0, 12, 195, 0};
  125.         ((GridBagLayout)getLayout()).columnWeights = new double[] {0.0, 1.0E-4};
  126.         ((GridBagLayout)getLayout()).rowWeights = new double[] {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0E-4};
  127.  
  128.         //======== mnubar ========
  129.         {
  130.  
  131.             //======== mnufile ========
  132.             {
  133.                 mnufile.setText("File");
  134.  
  135.                 //---- mnuexit ----
  136.                 mnuexit.setText("Exit");
  137.                 mnufile.add(mnuexit);
  138.             }
  139.             mnubar.add(mnufile);
  140.  
  141.             //======== mnuhelp ========
  142.             {
  143.                 mnuhelp.setText("Help");
  144.  
  145.                 //---- mnuabout ----
  146.                 mnuabout.setText("About");
  147.                 mnuhelp.add(mnuabout);
  148.             }
  149.             mnubar.add(mnuhelp);
  150.         }
  151.         add(mnubar, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0,
  152.             GridBagConstraints.CENTER, GridBagConstraints.BOTH,
  153.             new Insets(0, 0, 5, 0), 0, 0));
  154.  
  155.         //---- lbltitle ----
  156.         lbltitle.setText("Create a schedule");
  157.         lbltitle.setFont(new Font("Tahoma", Font.BOLD, 14));
  158.         add(lbltitle, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0,
  159.             GridBagConstraints.CENTER, GridBagConstraints.VERTICAL,
  160.             new Insets(0, 0, 5, 0), 0, 0));
  161.         add(hspacetitle, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0,
  162.             GridBagConstraints.CENTER, GridBagConstraints.BOTH,
  163.             new Insets(0, 0, 5, 0), 0, 0));
  164.  
  165.         //======== pnltop ========
  166.         {
  167.             pnltop.setLayout(new GridBagLayout());
  168.             ((GridBagLayout)pnltop.getLayout()).columnWidths = new int[] {26, 76, 59, 25, 84, 78, 28, 62, 0};
  169.             ((GridBagLayout)pnltop.getLayout()).rowHeights = new int[] {23, 0};
  170.             ((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};
  171.             ((GridBagLayout)pnltop.getLayout()).rowWeights = new double[] {0.0, 1.0E-4};
  172.             pnltop.add(vspaceselectsem, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0,
  173.                 GridBagConstraints.CENTER, GridBagConstraints.BOTH,
  174.                 new Insets(0, 0, 0, 5), 0, 0));
  175.  
  176.             //---- lblsem ----
  177.             lblsem.setText("Semester: ");
  178.             pnltop.add(lblsem, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0,
  179.                 GridBagConstraints.WEST, GridBagConstraints.VERTICAL,
  180.                 new Insets(0, 0, 0, 5), 0, 0));
  181.             pnltop.add(txtsem, new GridBagConstraints(2, 0, 1, 1, 0.0, 0.0,
  182.                 GridBagConstraints.CENTER, GridBagConstraints.BOTH,
  183.                 new Insets(0, 0, 0, 5), 0, 0));
  184.             txtsem.setText(Integer.toString(semester));
  185.             pnltop.add(vspacecourse, new GridBagConstraints(3, 0, 1, 1, 0.0, 0.0,
  186.                 GridBagConstraints.CENTER, GridBagConstraints.BOTH,
  187.                 new Insets(0, 0, 0, 5), 0, 0));
  188.  
  189.             //---- lblsid ----
  190.             lblsid.setText("Student ID: ");
  191.             pnltop.add(lblsid, new GridBagConstraints(4, 0, 1, 1, 0.0, 0.0,
  192.                 GridBagConstraints.CENTER, GridBagConstraints.BOTH,
  193.                 new Insets(0, 0, 0, 5), 0, 0));
  194.             pnltop.add(txtstudent, new GridBagConstraints(5, 0, 1, 1, 0.0, 0.0,
  195.                 GridBagConstraints.CENTER, GridBagConstraints.BOTH,
  196.                 new Insets(0, 0, 0, 5), 0, 0));
  197.             txtstudent.setText(Integer.toString(currentstudent.getstudentid()));
  198.  
  199.             //---- lblscheduleid ----
  200.             lblscheduleid.setText("Schedule ID: ");
  201.             pnltop.add(lblscheduleid, new GridBagConstraints(6, 0, 1, 1, 0.0, 0.0,
  202.                 GridBagConstraints.CENTER, GridBagConstraints.BOTH,
  203.                 new Insets(0, 0, 0, 5), 0, 0));
  204.             pnltop.add(txtscheduleid, new GridBagConstraints(7, 0, 1, 1, 0.0, 0.0,
  205.                 GridBagConstraints.CENTER, GridBagConstraints.BOTH,
  206.                 new Insets(0, 0, 0, 0), 0, 0));
  207.         }
  208.         add(pnltop, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0,
  209.             GridBagConstraints.CENTER, GridBagConstraints.BOTH,
  210.             new Insets(0, 0, 5, 0), 0, 0));
  211.         add(hspacepnlbottom, new GridBagConstraints(0, 4, 1, 1, 0.0, 0.0,
  212.             GridBagConstraints.CENTER, GridBagConstraints.BOTH,
  213.             new Insets(0, 0, 5, 0), 0, 0));
  214.  
  215.         //======== pnlbottom ========
  216.         {
  217.             pnlbottom.setLayout(new GridBagLayout());
  218.             ((GridBagLayout)pnlbottom.getLayout()).columnWidths = new int[] {55, 0, 200, 0};
  219.             ((GridBagLayout)pnlbottom.getLayout()).rowHeights = new int[] {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
  220.             ((GridBagLayout)pnlbottom.getLayout()).columnWeights = new double[] {0.0, 0.0, 0.0, 1.0E-4};
  221.             ((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};
  222.             pnlbottom.add(vpsaceleft, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0,
  223.                 GridBagConstraints.CENTER, GridBagConstraints.BOTH,
  224.                 new Insets(0, 0, 5, 5), 0, 0));
  225.  
  226.             //---- lblc1 ----
  227.             lblc1.setText("Enter Course 1: ");
  228.             pnlbottom.add(lblc1, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0,
  229.                 GridBagConstraints.CENTER, GridBagConstraints.BOTH,
  230.                 new Insets(0, 0, 5, 5), 0, 0));
  231.             pnlbottom.add(txtc1, new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0,
  232.                 GridBagConstraints.CENTER, GridBagConstraints.BOTH,
  233.                 new Insets(0, 0, 5, 0), 0, 0));
  234.  
  235.             //---- lblc2 ----
  236.             lblc2.setText("Enter Course 2:");
  237.             pnlbottom.add(lblc2, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0,
  238.                 GridBagConstraints.CENTER, GridBagConstraints.BOTH,
  239.                 new Insets(0, 0, 5, 5), 0, 0));
  240.             pnlbottom.add(txtc2, new GridBagConstraints(2, 2, 1, 1, 0.0, 0.0,
  241.                 GridBagConstraints.CENTER, GridBagConstraints.BOTH,
  242.                 new Insets(0, 0, 5, 0), 0, 0));
  243.  
  244.             //---- lblc3 ----
  245.             lblc3.setText("Enter Course 3: ");
  246.             pnlbottom.add(lblc3, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0,
  247.                 GridBagConstraints.CENTER, GridBagConstraints.BOTH,
  248.                 new Insets(0, 0, 5, 5), 0, 0));
  249.             pnlbottom.add(txtc3, new GridBagConstraints(2, 3, 1, 1, 0.0, 0.0,
  250.                 GridBagConstraints.CENTER, GridBagConstraints.BOTH,
  251.                 new Insets(0, 0, 5, 0), 0, 0));
  252.  
  253.             //---- lblc4 ----
  254.             lblc4.setText("Enter Course 4: ");
  255.             pnlbottom.add(lblc4, new GridBagConstraints(1, 4, 1, 1, 0.0, 0.0,
  256.                 GridBagConstraints.CENTER, GridBagConstraints.BOTH,
  257.                 new Insets(0, 0, 5, 5), 0, 0));
  258.             pnlbottom.add(txtc4, new GridBagConstraints(2, 4, 1, 1, 0.0, 0.0,
  259.                 GridBagConstraints.CENTER, GridBagConstraints.BOTH,
  260.                 new Insets(0, 0, 5, 0), 0, 0));
  261.  
  262.             //---- lblca1 ----
  263.             lblca1.setText("Enter Alternate Course 1: ");
  264.             pnlbottom.add(lblca1, new GridBagConstraints(1, 5, 1, 1, 0.0, 0.0,
  265.                 GridBagConstraints.CENTER, GridBagConstraints.BOTH,
  266.                 new Insets(0, 0, 5, 5), 0, 0));
  267.             pnlbottom.add(txtca1, new GridBagConstraints(2, 5, 1, 1, 0.0, 0.0,
  268.                 GridBagConstraints.CENTER, GridBagConstraints.BOTH,
  269.                 new Insets(0, 0, 5, 0), 0, 0));
  270.  
  271.             //---- lblca2 ----
  272.             lblca2.setText("Enter Alternate Course 2: ");
  273.             pnlbottom.add(lblca2, new GridBagConstraints(1, 6, 1, 1, 0.0, 0.0,
  274.                 GridBagConstraints.CENTER, GridBagConstraints.BOTH,
  275.                 new Insets(0, 0, 5, 5), 0, 0));
  276.             pnlbottom.add(txtca2, new GridBagConstraints(2, 6, 1, 1, 0.0, 0.0,
  277.                 GridBagConstraints.CENTER, GridBagConstraints.BOTH,
  278.                 new Insets(0, 0, 5, 0), 0, 0));
  279.             pnlbottom.add(hspacebtns, new GridBagConstraints(0, 7, 1, 1, 0.0, 0.0,
  280.                 GridBagConstraints.CENTER, GridBagConstraints.BOTH,
  281.                 new Insets(0, 0, 5, 5), 0, 0));
  282.  
  283.             //======== pnlbtns ========
  284.             {
  285.                 pnlbtns.setLayout(new GridBagLayout());
  286.                 ((GridBagLayout)pnlbtns.getLayout()).columnWidths = new int[] {0, 0, 0, 0};
  287.                 ((GridBagLayout)pnlbtns.getLayout()).rowHeights = new int[] {0, 0};
  288.                 ((GridBagLayout)pnlbtns.getLayout()).columnWeights = new double[] {0.0, 0.0, 0.0, 1.0E-4};
  289.                 ((GridBagLayout)pnlbtns.getLayout()).rowWeights = new double[] {0.0, 1.0E-4};
  290.  
  291.                 //---- btnregister ----
  292.                 btnregister.setText("Register");
  293.                 pnlbtns.add(btnregister, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0,
  294.                     GridBagConstraints.CENTER, GridBagConstraints.BOTH,
  295.                     new Insets(0, 0, 0, 5), 0, 0));
  296.  
  297.                 //---- btnviewcourses ----
  298.                 btnviewcourses.setText("View Courses");
  299.                 pnlbtns.add(btnviewcourses, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0,
  300.                     GridBagConstraints.CENTER, GridBagConstraints.BOTH,
  301.                     new Insets(0, 0, 0, 5), 0, 0));
  302.                 btnviewcourses.addActionListener(this);
  303.  
  304.                 //---- btnexit ----
  305.                 btnexit.setText("Exit");
  306.                 pnlbtns.add(btnexit, new GridBagConstraints(2, 0, 1, 1, 0.0, 0.0,
  307.                     GridBagConstraints.CENTER, GridBagConstraints.BOTH,
  308.                     new Insets(0, 0, 0, 0), 0, 0));
  309.             }
  310.             pnlbottom.add(pnlbtns, new GridBagConstraints(2, 8, 1, 1, 0.0, 0.0,
  311.                 GridBagConstraints.CENTER, GridBagConstraints.BOTH,
  312.                 new Insets(0, 0, 0, 0), 0, 0));
  313.         }
  314.         add(pnlbottom, new GridBagConstraints(0, 5, 1, 1, 0.0, 0.0,
  315.             GridBagConstraints.CENTER, GridBagConstraints.BOTH,
  316.             new Insets(0, 0, 0, 0), 0, 0));
  317.         // JFormDesigner - End of component initialization  //GEN-END:initComponents
  318.     }
  319.     public void actionPerformed(ActionEvent e)
  320.     {
  321.         if(e.getSource()==btnviewcourses)
  322.         {
  323.             try {
  324.                 viewcourses vc = new viewcourses();
  325.             } catch (ClassNotFoundException e1) {
  326.                 // TODO Auto-generated catch block
  327.                 e1.printStackTrace();
  328.             } catch (SQLException e1) {
  329.                 // TODO Auto-generated catch block
  330.                 e1.printStackTrace();
  331.             }
  332.         }
  333.         else if(e.getSource()==btnregister)
  334.         {
  335.             String course1,course2,course3,course4,course5,course6;
  336.             course1 = txtc1.getText();
  337.             course2 = txtc2.getText();
  338.             course3 = txtc3.getText();
  339.             course4 = txtc4.getText();
  340.             course5 = txtca1.getText();
  341.             course6 = txtca2.getText();
  342.             ResultSet numc1,numc2,numc3,numc4,numca1,numca2;
  343.             ResultSet status1,status2,status3,status4,status5,status6;
  344.        
  345.        
  346.             try {
  347.                
  348.                 Class.forName("com.mysql.jdbc.Driver");
  349.                 con = DriverManager.getConnection("jdbc:mysql://localhost/test","daro","");
  350.                 stat1 = con.createStatement();
  351.                 stat2 = con.createStatement();
  352.                 stat3 = con.createStatement();
  353.                 stat4 = con.createStatement();
  354.                 stat5 = con.createStatement();
  355.                 stat6 = con.createStatement();
  356.                 stat7 = con.createStatement();
  357.                 stat8 = con.createStatement();
  358.                 stat9 = con.createStatement();
  359.                 stat10 = con.createStatement();
  360.                 stat11= con.createStatement();
  361.                 stat12 = con.createStatement();
  362.                 stat = con.createStatement();
  363.                
  364.                
  365.                  
  366.                  
  367.                
  368.                
  369.                
  370.                
  371.  
  372.                
  373.  
  374.            
  375.            
  376.                 numc1 = stat1.executeQuery("Select *"+"FROM courseuom WHERE coursename='"+course1+"'");
  377.                 numc1.next();
  378.                 numc2 = stat2.executeQuery("Select *"+"FROM courseuom WHERE coursename='"+course1+"'");
  379.                 numc2.next();
  380.                 numc3 = stat3.executeQuery("Select *"+"FROM courseuom WHERE coursename='"+course1+"'");
  381.                 numc3.next();
  382.                 numc4 = stat4.executeQuery("Select *"+"FROM courseuom WHERE coursename='"+course1+"'");
  383.                 numc4.next();
  384.                 numca1 = stat5.executeQuery("Select *"+"FROM courseuom WHERE coursename='"+course1+"'");
  385.                 numca1.next();
  386.                 numca2 = stat6.executeQuery("Select *"+"FROM courseuom WHERE coursename='"+course1+"'");
  387.                 numca2.next();
  388.                
  389.                 status1 = stat7.executeQuery("SELECT *"+"FROM courseofferinguom WHERE coursenumber='"+Integer.parseInt(numc1.getString(1))+"'");
  390.                 status1.next();
  391.                
  392.                 status2 = stat8.executeQuery("SELECT *"+"FROM courseofferinguom WHERE coursenumber='"+Integer.parseInt(numc2.getString(1))+"'");
  393.                 status2.next();
  394.                
  395.                 status3 = stat9.executeQuery("SELECT *"+"FROM courseofferinguom WHERE coursenumber='"+Integer.parseInt(numc3.getString(1))+"'");
  396.                 status3.next();
  397.                
  398.                 status4 = stat10.executeQuery("SELECT *"+"FROM courseofferinguom WHERE coursenumber='"+Integer.parseInt(numc4.getString(1))+"'");
  399.                 status4.next();
  400.                
  401.                 status5 = stat11.executeQuery("SELECT *"+"FROM courseofferinguom WHERE coursenumber='"+Integer.parseInt(numca1.getString(1))+"'");
  402.                 status5.next();
  403.                
  404.                 status6 = stat12.executeQuery("SELECT *"+"FROM courseofferinguom WHERE coursenumber='"+Integer.parseInt(numca2.getString(1))+"'");
  405.                 status6.next();
  406.                
  407.                 if(status1.getString(8).equals("open")&&status2.getString(8).equals("open")&&status3.getString(8).equals("open")&&
  408.                         status4.getString(8).equals("open"))
  409.                 {
  410.                    
  411.                     stat.executeUpdate("INSERT INTO scheduleuom(semester,studentid,courseofferingnumber) VALUES ('"+semester+"','"+currentstudent.getstudentid()+"','"+Integer.parseInt(status1.getString(1))+"')");
  412.                    
  413.                     stat.executeUpdate("INSERT INTO scheduleuom(semester,studentid,courseofferingnumber) VALUES ('"+semester+"','"+currentstudent.getstudentid()+"','"+Integer.parseInt(status2.getString(1))+"')");
  414.                    
  415.                     stat.executeUpdate("INSERT INTO scheduleuom(semester,studentid,courseofferingnumber) VALUES ('"+semester+"','"+currentstudent.getstudentid()+"','"+Integer.parseInt(status3.getString(1))+"')");
  416.                    
  417.                     stat.executeUpdate("INSERT INTO scheduleuom(semester,studentid,courseofferingnumber) VALUES ('"+semester+"','"+currentstudent.getstudentid()+"','"+Integer.parseInt(status4.getString(1))+"')");
  418.                     String x = "";
  419.                     JOptionPane.showMessageDialog(null,"You have successfully Registered for 4 modules",x, JOptionPane.PLAIN_MESSAGE);
  420.                 }
  421.                 /*else if(status1.getString(8).equals("open")&&status2.getString(8).equals("open")&&status3.getString(8).equals("open")&&
  422.                         status4.getString(8).equals("close"))
  423.                 {
  424.                    
  425.                     stat.executeUpdate("INSERT INTO scheduleuom " + "VALUES ('"+semester+"','"+currentstudent.getstudentid()+"','"+Integer.parseInt(status1.getString(1))+"')");
  426.                    
  427.                     stat.executeUpdate("INSERT INTO scheduleuom " + "VALUES ('"+semester+"','"+currentstudent.getstudentid()+"','"+Integer.parseInt(status2.getString(1))+"')");
  428.                    
  429.                     stat.executeUpdate("INSERT INTO scheduleuom " + "VALUES ('"+semester+"','"+currentstudent.getstudentid()+"','"+Integer.parseInt(status3.getString(1))+"')");
  430.                    
  431.                     stat.executeUpdate("INSERT INTO scheduleuom " + "VALUES ('"+semester+"','"+currentstudent.getstudentid()+"','"+Integer.parseInt(status5.getString(1))+"')");
  432.                     String x = "";
  433.                     JOptionPane.showMessageDialog(null,"You have successfully Registered for 4 modules",x, JOptionPane.PLAIN_MESSAGE);
  434.                 }
  435.                 else if(status1.getString(8).equals("open")&&status2.getString(8).equals("open")&&status3.getString(8).equals("close")&&
  436.                         status4.getString(8).equals("close"))
  437.                 {
  438.                
  439.                     stat.executeUpdate("INSERT INTO scheduleuom " + "VALUES ('"+semester+"','"+currentstudent.getstudentid()+"','"+Integer.parseInt(status1.getString(1))+"')");
  440.                    
  441.                     stat.executeUpdate("INSERT INTO scheduleuom " + "VALUES ('"+semester+"','"+currentstudent.getstudentid()+"','"+Integer.parseInt(status2.getString(1))+"')");
  442.                
  443.                     stat.executeUpdate("INSERT INTO scheduleuom " + "VALUES ('"+semester+"','"+currentstudent.getstudentid()+"','"+Integer.parseInt(status5.getString(1))+"')");
  444.                    
  445.                     stat.executeUpdate("INSERT INTO scheduleuom " + "VALUES ('"+semester+"','"+currentstudent.getstudentid()+"','"+Integer.parseInt(status6.getString(1))+"')");
  446.                     String x = "";
  447.                     JOptionPane.showMessageDialog(null,"You have successfully Registered for 4 modules",x, JOptionPane.PLAIN_MESSAGE);
  448.                 }
  449.                 else if(status1.getString(8).equals("open")&&status2.getString(8).equals("close")&&status3.getString(8).equals("close")&&
  450.                         status4.getString(8).equals("close"))
  451.                 {
  452.                     String x = "";
  453.                     JOptionPane.showMessageDialog(null,"Sorry more than 2 of the courses are closed",x, JOptionPane.PLAIN_MESSAGE);
  454.                 }
  455.                 else if(status1.getString(8).equals("close")&&status2.getString(8).equals("open")&&status3.getString(8).equals("open")&&
  456.                         status4.getString(8).equals("open"))
  457.                 {
  458.                    
  459.                     stat.executeUpdate("INSERT INTO scheduleuom " + "VALUES ('"+semester+"','"+currentstudent.getstudentid()+"','"+Integer.parseInt(status5.getString(1))+"')");
  460.                     stat.executeUpdate("INSERT INTO scheduleuom " + "VALUES ('"+semester+"','"+currentstudent.getstudentid()+"','"+Integer.parseInt(status2.getString(1))+"')");
  461.                     stat.executeUpdate("INSERT INTO scheduleuom " + "VALUES ('"+semester+"','"+currentstudent.getstudentid()+"','"+Integer.parseInt(status3.getString(1))+"')");
  462.                     stat.executeUpdate("INSERT INTO scheduleuom " + "VALUES ('"+semester+"','"+currentstudent.getstudentid()+"','"+Integer.parseInt(status4.getString(1))+"')");
  463.                     String x = "";
  464.                     JOptionPane.showMessageDialog(null,"You have successfully Registered for 4 modules",x, JOptionPane.PLAIN_MESSAGE);
  465.                 }
  466.                 else if(status1.getString(8).equals("close")&&status2.getString(8).equals("close")&&status3.getString(8).equals("open")&&
  467.                         status4.getString(8).equals("open"))
  468.                 {
  469.                     stat.executeUpdate("INSERT INTO scheduleuom " + "VALUES ('"+semester+"','"+currentstudent.getstudentid()+"','"+Integer.parseInt(status5.getString(1))+"')");
  470.                     stat.executeUpdate("INSERT INTO scheduleuom " + "VALUES ('"+semester+"','"+currentstudent.getstudentid()+"','"+Integer.parseInt(status6.getString(1))+"')");
  471.                     stat.executeUpdate("INSERT INTO scheduleuom " + "VALUES ('"+semester+"','"+currentstudent.getstudentid()+"','"+Integer.parseInt(status3.getString(1))+"')");
  472.                     stat.executeUpdate("INSERT INTO scheduleuom " + "VALUES ('"+semester+"','"+currentstudent.getstudentid()+"','"+Integer.parseInt(status4.getString(1))+"')");
  473.                     String x = "";
  474.                     JOptionPane.showMessageDialog(null,"You have successfully Registered for 4 modules",x, JOptionPane.PLAIN_MESSAGE);
  475.                 }
  476.                 else if(status1.getString(8).equals("open")&&status2.getString(8).equals("open")&&status3.getString(8).equals("open")&&
  477.                         status4.getString(8).equals("close"))
  478.                 {
  479.                     stat.executeUpdate("INSERT INTO scheduleuom " + "VALUES ('"+semester+"','"+currentstudent.getstudentid()+"','"+Integer.parseInt(status1.getString(1))+"')");
  480.                     stat.executeUpdate("INSERT INTO scheduleuom " + "VALUES ('"+semester+"','"+currentstudent.getstudentid()+"','"+Integer.parseInt(status2.getString(1))+"')");
  481.                     stat.executeUpdate("INSERT INTO scheduleuom " + "VALUES ('"+semester+"','"+currentstudent.getstudentid()+"','"+Integer.parseInt(status3.getString(1))+"')");
  482.                     stat.executeUpdate("INSERT INTO scheduleuom " + "VALUES ('"+semester+"','"+currentstudent.getstudentid()+"','"+Integer.parseInt(status5.getString(1))+"')");
  483.                     String x = "";
  484.                     JOptionPane.showMessageDialog(null,"You have successfully Registered for 4 modules",x, JOptionPane.PLAIN_MESSAGE);
  485.                 }
  486.                 else if(status1.getString(8).equals("open")&&status2.getString(8).equals("close")&&status3.getString(8).equals("open")&&
  487.                         status4.getString(8).equals("open"))
  488.                 {
  489.                     stat.executeUpdate("INSERT INTO scheduleuom " + "VALUES ('"+semester+"','"+currentstudent.getstudentid()+"','"+Integer.parseInt(status1.getString(1))+"')");
  490.                     stat.executeUpdate("INSERT INTO scheduleuom " + "VALUES ('"+semester+"','"+currentstudent.getstudentid()+"','"+Integer.parseInt(status5.getString(1))+"')");
  491.                     stat.executeUpdate("INSERT INTO scheduleuom " + "VALUES ('"+semester+"','"+currentstudent.getstudentid()+"','"+Integer.parseInt(status3.getString(1))+"')");
  492.                     stat.executeUpdate("INSERT INTO scheduleuom " + "VALUES ('"+semester+"','"+currentstudent.getstudentid()+"','"+Integer.parseInt(status4.getString(1))+"')");
  493.                     String x = "";
  494.                     JOptionPane.showMessageDialog(null,"You have successfully Registered for 4 modules",x, JOptionPane.PLAIN_MESSAGE);
  495.                 }
  496.                 else if(status1.getString(8).equals("open")&&status2.getString(8).equals("close")&&status3.getString(8).equals("open")&&
  497.                         status4.getString(8).equals("close"))
  498.                 {
  499.                     stat.executeUpdate("INSERT INTO scheduleuom " + "VALUES ('"+semester+"','"+currentstudent.getstudentid()+"','"+Integer.parseInt(status1.getString(1))+"')");
  500.                     stat.executeUpdate("INSERT INTO scheduleuom " + "VALUES ('"+semester+"','"+currentstudent.getstudentid()+"','"+Integer.parseInt(status5.getString(1))+"')");
  501.                     stat.executeUpdate("INSERT INTO scheduleuom " + "VALUES ('"+semester+"','"+currentstudent.getstudentid()+"','"+Integer.parseInt(status3.getString(1))+"')");
  502.                     stat.executeUpdate("INSERT INTO scheduleuom " + "VALUES ('"+semester+"','"+currentstudent.getstudentid()+"','"+Integer.parseInt(status6.getString(1))+"')");
  503.                     String x = "";
  504.                     JOptionPane.showMessageDialog(null,"You have successfully Registered for 4 modules",x, JOptionPane.PLAIN_MESSAGE);
  505.                 }
  506.                 else if(status1.getString(8).equals("open")&&status2.getString(8).equals("close")&&status3.getString(8).equals("close")&&
  507.                         status4.getString(8).equals("open"))
  508.                 {
  509.                     stat.executeUpdate("INSERT INTO scheduleuom " + "VALUES ('"+semester+"','"+currentstudent.getstudentid()+"','"+Integer.parseInt(status1.getString(1))+"')");
  510.                     stat.executeUpdate("INSERT INTO scheduleuom " + "VALUES ('"+semester+"','"+currentstudent.getstudentid()+"','"+Integer.parseInt(status5.getString(1))+"')");
  511.                     stat.executeUpdate("INSERT INTO scheduleuom " + "VALUES ('"+semester+"','"+currentstudent.getstudentid()+"','"+Integer.parseInt(status6.getString(1))+"')");
  512.                     stat.executeUpdate("INSERT INTO scheduleuom " + "VALUES ('"+semester+"','"+currentstudent.getstudentid()+"','"+Integer.parseInt(status4.getString(1))+"')");
  513.                     String x = "";
  514.                     JOptionPane.showMessageDialog(null,"You have successfully Registered for 4 modules",x, JOptionPane.PLAIN_MESSAGE);
  515.                 }
  516.                 else if(status1.getString(8).equals("close")&&status2.getString(8).equals("open")&&status3.getString(8).equals("open")&&
  517.                         status4.getString(8).equals("close"))
  518.                 {
  519.                     stat.executeUpdate("INSERT INTO scheduleuom " + "VALUES ('"+semester+"','"+currentstudent.getstudentid()+"','"+Integer.parseInt(status5.getString(1))+"')");
  520.                     stat.executeUpdate("INSERT INTO scheduleuom " + "VALUES ('"+semester+"','"+currentstudent.getstudentid()+"','"+Integer.parseInt(status2.getString(1))+"')");
  521.                     stat.executeUpdate("INSERT INTO scheduleuom " + "VALUES ('"+semester+"','"+currentstudent.getstudentid()+"','"+Integer.parseInt(status3.getString(1))+"')");
  522.                     stat.executeUpdate("INSERT INTO scheduleuom " + "VALUES ('"+semester+"','"+currentstudent.getstudentid()+"','"+Integer.parseInt(status6.getString(1))+"')");
  523.                     String x = "";
  524.                     JOptionPane.showMessageDialog(null,"You have successfully Registered for 4 modules",x, JOptionPane.PLAIN_MESSAGE);
  525.                 }
  526.                 else if(status1.getString(8).equals("close")&&status2.getString(8).equals("open")&&status3.getString(8).equals("close")&&
  527.                         status4.getString(8).equals("open"))
  528.                 {
  529.                     stat.executeUpdate("INSERT INTO scheduleuom " + "VALUES ('"+semester+"','"+currentstudent.getstudentid()+"','"+Integer.parseInt(status5.getString(1))+"')");
  530.                     stat.executeUpdate("INSERT INTO scheduleuom " + "VALUES ('"+semester+"','"+currentstudent.getstudentid()+"','"+Integer.parseInt(status2.getString(1))+"')");
  531.                     stat.executeUpdate("INSERT INTO scheduleuom " + "VALUES ('"+semester+"','"+currentstudent.getstudentid()+"','"+Integer.parseInt(status6.getString(1))+"')");
  532.                     stat.executeUpdate("INSERT INTO scheduleuom " + "VALUES ('"+semester+"','"+currentstudent.getstudentid()+"','"+Integer.parseInt(status4.getString(1))+"')");
  533.                     String x = "";
  534.                     JOptionPane.showMessageDialog(null,"You have successfully Registered for 4 modules",x, JOptionPane.PLAIN_MESSAGE);
  535.                 }
  536.                 else if(status1.getString(8).equals("close")&&status2.getString(8).equals("open")&&status3.getString(8).equals("close")&&
  537.                         status4.getString(8).equals("close"))
  538.                 {
  539.                     String x = "";
  540.                     JOptionPane.showMessageDialog(null,"Sorry more than 2 of the courses are closed",x, JOptionPane.PLAIN_MESSAGE);
  541.                 }
  542.                 else if(status1.getString(8).equals("close")&&status2.getString(8).equals("close")&&status3.getString(8).equals("open")&&
  543.                         status4.getString(8).equals("close"))
  544.                 {
  545.                     String x = "";
  546.                     JOptionPane.showMessageDialog(null,"Sorry more than 2 of the courses are closed",x, JOptionPane.PLAIN_MESSAGE);
  547.                 }
  548.                 else if(status1.getString(8).equals("close")&&status2.getString(8).equals("close")&&status3.getString(8).equals("close")&&
  549.                         status4.getString(8).equals("open"))
  550.                 {
  551.                     String x = "";
  552.                     JOptionPane.showMessageDialog(null,"Sorry more than 2 of the courses are closed",x, JOptionPane.PLAIN_MESSAGE);
  553.                 }*/
  554.                 else
  555.                 {
  556.                     String x = "";
  557.                     JOptionPane.showMessageDialog(null,"Sorry more than 2 of the courses are closed",x, JOptionPane.PLAIN_MESSAGE);
  558.                 }
  559.                
  560.                 }
  561.             catch(Exception e1) {
  562.                 System.out.println("Error" +e1);
  563.                 }
  564.            
  565.         }
  566.         }
  567.     }
  568.  
  569.    
  570.     /*public static void main(String[] args) {
  571.        
  572.         JFrame f = new JFrame();
  573.         f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  574.         f.getContentPane().add(new RegistrationInterface());
  575.         f.setVisible(true);
  576.         f.setSize(550,450);
  577.         f.setResizable(false);
  578.        
  579.     }*/
Add Comment
Please, Sign In to add comment