Logging on to Entities
- Last UpdatedNov 06, 2025
- 1 minute read
After you log on to a session, you can create one or more entities. With the stateless API, logging on to an entity is not a requirement to make a call against an entity. The main reason for logging on to an entity is to track labor usage.
Dim Result as aaMES.Result;
dim DS as System.Data.DataSet;
me.cmdLogonEntity = false;
If me.SessionID > 0 then
'aaMES.Core.aaSession.LogOnEnt( sessionId, userId, entName, siteName, curLabCd, pctLabToApply, curLabDeptId, logOnTime );
Result = aaMES.Core.aaSession.LogOnEnt( me.sessionId, me.MES.userId, me.entityName, "", null, null, null, null );
If Result.Success then
if me.debug then
LogMessage("successfully logged on to entity: " + me.EntityName);
endif;
'aaMES.Core.aaEnt.GetEntityId( entName, site );
Result = aaMES.Core.aaEnt.GetEntityId( me.entityName, "" );
DS = Result.DataSet_value;
me.EntityID = DS.Tables(0).Rows(0).Item("ent_id");
me.ResultText = "successfully logged on to entity: " + me.EntityName;
else
me.ResultText = "Failed to log on to entity: " + me.EntityName + ". " + result.Exception.Message;
endif;
else
me.ResultText = "No Session for Logon Entity";
endif;