本文整理汇总了C#中Connection.GetUserStatus方法的典型用法代码示例。如果您正苦于以下问题:C# Connection.GetUserStatus方法的具体用法?C# Connection.GetUserStatus怎么用?C# Connection.GetUserStatus使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Connection
的用法示例。
在下文中一共展示了Connection.GetUserStatus方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ListSharedUsers
/// <summary>
/// List all existing shares for a current user
/// </summary>
private void ListSharedUsers()
{
ServiceObject serviceObject = base.ServiceBroker.Service.ServiceObjects[0];
serviceObject.Properties.InitResultTable();
DataTable results = base.ServiceBroker.ServicePackage.ResultTable;
using (Connection k2Con = new Connection())
{
k2Con.Open(base.K2ClientConnectionSetup);
// None for userstatus means the users is not configured, throw an exception
if (UserStatuses.None == k2Con.GetUserStatus())
throw new ApplicationException(Constants.ErrorMessages.OutOfOfficeNotConfiguredForUser);
WorklistShares wsColl = k2Con.GetCurrentSharingSettings(ShareType.OOF);
foreach (WorklistShare ws in wsColl)
{
//throw new ApplicationException("collection count is: "+ wsColl.Count.ToString());
foreach (WorkType wt in ws.WorkTypes)
{
foreach (Destination dest in wt.Destinations)
{
DataRow dr = results.NewRow();
dr[Constants.SOProperties.OutOfOffice.DestinationUser] = dest.Name.ToString();
results.Rows.Add(dr);
}
}
}
k2Con.Close();
}
}
示例2: SetStatus
/// <summary>
/// Set OOF status for a user
/// </summary>
/// <param name="status">OOF Status (Available, OOF, None)</param>
private void SetStatus(SourceCode.Workflow.Client.UserStatuses status)
{
using (Connection k2Con = new Connection())
{
k2Con.Open(base.K2ClientConnectionSetup);
// None for userstatus means the users is not configured, throw an exception
if (UserStatuses.None == k2Con.GetUserStatus() && UserStatuses.OOF == status)
{
// exception should be thrown only in case that user tries to set OOF,
throw new ApplicationException(Constants.ErrorMessages.OutOfOfficeNotConfiguredForUser);
}
try
{
k2Con.SetUserStatus(status);
}
catch (Exception ex)
{
throw new ApplicationException(Constants.ErrorMessages.FailedToSetOOF, ex);
}
k2Con.Close();
}
}
示例3: GetUserStatus
/// <summary>
/// Get OOF status for current user from Client API and return it
/// TODO: Remove User FQN parameter
/// </summary>
private void GetUserStatus()
{
ServiceObject serviceObject = base.ServiceBroker.Service.ServiceObjects[0];
serviceObject.Properties.InitResultTable();
DataTable results = base.ServiceBroker.ServicePackage.ResultTable;
using (Connection k2Con = new Connection())
{
k2Con.Open(base.K2ClientConnectionSetup);
SourceCode.Workflow.Client.UserStatuses status = k2Con.GetUserStatus();
DataRow dr = results.NewRow();
dr[Constants.SOProperties.OutOfOffice.UserStatus] = status.ToString();
results.Rows.Add(dr);
k2Con.Close();
}
}