public boolean getUserInfo(String strUser, boolean bForceRead)
    {
        boolean bFound = false;
        if ((strUser == null) || (strUser.length() ==0))
            return false; // Not found.
        int iUserID = -1;
        try   {   // First see if strUser is the UserID in string format
            if (Utility.isNumeric(strUser))
                if ((strUser != null) && (strUser.length() > 0))
                    iUserID = Integer.parseInt(strUser);
            if (iUserID == 0)
                iUserID = -1;
        } catch (NumberFormatException ex)  {
            iUserID = -1;
        }
        if ((iUserID == -1) && (strUser.length() > 0))
        { // Read using the User name
            if (!bForceRead)
                if ((this.getEditMode() == DBConstants.EDIT_CURRENT) || (this.getEditMode() == DBConstants.EDIT_IN_PROGRESS))
                    if (this.getField(UserInfo.USER_NAME).toString().equalsIgnoreCase(strUser))
                        return true;    // Already current
            this.getField(UserInfo.USER_NAME).setString(strUser);
            this.setKeyArea(UserInfo.USER_NAME_KEY);
            try   {
                bFound = this.seek(null);
            } catch (DBException ex)    {
                ex.printStackTrace();
                bFound = false;
            }
            this.setKeyArea(UserInfo.ID_KEY);
        }
        if (iUserID != -1)
        {   // Valid UserID, read it!
            if (!bForceRead)
                if ((this.getEditMode() == DBConstants.EDIT_CURRENT) || (this.getEditMode() == DBConstants.EDIT_IN_PROGRESS))
                    if (this.getField(UserInfo.ID).getValue() == iUserID)
                        return true;    // Already current
            this.getField(UserInfo.ID).setValue(iUserID);
            try   {
                this.setKeyArea(UserInfo.ID_KEY);
                bFound = this.seek(null);
            } catch (DBException ex)    {
                ex.printStackTrace();
                bFound = false;
            }
        }
        return bFound;
    }
public boolean getUserInfo ( String strUser , boolean bForceRead ) { boolean bFound = false ; if ( ( strUser == null ) || ( strUser . length ( ) == 0 ) ) return false ; int iUserID = - 1 ; try { if ( Utility . isNumeric ( strUser ) ) if ( ( strUser != null ) && ( strUser . length ( ) > 0 ) ) iUserID = Integer . parseInt ( strUser ) ; if ( iUserID == 0 ) iUserID = - 1 ; } catch ( NumberFormatException ex ) { iUserID = - 1 ; } if ( ( iUserID == - 1 ) && ( strUser . length ( ) > 0 ) ) { if ( ! bForceRead ) if ( ( this . getEditMode ( ) == DBConstants . EDIT_CURRENT ) || ( this . getEditMode ( ) == DBConstants . EDIT_IN_PROGRESS ) ) if ( this . getField ( UserInfo . USER_NAME ) . toString ( ) . equalsIgnoreCase ( strUser ) ) return true ; this . getField ( UserInfo . USER_NAME ) . setString ( strUser ) ; this . setKeyArea ( UserInfo . USER_NAME_KEY ) ; try { bFound = this . seek ( null ) ; } catch ( DBException ex ) { ex . printStackTrace ( ) ; bFound = false ; } this . setKeyArea ( UserInfo . ID_KEY ) ; } if ( iUserID != - 1 ) { if ( ! bForceRead ) if ( ( this . getEditMode ( ) == DBConstants . EDIT_CURRENT ) || ( this . getEditMode ( ) == DBConstants . EDIT_IN_PROGRESS ) ) if ( this . getField ( UserInfo . ID ) . getValue ( ) == iUserID ) return true ; this . getField ( UserInfo . ID ) . setValue ( iUserID ) ; try { this . setKeyArea ( UserInfo . ID_KEY ) ; bFound = this . seek ( null ) ; } catch ( DBException ex ) { ex . printStackTrace ( ) ; bFound = false ; } } return bFound ; }
GetUserInfo Method.