本文整理汇总了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;
}
示例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;
}
示例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;
}