Get client type using code in axapta

Get client type using code in axapta

 SysGlobalCache cache = classfactory.globalCache();  
 ClientType clientType;  
 Session session;  
 if (cache.isSet(classstr(Global), funcname()))  
 {  
 clientType = cache.get(classstr(Global), funcname(), ClientType::Client);  
 }  
 else  
 {  
 session = new xSession();  
 clientType = session.clientKind();  
 cache.set(classstr(Global), funcname(), clientType);  
 }  
 return clientType;