当前位置: 首页>>代码示例>>C#>>正文


C# Connection.GetUserStatus方法代码示例

本文整理汇总了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();

            }
        }
开发者ID:panjkov,项目名称:K2NEServiceBroker,代码行数:37,代码来源:OutOfOfficeClientSO.cs

示例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();
            }
        }
开发者ID:panjkov,项目名称:K2NEServiceBroker,代码行数:28,代码来源:OutOfOfficeClientSO.cs

示例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();
            }
        }
开发者ID:panjkov,项目名称:K2NEServiceBroker,代码行数:24,代码来源:OutOfOfficeClientSO.cs


注:本文中的Connection.GetUserStatus方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。