Changes
Created page with "{{Item/Resources/CodeSnippetHeader}} === Get user name (logged-in) from UBIK session === {{Item/Resources/CodeSnippetInfo|KNO}} <syntaxhighlight lang="csharp"> // Get UBIK..."
{{Item/Resources/CodeSnippetHeader}}
=== Get user name (logged-in) from UBIK session ===
{{Item/Resources/CodeSnippetInfo|KNO}}
<syntaxhighlight lang="csharp">
// Get UBIK session from environment
UBIK.Kernel.UBIKSession session = this.Environment.CurrentSession();
string userName = null;
if ((session != null) && (session.Login != null))
{
userName = this.Environment.CurrentSession().Login.Name;
}
</syntaxhighlight>
=== Get user name from property change log ===
{{Item/Resources/CodeSnippetInfo|KNO}}
<syntaxhighlight lang="csharp">
// Get property UTS from currentObj
BaseProperty property = currentObj["UTS"];
// Get timestamp of last change (if journal feature activated)
DateTime timeStamp = property.UTS;
// Get complete journal object (timestamp, user, ...)
UBIK.Kernel.ChangeLog.PropertyValueChangeLog changelog = property.LastChange;
string userName = null;
if ((changelog != null) && (changelog.UbikSession != null))
{
userName = ((UBIK.Kernel.UBIKSession)changelog.UbikSession).Login.Name;
}
</syntaxhighlight>
[[Category:Internal resources]]
=== Get user name (logged-in) from UBIK session ===
{{Item/Resources/CodeSnippetInfo|KNO}}
<syntaxhighlight lang="csharp">
// Get UBIK session from environment
UBIK.Kernel.UBIKSession session = this.Environment.CurrentSession();
string userName = null;
if ((session != null) && (session.Login != null))
{
userName = this.Environment.CurrentSession().Login.Name;
}
</syntaxhighlight>
=== Get user name from property change log ===
{{Item/Resources/CodeSnippetInfo|KNO}}
<syntaxhighlight lang="csharp">
// Get property UTS from currentObj
BaseProperty property = currentObj["UTS"];
// Get timestamp of last change (if journal feature activated)
DateTime timeStamp = property.UTS;
// Get complete journal object (timestamp, user, ...)
UBIK.Kernel.ChangeLog.PropertyValueChangeLog changelog = property.LastChange;
string userName = null;
if ((changelog != null) && (changelog.UbikSession != null))
{
userName = ((UBIK.Kernel.UBIKSession)changelog.UbikSession).Login.Name;
}
</syntaxhighlight>
[[Category:Internal resources]]
