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


C# IMaintainableRefObject.HasAgencyId方法代码示例

本文整理汇总了C#中IMaintainableRefObject.HasAgencyId方法的典型用法代码示例。如果您正苦于以下问题:C# IMaintainableRefObject.HasAgencyId方法的具体用法?C# IMaintainableRefObject.HasAgencyId怎么用?C# IMaintainableRefObject.HasAgencyId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IMaintainableRefObject的用法示例。


在下文中一共展示了IMaintainableRefObject.HasAgencyId方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Contains

        /// <summary>
        /// Checks if there is a .
        /// </summary>
        /// <param name="allowedDataflows">
        /// The allowed dataflows.
        /// </param>
        /// <param name="requestedObject">
        /// The requested object.
        /// </param>
        /// <returns>
        /// The <see cref="bool"/>.
        /// </returns>
        public static bool Contains(ICollection<IMaintainableRefObject> allowedDataflows, IMaintainableRefObject requestedObject)
        {
            if (allowedDataflows == null)
            {
                return true;
            }

            foreach (IMaintainableRefObject allowedDataflow in allowedDataflows)
            {
                if ((!requestedObject.HasMaintainableId() || string.Equals(allowedDataflow.MaintainableId, requestedObject.MaintainableId))
                    && ((!allowedDataflow.HasVersion() || !requestedObject.HasVersion() || string.Equals(requestedObject.Version, allowedDataflow.Version))
                        && (!allowedDataflow.HasAgencyId() || !requestedObject.HasAgencyId() || string.Equals(requestedObject.AgencyId, allowedDataflow.AgencyId))))
                {
                    return true;
                }
            }

            return false;
        }
开发者ID:alcardac,项目名称:SDMXRI_ENH_WS,代码行数:31,代码来源:SecurityHelper.cs

示例2: CheckEqualsWithNoVersion

        /// <summary>
        /// Checks if <paramref name="first"/> and <paramref name="second"/>  without checking the version.
        /// </summary>
        /// <param name="first">The first <see cref="IMaintainableRefObject"/>.</param>
        /// <param name="second">The second <see cref="IMaintainableRefObject"/>.</param>
        /// <returns><c>true</c> if <paramref name="first"/> and <paramref name="second"/> have the same MaintainableId and AgencyId, <c>false</c> otherwise.</returns>
        public static bool CheckEqualsWithNoVersion(IMaintainableRefObject first, IMaintainableRefObject second)
        {
            if (first == null && second == null)
            {
                return true;
            } 
            
            if (first == null || second == null)
            {
                return false;
            }

            if (first.HasMaintainableId() && second.HasMaintainableId())
            {
                if (!first.MaintainableId.Equals(second.MaintainableId))
                {
                    return false;
                }
            } 
            else if (first.HasMaintainableId() || second.HasMaintainableId())
            {
                return false;
            }

            if (first.HasAgencyId() && second.HasAgencyId())
            {
                var firstAgency = NormalizeAgencyId(first);
                var secondAgency = NormalizeAgencyId(second);
                if (!firstAgency.Equals(secondAgency))
                {

                    return false;
                }
            }
            else if (first.HasAgencyId() || second.HasAgencyId())
            {
                return false;
            }

            return true;
        }
开发者ID:SDMXISTATFRAMEWORK,项目名称:ISTAT_ENHANCED_SDMXRI_WS,代码行数:47,代码来源:EDIUtil.cs

示例3: GetAllowedDataflow

        /// <summary>
        /// Get the latest allowed dataflow with version and agency (if are either defined)
        /// </summary>
        /// <param name="dataflowRef">
        /// The dataflow reference
        /// </param>
        /// <returns>
        /// The allowed dataflow with biggest version
        /// </returns>
        public IMaintainableRefObject GetAllowedDataflow(IMaintainableRefObject dataflowRef)
        {
            if (dataflowRef == null)
            {
                throw new ArgumentNullException("dataflowRef");
            }

            IMaintainableRefObject actualDataflow = null;

            if (dataflowRef.HasAgencyId() && dataflowRef.HasVersion())
            {
                if (this._authorizationProvider.AccessControl(this._user, dataflowRef))
                {
                    actualDataflow = dataflowRef;
                }
            }
            else
            {
                IEnumerable<IMaintainableRefObject> dataflowRefBeans = this._authorizationProvider.GetDataflows(
                    this._user, dataflowRef.MaintainableId);
                foreach (IMaintainableRefObject dataflowRefBean in dataflowRefBeans)
                {
                    // TODO fix version comparison
                    if (actualDataflow == null
                        || string.CompareOrdinal(actualDataflow.Version, dataflowRefBean.Version) < 0)
                    {
                        actualDataflow = dataflowRefBean;
                    }
                }
            }

            return actualDataflow;
        }
开发者ID:alcardac,项目名称:SDMXRI_WS_OF,代码行数:42,代码来源:DataflowPrincipal.cs


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