E- ASP Client (Assignment Submission Program)
ASP is a client program both for ASEP Server and Oracle database server. Students use this program to submit their assignments, learn their grades, get the assignment feedback files and send their objections about the evaluation data (assignment grade and feedback) to the course instructor or course assistant.
What does ASP Client do?
The students, the only users of the ASP Client program, have their own passwords to use the program. In order to use the program students must log in to the system. Figure 13 shows an example view of a logging process. Student enters his/her student identification number (SID) and user password. The SID and password are sent to the database server as a query for validation. If they are validated, the user logs in to the system successfully. Since this process a bit crucial, the code segment that performs this job is provided below.
statusBar1.setText("Connecting...Please
wait!");
if(loginASEP()){
// CREATE A NEW USER
student=new User();
student.login=textFieldControl1.getText();
student.password=textFieldControl2.getText();
try {
// LOAD THE ORACLE JDBC DRIVER
CLASS
Class.forName("oracle.jdbc.driver.OracleDriver");
try{
// CONNECT TO THE ORACLE DATABASE
SERVER
connection = DriverManager.getConnection("jdbc:oracle:thin:@139.179.11.20:1521:ug",
"hyasin","fener");
statusBar1.setText("Connected,now
checking your password...");
// CHECK THE LOGIN AND PASSWORD
try {
PreparedStatement pstmt=connection.prepareStatement("select
* from student where SID=? and Password=?");
pstmt.setString(1,student.login);
pstmt.setString(2,student.password);
ResultSet rs=pstmt.executeQuery();
if (rs.next()){
statusBar1.setText("Succesful
Login." );
student.firstName = rs.getString(2);
student.lastName = rs.getString(3);
student.email=rs.getString(5);
this.setVisible(false);
control.setEnabled(true);
// SUCCESSFULL LOGIN ENABLE
AND RETURN TO THE MAIN PROGRAM
control.onLogin(student,serverIP,connection);
dispose();
}
else {
statusBar1.setText("Login Failed!"
);
connection.close();
}
rs.close();
pstmt.close();
}
catch(SQLException sqlex){
statusBar1.setText("Error in
executing the query! Try again..." );
}
}
catch (SQLException sqlex){
// ORACLE DATABASE SERVER IS
DOWN
statusBar1.setText("Unable to
connect to the database server!");
}
}
catch(ClassNotFoundException
cnfex){
statusBar1.setText("oracle.jdbc.driver
class not found!\n");
}
}
else{
// ASEP SERVER IS DOWN
statusBar1.setText("Unable to
connect to the ASEP Server "+serverIP);
}
When the logging process is completed successfully,
the ASP Client program lists the course names that this student is enrolled
in and also displays the given assignments for the selected course. The
student selects the appropriate assignment name. Before the submission
the assignment’ s deadline is checked. If the deadline is not expired,
the student is allowed to browse his/her assignment file and submit it.
A progress bar displays the current status of the transmission. When the
transmission is completed the program displays a confirmation message to
the student that the assignment submission is completed successfully. The
program displays a warning message when an error occurs in the submission.
Figure 14 shows a simple GUI of the ASP Client
program for the submission phase.
Students must submit assignment files in the given file format. They are allowed to submit a file to the same assignment more than once as long as the deadline is not expired.
As we mentioned above, ASP Client program can also be used to learn the grade of an assignment and view the attached feedback if there is any. Figure 15 shows the GUI of the ASP Client program for this phase. If the selected assignment of a course is evaluated the student can see the assigned grade, get the attached feedback file or send an objection mail to the course assistant or teacher.
As we said above, ASP Client program lets the users to change their user passwords. Since initially Unix user logins are assigned to each student as their ASEP user password changing password is essential for every user. To change the user password the code segment given below is used. First the new password is checked if it is null or not. Then the new password is confirmed. If it is right, an update query is sent to the database server and the password is changed with the new one.
// GET THE NEW PASSWORD
String new1=textFieldControl1.getText();
String new2=textFieldControl2.getText();
// CHECK IF THEY ARE
NULL
if (new1.equals(new2)
&& new1.equals(""))
statusBar1.setText("Type
your new password please!");
else if (new1.equals(new2)){
try{
PreparedStatement pstmt;
// PREPARE THE UPDATE
QUERY STATEMENT
if ( userType.equals("instructor")
)
pstmt=con.prepareStatement("update
instructor set Password=? where IID=?" );
else
pstmt=con.prepareStatement("update
assistant set Password=? where AID=?" );
pstmt.setString(1,new1);
pstmt.setString(2,userLogin);
pstmt.executeUpdate();
// PASSWORD IS CHANGED
statusBar1.setText("Your
password is changed succesfully.");
pstmt.close();
}
catch(SQLException sqx){
statusBar1.setText(sqx.toString());
}
}
else{
// ERROR IN RETYPING
THE NEW PASSWORD
statusBar1.setText("Error
in retyping your new password!");
}