Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- string queryName= "Product";
- var item = _orchardServices.ContentManager.New("Query");
- item.As<TitlePart>().Title =queryName;
- _orchardServices.ContentManager.Create(item, VersionOptions.Draft);
- if (!item.Has<IPublishingControlAspect>() && !item.TypeDefinition.Settings.GetModel<ContentTypeSettings>().Draftable)
- _orchardServices.ContentManager.Publish(item);
- var queryPart = item.As<QueryPart>();
- queryPart.ContentItem.ContentType = queryName;
- string desc =" filter for the query";
- string contentType = "CommonPart.ChannelID.";
- var filterGroupRecord = new FilterGroupRecord();
- var filterRecord = new FilterRecord()
- {
- Category = "CommonPartContentFields",
- Type = contentType,
- Position = 0,
- };
- filterRecord.State = "<Form><Description>" + desc + "</Description><Operator>Equals</Operator><Value>ChannelId</Value></Form>";
- filterGroupRecord.Filters.Add(filterRecord);
- queryPart.FilterGroups.Insert(0, filterGroupRecord);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement