#INCLUDE COMUN.H
#INCLUDE MVC.H

Define Class UtilizatorModel As Custom

	cUtilizator = Null
	cParola = Null
	nIdUtil = Null
	cSex = []
	lInTura = .F.
	nNivelAcces = 0		&&	1				-	ospatar
						&&	2,3(1+2)		-	ospatar sef

	Procedure actualizeazaDate
		Lparameters tcParola,tcCod,tcUtilizator
		This.cParola = tcParola
		This.nNivelAcces = Val(Substr(tcCod,1,1))
		This.cSex = Iif(VAL(Substr(tcCod,2,1))=2,[F],[M])
		This.lInTura = Iif(VAL(Substr(tcCod,3,1))=0,.F.,.T.)
		If Empty(tcUtilizator)
			This.nIdUtil = Val(Substr(tcCod,4,AT([$],tcCod)-4))
			This.cUtilizator = Substr(tcCod,At([$],tcCod)+1)
		Else
			This.nIdUtil = Val(Substr(tcCod,4))
			This.cUtilizator = tcUtilizator
		Endif
	Endproc
	***********************************************************************
	Procedure reseteazaDate
		WITH This
			.cUtilizator = Null
			.cParola = Null
			.nIdUtil = Null
			.cSex = Null
			.lInTura = .F.
			.nNivelAcces = 0		
		ENDWITH
	Endproc
	***********************************************************************
	Function esteAutentificat
		Return Iif(Isnull(This.nIdUtil),.F.,.T.)
	Endfunc
	***********************************************************************
	Function getUtilizator
		Return This.cUtilizator
	Endfunc
	***********************************************************************
	Function getIdUtil
		Return This.nIdUtil
	Endfunc
	***********************************************************************
	FUNCTION getSex
		RETURN This.cSex
	ENDFUNC
	***********************************************************************	
	FUNCTION getNivelAcces
		RETURN This.nNivelAcces
	ENDFUNC
	***********************************************************************	
	PROCEDURE setInTura
		LPARAMETERS tlInTura
		This.lInTura = tlInTura
	ENDPROC
	***********************************************************************		
	FUNCTION getInTura
		RETURN This.linTura
	ENDFUNC
	***********************************************************************		
	PROCEDURE Release
		RELEASE This
	ENDPROC
	***********************************************************************		

Enddefine && UtilizatorModel
