COMPILE FUNCTION obj_LSL_Users(Method,Parms)

/*
	Methods for LSL_USERS table
    
	01/28/2014 JCH - Initial Coding
     
    Properties:
     
    Methods:
    
    Name_UserID(@ID,@RECORD)
	
	
*/


DECLARE FUNCTION Get_Status, Msg, Utility, obj_Tables, Send_Dyn, obj_Popup
DECLARE SUBROUTINE  Set_Status, Msg, obj_Tables, Send_Dyn
DECLARE SUBROUTINE ErrMsg, Btree.Extract

$INSERT MSG_EQUATES
$INSERT LSL_USERS_EQUATES

EQU CRLF$	TO \0D0A\
EQU TAB$	TO CHAR(9)


ErrTitle = 'Error in Stored Procedure "obj_ReactItem"'
ErrorMsg = ''

IF NOT(ASSIGNED(Method))	THEN ErrorMsg = 'Unassigned parameter "Method" passed to subroutine'
IF NOT(ASSIGNED(Parms))		THEN Parms = ''

IF ErrorMsg NE '' THEN
	Set_Status(-1,ErrTitle:@SVM:ErrorMsg)
	RETURN ''
END

Result = ''

BEGIN CASE
	CASE Method = 'Name_UserID'			; GOSUB Name_UserID
	
	
	CASE 1
		ErrorMsg = 'Unknown Method ':QUOTE(Method):' passed to routine.'

END CASE

IF ErrorMsg NE '' THEN
	Set_Status(-1,ErrTitle:@SVM:ErrorMsg)
END

RETURN Result


* * * * * * *
Name_UserID:
* * * * * * *

Names = Parms[1,@RM]

IF Names = '' THEN RETURN

OPEN 'DICT.LSL_USERS' TO DictVar ELSE
	RETURN
END

nameCnt = COUNT(Names,@VM) + (Names NE '')

FOR I = 1 TO nameCnt
	Name = Names<1,I>
	IF Name NE '' THEN
		SearchString = 'FIRST_LAST':@VM:Name:@FM

		Option = ''
		Flag = ''

		Btree.Extract(SearchString,'LSL_USERS',DictVar,LSL_UserKey,Option,Flag)
		
		Result<1,I> = LSL_UserKey
		
	END	;* End of check for null Name
NEXT I

RETURN

