本文整理汇总了C#中acUI.acUI.GetSessionUsername方法的典型用法代码示例。如果您正苦于以下问题:C# acUI.acUI.GetSessionUsername方法的具体用法?C# acUI.acUI.GetSessionUsername怎么用?C# acUI.acUI.GetSessionUsername使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类acUI.acUI
的用法示例。
在下文中一共展示了acUI.acUI.GetSessionUsername方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: wmLogout
public bool wmLogout()
{
dataAccess dc = new dataAccess();
acUI.acUI ui = new acUI.acUI();
try
{
string sUserID = ui.GetSessionUserID();
string sUserName = ui.GetSessionUsername();
string sErr = "";
dc.addSecurityLog(sUserID, Globals.SecurityLogTypes.Security, Globals.SecurityLogActions.UserLogout, Globals.acObjectTypes.None, sUserName, "Manual Log Out", ref sErr);
System.Web.Security.FormsAuthentication.SignOut();
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
return true;
}
示例2: wmKickAllUsers
public string wmKickAllUsers()
{
acUI.acUI ui = new acUI.acUI();
if (!ui.UserIsInRole("Administrator"))
{
return "Only an Administrator can perform this action.";
}
else
{
dataAccess dc = new dataAccess();
string sErr = null;
/*
Gives all users a one minute warning, then kicks them.
*/
try
{
if (!dc.sqlExecuteUpdate("update user_session set kick=1 where user_id in " +
" (select user_id from users where user_role <> 'Administrator')"
, ref sErr)) { throw new Exception(sErr); }
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
// add security log
dc.addSecurityLog(ui.GetSessionUserID(), SecurityLogTypes.Security, SecurityLogActions.ConfigChange, acObjectTypes.None, "", "All Users were just kicked by [" + ui.GetSessionUsername() + "]", ref sErr);
// no errors to here, so return an empty string
return "";
}
}