zoukankan      html  css  js  c++  java
  • Dynamic 分派操作、共享记录

       #region 停用记录状态
            /// <summary>
            /// 信用记录状态
            /// </summary>
            /// <param name="service"></param>
            /// <param name="entity">实体</param>
            /// <param name="state">状态</param>
            /// <param name="status">状态描述</param>
            public void SetEntityState(IOrganizationService service, EntityReference entityMoniker, int state, int status)
            {
     
                SetStateRequest setRequest = new SetStateRequest()
                {
                    EntityMoniker = entityMoniker,
                    State = new OptionSetValue(state),
                    Status = new OptionSetValue(status),
                };
                SetStateResponse setResponse = (SetStateResponse)service.Execute(setRequest);
     
     
            }
            #endregion
            #region 共享记录
            /// <summary>
            /// 共享记录
            /// </summary>
            /// <param name="service"></param>
            /// <param name="teamOrSystem">要共享给用户或者团队</param>
            /// <param name="target">要共享的记录</param>
            public void Grant(IOrganizationService service, EntityReference teamOrSystem, EntityReference target)
            {
                GrantAccessRequest grantAccessRequest = new GrantAccessRequest
                {
                    PrincipalAccess = new PrincipalAccess
                    {
                        Principal = teamOrSystem,
                        AccessMask = AccessRights.ReadAccess | AccessRights.WriteAccess
     
                    },
                    Target = target,
                };
     
                service.Execute(grantAccessRequest);
     
            }
            #endregion
            
            #endregion
            #region 取消共享记录
            /// <summary>
            /// 共享记录
            /// </summary>
            /// <param name="service"></param>
            /// <param name="ls">要取消共享给用户或者团队</param>
            /// <param name="target">要取消共享的记录</param>
             public void ClearGrant(IOrganizationService service, List<EntityReference> ls, EntityReference target)
            {
                foreach (EntityReference item in ls)
                {
                    RevokeAccessRequest revokeAccessRequest = new RevokeAccessRequest
                    {
                        Revokee = item,
                        Target = target,
                    };
                    service.Execute(revokeAccessRequest);
                }
            }
            #endregion
            
            #region 分派记录
            /// <summary>
            /// 分派记录
            /// </summary>
            /// <param name="service"></param>
            /// <param name="teamOrSystem">分派给用户或者团队</param>
            /// <param name="target">要分派的记录</param>
            public void Assing(IOrganizationService service, EntityReference teamOrSystem, EntityReference target)
            {
                AssignRequest assign = new AssignRequest()
                {
                    Assignee = teamOrSystem,
                    Target = target,
                };
                service.Execute(assign);
            }
            #endregion
  • 相关阅读:
    【架构】如何设计支持多租户的数据库?
    maven的仓库:本地和远程
    maven私服
    MSA(微服务简介)
    json数据的格式
    shiro的原理理解
    异构的概念?大数据量的异构处理?
    面试之多线程通信
    面试之并发的解决方案
    进程与线程的简单理解
  • 原文地址:https://www.cnblogs.com/LanHai12/p/15257990.html
Copyright © 2011-2022 走看看