public void ApplyFilter(FilterContext context, IFieldTypeEditor fieldTypeEditor, string storageName, Type storageType, ContentPartDefinition part, ContentPartFieldDefinition field) { var propertyName = String.Join(".", part.Name, field.Name, storageName ?? ""); // use an alias with the join so that two filters on the same Field Type wont collide var relationship = fieldTypeEditor.GetFilterRelationship(propertyName.ToSafeName()); // generate the predicate based on the editor which has been used Action<IHqlExpressionFactory> predicate = fieldTypeEditor.GetFilterPredicate(context.State); // combines the predicate with a filter on the specific property name of the storage, as implemented in FieldIndexService Action<IHqlExpressionFactory> andPredicate = x => x.And(y => y.Eq("PropertyName", propertyName), predicate); // apply where clause context.Query = context.Query.Where(relationship, andPredicate); }
public void ApplyFilter(FilterContext context, IFieldTypeEditor fieldTypeEditor, string storageName, Type storageType, ContentPartDefinition part, ContentPartFieldDefinition field) { var propertyName = String.Join(".", part.Name, field.Name, storageName ?? ""); // use an alias with the join so that two filters on the same Field Type wont collide var relationship = fieldTypeEditor.GetFilterRelationship(propertyName.ToSafeName()); // generate the predicate based on the editor which has been used Action <IHqlExpressionFactory> predicate = fieldTypeEditor.GetFilterPredicate(context.State); // combines the predicate with a filter on the specific property name of the storage, as implemented in FieldIndexService Action <IHqlExpressionFactory> andPredicate = x => x.And(y => y.Eq("PropertyName", propertyName), predicate); // apply where clause context.Query = context.Query.Where(relationship, andPredicate); }
public void ApplyFilter(FilterContext context, IFieldTypeEditor fieldTypeEditor, string storageName, Type storageType, ContentPartDefinition part, ContentPartFieldDefinition field) { // The filter has to be applied only if there's an actual value (not null or empty) to filter with. if (context.State.Value != null && context.State.Value != "") { var propertyName = string.Join(".", part.Name, field.Name, storageName ?? ""); // Use an alias with the generated property name, so that two filters on the same Field Type won't collide. var relationship = fieldTypeEditor.GetFilterRelationship(propertyName.ToSafeName()); // Generate the predicate based on the editor, which has been used. Action <IHqlExpressionFactory> predicate = fieldTypeEditor.GetFilterPredicate(context.State); // Combines the predicate with a filter on the specific property name of the storage, as implemented in FieldIndexService. Action <IHqlExpressionFactory> andPredicate = x => x.And(y => y.Eq("PropertyName", propertyName), predicate); // Apply where clause. context.Query = context.Query.Where(relationship, andPredicate); } }
public void ApplySortCriterion(SortCriterionContext context, IFieldTypeEditor fieldTypeEditor, string storageName, Type storageType, ContentPartDefinition part, ContentPartFieldDefinition field) { bool ascending = Convert.ToBoolean(context.State.Sort); var propertyName = String.Join(".", part.Name, field.Name, storageName ?? ""); // use an alias with the join so that two filters on the same Field Type wont collide var relationship = fieldTypeEditor.GetFilterRelationship(propertyName.ToSafeName()); // generate the predicate based on the editor which has been used Action<IHqlExpressionFactory> predicate = y => y.Eq("PropertyName", propertyName); // combines the predicate with a filter on the specific property name of the storage, as implemented in FieldIndexService // apply where clause context.Query = context.Query.Where(relationship, predicate); // apply sort context.Query = ascending ? context.Query.OrderBy(relationship, x => x.Asc("Value")) : context.Query.OrderBy(relationship, x => x.Desc("Value")); }
public void ApplySortCriterion(SortCriterionContext context, IFieldTypeEditor fieldTypeEditor, string storageName, Type storageType, ContentPartDefinition part, ContentPartFieldDefinition field) { bool ascending = (bool)context.State.Sort; var propertyName = String.Join(".", part.Name, field.Name, storageName ?? ""); // use an alias with the join so that two filters on the same Field Type wont collide var relationship = fieldTypeEditor.GetFilterRelationship(propertyName.ToSafeName()); // generate the predicate based on the editor which has been used Action <IHqlExpressionFactory> predicate = y => y.Eq("PropertyName", propertyName); // combines the predicate with a filter on the specific property name of the storage, as implemented in FieldIndexService // apply where clause context.Query = context.Query.Where(relationship, predicate); // apply sort context.Query = ascending ? context.Query.OrderBy(relationship, x => x.Asc(context.GetSortColumnName())) : context.Query.OrderBy(relationship, x => x.Desc(context.GetSortColumnName())); }
public override Action <IAliasFactory> GetFilterRelationship(string aliasName) { return(_editor.GetFilterRelationship(aliasName)); }