本文整理汇总了C#中WorkflowTypeService.Contains方法的典型用法代码示例。如果您正苦于以下问题:C# WorkflowTypeService.Contains方法的具体用法?C# WorkflowTypeService.Contains怎么用?C# WorkflowTypeService.Contains使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WorkflowTypeService
的用法示例。
在下文中一共展示了WorkflowTypeService.Contains方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetEntityFields
//.........这里部分代码省略.........
entityField.FieldType = FieldTypeCache.Read( SystemGuid.FieldType.TEXT.AsGuid() );
}
// Integer Properties (which may be a DefinedValue)
else if ( property.PropertyType == typeof( int ) || property.PropertyType == typeof( int? ) )
{
entityField.FieldType = FieldTypeCache.Read( SystemGuid.FieldType.INTEGER.AsGuid() );
var definedValueAttribute = property.GetCustomAttribute<Rock.Data.DefinedValueAttribute>();
if ( definedValueAttribute != null )
{
// Defined Value Properties
Guid? definedTypeGuid = ( (Rock.Data.DefinedValueAttribute)definedValueAttribute ).DefinedTypeGuid;
if ( definedTypeGuid.HasValue )
{
var definedType = DefinedTypeCache.Read( definedTypeGuid.Value );
entityField.Title = definedType != null ? definedType.Name : property.Name.Replace( "ValueId", string.Empty ).SplitCase();
if ( definedType != null )
{
entityField.FieldType = FieldTypeCache.Read( SystemGuid.FieldType.DEFINED_VALUE.AsGuid() );
entityField.FieldConfig.Add( "definedtype", new Field.ConfigurationValue( definedType.Id.ToString() ) );
}
}
}
}
if ( entityField != null && entityField.FieldType != null )
{
entityFields.Add( entityField );
}
}
}
// Get Attributes
var entityTypeCache = EntityTypeCache.Read( entityType, true );
if ( entityTypeCache != null )
{
int entityTypeId = entityTypeCache.Id;
using ( var rockContext = new RockContext() )
{
var qryAttributes = new AttributeService( rockContext ).Queryable().Where( a => a.EntityTypeId == entityTypeId );
if ( entityType == typeof( Group ) )
{
// in the case of Group, show attributes that are entity global, but also ones that are qualified by GroupTypeId
qryAttributes = qryAttributes
.Where( a =>
a.EntityTypeQualifierColumn == null ||
a.EntityTypeQualifierColumn == string.Empty ||
a.EntityTypeQualifierColumn == "GroupTypeId" );
}
else if ( entityType == typeof( ContentChannelItem ) )
{
// in the case of ContentChannelItem, show attributes that are entity global, but also ones that are qualified by ContentChannelTypeId
qryAttributes = qryAttributes
.Where( a =>
a.EntityTypeQualifierColumn == null ||
a.EntityTypeQualifierColumn == string.Empty ||
a.EntityTypeQualifierColumn == "ContentChannelTypeId" );
}
else if ( entityType == typeof( Rock.Model.Workflow ) )
{
// in the case of Workflow, show attributes that are entity global, but also ones that are qualified by WorkflowTypeId (and have a valid WorkflowTypeId)
var validWorkflowTypeIds = new WorkflowTypeService(rockContext).Queryable().Select(a=> a.Id).ToList().Select(a => a.ToString()).ToList();
qryAttributes = qryAttributes
.Where( a =>
a.EntityTypeQualifierColumn == null ||
a.EntityTypeQualifierColumn == string.Empty ||
(a.EntityTypeQualifierColumn == "WorkflowTypeId" && validWorkflowTypeIds.Contains(a.EntityTypeQualifierValue) ));
}
else
{
qryAttributes = qryAttributes.Where( a => a.EntityTypeQualifierColumn == string.Empty && a.EntityTypeQualifierValue == string.Empty );
}
var attributeIdList = qryAttributes.Select( a => a.Id ).ToList();
foreach ( var attributeId in attributeIdList )
{
AddEntityFieldForAttribute( entityFields, AttributeCache.Read( attributeId ), limitToFilterableFields );
}
}
}
// Order the fields by title, name
int index = 0;
var sortedFields = new List<EntityField>();
foreach ( var entityField in entityFields.OrderBy( p => !string.IsNullOrEmpty(p.AttributeEntityTypeQualifierName)).ThenBy( p => p.Title ).ThenBy( p => p.Name ) )
{
entityField.Index = index;
index++;
sortedFields.Add( entityField );
}
if ( HttpContext.Current != null )
{
HttpContext.Current.Items[EntityHelper.GetCacheKey( entityType, includeOnlyReportingFields, limitToFilterableFields )] = sortedFields;
}
return sortedFields;
}