public List <Page> Execute() { List <Page> pages = new List <Page>(); XmlDocument rqlXml = new XmlDocument(); XmlElement ioDataElement = rqlXml.CreateElement("IODATA"); XmlElement pageElement = rqlXml.CreateElement("PAGE"); pageElement.SetAttribute("action", "search"); pageElement.SetAttribute("flags", PageType.ToString()); pageElement.SetAttribute("maxrecords", MaxRecords.ToString()); if (Headline != null) { pageElement.SetAttribute("headline", Headline); pageElement.SetAttribute("headlinelike", HeadlineExact ? "0" : "-1"); } if (Category != null) { pageElement.SetAttribute("section", Category); } if (Keyword != null) { pageElement.SetAttribute("keyword", Keyword); pageElement.SetAttribute("keywordlike", KeywordExact ? "0" : "-1"); } if (Text != null) { pageElement.SetAttribute("searchtext", Text); } if (PageIdFrom != -1) { pageElement.SetAttribute("pageidfrom", PageIdFrom.ToString()); } if (PageIdTo != -1) { pageElement.SetAttribute("pageidto", PageIdTo.ToString()); } if (CreatedTo != DateTime.MinValue) { pageElement.SetAttribute("createdateto", ((int)CreatedTo.ToOADate()).ToString()); } if (CreatedFrom != DateTime.MinValue) { pageElement.SetAttribute("createdatefrom", CreatedFrom.ToString()); } if (Template != null) { pageElement.SetAttribute("templateguid", Template.GuidString); } ioDataElement.AppendChild(pageElement); rqlXml.AppendChild(ioDataElement); _xmlDoc.LoadXml(Session.Execute(rqlXml)); XmlNodeList xmlNodes = _xmlDoc.GetElementsByTagName("PAGE"); foreach (XmlNode xmlNode in xmlNodes) { pages.Add(new Page(xmlNode)); } return(pages); }
public string ToQueryString() { return("?" + string.Join("&", ConcatPair("SearchText", SearchText), ConcatPair("StartIndex", StartIndex), ConcatPair("MaxItems", MaxItems), ConcatPair("OrderAsc", OrderAsc ? "true" : "false"), ConcatPair("CreatedFrom", CreatedFrom?.ToString("yyyy-MM-dd") ?? ""), ConcatPair("CreatedTo", CreatedTo?.ToString("yyyy-MM-dd") ?? ""))); }
public IEnumerable <IPage> Execute() { var rqlXml = new XmlDocument(); XmlElement pageElement = rqlXml.CreateElement("PAGE"); pageElement.SetAttribute("action", "search"); pageElement.SetAttribute("flags", ((int)PageType).ToString(CultureInfo.InvariantCulture)); pageElement.SetAttribute("maxrecords", MaxRecords.ToString(CultureInfo.InvariantCulture)); if (Headline != null) { pageElement.SetAttribute("headline", Headline); pageElement.SetAttribute("headlinelike", IsMatchingHeadlineExactly ? "0" : "-1"); } if (Category != null) { pageElement.SetAttribute("section", Category); } if (Keyword != null) { pageElement.SetAttribute("keyword", Keyword); pageElement.SetAttribute("keywordlike", IsMatchingKeywordExactly ? "0" : "-1"); } if (Text != null) { pageElement.SetAttribute("searchtext", Text); } if (PageIdFrom != -1) { pageElement.SetAttribute("pageidfrom", PageIdFrom.ToString(CultureInfo.InvariantCulture)); } if (PageIdTo != -1) { pageElement.SetAttribute("pageidto", PageIdTo.ToString(CultureInfo.InvariantCulture)); } if (CreatedTo != DateTime.MinValue) { pageElement.SetAttribute("createdateto", (CreatedTo.ToOADate()).ToString(CultureInfo.InvariantCulture)); } if (CreatedFrom != DateTime.MinValue) { pageElement.SetAttribute("createdatefrom", (CreatedFrom.ToOADate()).ToString(CultureInfo.InvariantCulture)); } if (ContentClass != null) { pageElement.SetAttribute("templateguid", ContentClass.Guid.ToRQLString()); } XmlDocument xmlDoc = _project.ExecuteRQL(pageElement.OuterXml); return((from XmlElement curNode in xmlDoc.GetElementsByTagName("PAGE") let nodeWithLanguageVariantId = AddLanguageVariantId(curNode) select new Page(_project, nodeWithLanguageVariantId)).ToList()); }