Professional Documents
Culture Documents
Road Repair System
Road Repair System
==
LOGIN FORM
==
COMPLAINT FORM
String Priority; if (Name.isEmpty()) JOptionPane.showMessageDialog(this,"Name not Entered."); else if (Address.isEmpty()) JOptionPane.showMessageDialog(this,"Address not Entered."); else if (Area.isEmpty()) JOptionPane.showMessageDialog(this,"Area not Selected."); else if (Specific_Address.isEmpty()) JOptionPane.showMessageDialog(this,"Please Give a Specific Address."); else if (Details.isEmpty()) JOptionPane.showMessageDialog(this,"Details not Entered."); if (jComboBox1.getSelectedIndex()==2) { Priority="High"; } else if(jComboBox1.getSelectedIndex()==1) { Priority="Medium"; } else { Priority="Low"; } { try {Class.forName("java.sql.DriverManager"); Connection con=(Connection) DriverManager.getConnection("jdbc:mysql://localhost:3306/project","root","2013"); Statement stmt=(Statement) con.createStatement();
String query="INSERT INTO complaint VALUES('"+0+"','"+Name+"','"+Area+"','"+Address+"','"+Specific_Address+"','"+Details+"','"+Priority+"');"; stmt.executeUpdate(query); JOptionPane.showMessageDialog(this,"Complaint successfully filed. \n Immediate action would be taken");
==
COMPLAINT DATABASE
try {
Class.forName("java.sql.DriverManager"); Connection con=(Connection) DriverManager.getConnection("jdbc:mysql://localhost:3306/project","root","2013"); Statement stmt=(Statement) con.createStatement(); String Complaint; Complaint="Complaint"; String query="SELECT Name,Area,Address,Specific_Address,Details From "+Complaint+" where SNo="+sno+";"; ResultSet rs=stmt.executeQuery(query); if (rs.next()) { String Details=rs.getString("Details"); String Name=rs.getString("Name"); String Area=rs.getString("Area"); String Address=rs.getString("Address"); String Specific_Address=rs.getString("Specific_Address");
jTextField1.setText(Name); jTextField2.setText(Area); jTextField6.setText(Address); jTextField7.setText(Specific_Address); jTextField8.setText(Details); } else {JOptionPane.showMessageDialog(this,"Complaint Number not valid."); jTextField3.setText(""); jTextField1.setText(""); jTextField2.setText(""); jTextField3.setText(""); jTextField6.setText("");
int ComplaintNo=Integer.parseInt(jTextField3.getText()); int No=Integer.parseInt(jTextField5.getText()); double Cost=Double.parseDouble(jTextField4.getText()); int Time=Integer.parseInt(jTextField9.getText()); try {Class.forName("java.sql.DriverManager"); Connection con=(Connection) DriverManager.getConnection("jdbc:mysql://localhost:3306/project","root","2013"); Statement stmt=(Statement) con.createStatement(); String query="INSERT INTO r1 VALUES('"+ComplaintNo+"','"+Cost+"','"+No+"','"+Time+"');";
ESTIMATION Button
ESTIMATION Window Opens
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { int sno; sno=Integer.parseInt(jTextField3.getText()); try { Class.forName("java.sql.DriverManager"); Connection con=(Connection) DriverManager.getConnection("jdbc:mysql://localhost:3306/project","root","2013"); Statement stmt=(Statement) con.createStatement(); String query="SELECT Cost,No,Time From r1 where ComplaintNo='"+sno+"';"; ResultSet rs=stmt.executeQuery(query);
if (rs.next()) { String Cost=rs.getString("Cost"); String No=rs.getString("No"); String Time=rs.getString("Time"); jTextField4.setText(Cost); jTextField5.setText(No); jTextField9.setText(Time); } else { JOptionPane.showMessageDialog(this,"Complaint Number not valid."); }} catch(Exception e) { JOptionPane.showMessageDialog(this,e.getMessage()); }
private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) { try { Class.forName("java.sql.DriverManager"); Connection con=(Connection) DriverManager.getConnection("jdbc:mysql://localhost:3306/project","root","2013"); Statement stmt=(Statement) con.createStatement(); String query="SELECT ComplaintNo,Cost,No,Time From r1"; ResultSet rs=stmt.executeQuery(query); if (rs.last()) { String ComplaintNo=rs.getString("ComplaintNo"); String Cost=rs.getString("Cost"); String No=rs.getString("No"); String Time=rs.getString("Time"); jTextField3.setText(ComplaintNo); jTextField4.setText(Cost); jTextField5.setText(No); jTextField9.setText(Time); } } catch(Exception e) {
JOptionPane.showMessageDialog(this,e.getMessage()); }
private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) { int ComplaintNo; ComplaintNo=Integer.parseInt(jTextField3.getText()); try { ComplaintNo=ComplaintNo+1; Class.forName("java.sql.DriverManager"); Connection con=(Connection) DriverManager.getConnection("jdbc:mysql://localhost:3306/project","root","2013"); Statement stmt=(Statement) con.createStatement(); String query="SELECT ComplaintNo,Cost,No,Time from r1 where ComplaintNo='"+ComplaintNo+"';"; ResultSet rs=stmt.executeQuery(query); if(rs.next()) { String Cost=rs.getString("Cost"); String No=rs.getString("No"); String Time=rs.getString("Time"); jTextField4.setText(Cost); jTextField5.setText(No); jTextField9.setText(Time); jTextField3.setText(Integer.toString(ComplaintNo)); } else { JOptionPane.showMessageDialog(null,"End of list."); }} catch(Exception e) { JOptionPane.showMessageDialog(this,e.getMessage());
private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) { int ComplaintNo; ComplaintNo=Integer.parseInt(jTextField3.getText()); try { ComplaintNo=ComplaintNo-1; Class.forName("java.sql.DriverManager"); Connection con=(Connection) DriverManager.getConnection("jdbc:mysql://localhost:3306/project","root","2013"); Statement stmt=(Statement) con.createStatement(); String query="SELECT ComplaintNo,Cost,No,Time from r1 where ComplaintNo='"+ComplaintNo+"';"; ResultSet rs=stmt.executeQuery(query); if(rs.next()) { String Cost=rs.getString("Cost"); String No=rs.getString("No"); String Time=rs.getString("Time"); jTextField4.setText(Cost); jTextField5.setText(No); jTextField9.setText(Time); jTextField3.setText(Integer.toString(ComplaintNo)); } else { JOptionPane.showMessageDialog(null,"Start of list."); } }
catch(Exception e) { JOptionPane.showMessageDialog(this,e.getMessage()); }
FEEDBACK Button
Feedback Window Opens
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { { DefaultTableModel model=(DefaultTableModel) jTable1.getModel(); try { Class.forName("java.sql.DriverManager"); Connection con=(Connection) DriverManager.getConnection("jdbc:mysql://localhost:3306/project","root","2013"); Statement stmt=(Statement) con.createStatement(); String feedback; feedback="feedback";
String query="SELECT SNo, FEEDBACK From "+feedback+";"; ResultSet rs=stmt.executeQuery(query); while(rs.next()) { String FEEDBACK=rs.getString("FEEDBACK"); String SNo=rs.getString("SNo");
FROM FORM 1
ABOUT US Button
About Us Window Opens