public int doLogin() throws Exception
	{
		PreparedStatement psDoLogin;
                PreparedStatement psDetermineUser;
		ResultSet rsDoLogin = null;
                ResultSet rsDetermineUser = null;
		String sqlDoLogin = null;
		
		int isLoginValidate = 0;
		
		Connection conn = ConnectionUtils.getConnection();
		
                String query = "select id from users where " + 
                                    "email=?";
                psDetermineUser = conn.prepareStatement(query);
		psDetermineUser.setString(1, this.getUsername());
		rsDetermineUser = psDetermineUser.executeQuery();
                
                int firstCheck = 0;
                
                //String id = "";
                if(rsDetermineUser.next())
                {
                    id = rsDetermineUser.getString(1);
                    firstCheck = 1;
                }
                else
                {
                    return 0;
                }
                Character tempStr = id.charAt(0);
                
                //String typeOfUser = "administrator";
                
                sqlDoLogin = "Select * from administrator" +
				     "  where email=? and password=?";
                
                if(tempStr.equals('a'))
                {
                    sqlDoLogin = "Select * from administrator" +
				     "  where email=? and password=?";
                }
                else if(tempStr.equals('p'))
                {
                    sqlDoLogin = "Select * from professor" +
				     "  where email=? and password=?";
                }
                else if(tempStr.equals('s'))
                {
                    sqlDoLogin = "Select * from student" +
				     "  where email=? and password=?";
                }
               
		
		psDoLogin = conn.prepareStatement(sqlDoLogin);
                //psDoLogin.setString(1, typeOfUser);
		psDoLogin.setString(1, this.getUsername());
		psDoLogin.setString(2, this.getPassword());
		rsDoLogin = psDoLogin.executeQuery();
		
		if(rsDoLogin.next())
		{
			isLoginValidate = 1; 
		}
                else 
                {
                    return 0;
                }

		DbUtils.close(rsDoLogin, psDoLogin, conn);
		
                int typeOfLogin = 10;
                if(tempStr.equals('a'))
                {
                    typeOfLogin = 10;
                }
                else if(tempStr.equals('p'))
                {
                    typeOfLogin = 11;
                }
                else if(tempStr.equals('s'))
                {
                    typeOfLogin = 12;
                }
                return typeOfLogin;
	}