/// <summary> /// /// </summary> /// <param name="list"></param> /// <param name="evaluateRecordCount"></param> /// <param name="includeDocumentContent"> /// For document libraries, when this parameter is true, returns an additionnal field containing the file content. /// Ignored if the list is not a document library.</param> /// <returns></returns> public IDataReader GetListItemsAsReader(SPListDefinition list, bool evaluateRecordCount, bool includeDocumentContent) { // when returning a datareader, we do it on a separate connection so we do not // exclusively lock the main connection. (Data Readers monopolize the connection until they are closed). // // In order to prevent the connection pool to grow too much, we set the autoCloseConnection option to true // on the ExecuteReader method. Data.DatabaseConnector oDB = _DB.Clone(); if (evaluateRecordCount) { return(oDB.ExecuteReader(this.GetListItemsQuery(list, includeDocumentContent, true) + ";" + this.GetListItemsQuery(list, includeDocumentContent, false), true)); } else { return(oDB.ExecuteReader(this.GetListItemsQuery(list, includeDocumentContent, false), true)); } }
/// <summary> /// Gets the children websites of the specified parent id. /// </summary> /// <param name="parentId"></param> public IDataReader GetWebsites(string parentId) { System.Text.StringBuilder sbSQL = new StringBuilder(); sbSQL.Append("SELECT Title, Description, Id, FullUrl, "); sbSQL.Append("CAST(ISNULL((SELECT TOP 1 1 FROM Webs w2 WHERE w2.ParentWebId = w1.Id), 0) AS BIT) AS HasChildren, "); sbSQL.Append("CAST(ISNULL((SELECT TOP 1 1 FROM Lists l2 WHERE l2.tp_WebId = w1.Id), 0) AS BIT) as HasChildLists "); sbSQL.Append("FROM Webs w1 "); if (parentId == string.Empty) { // Portals Never have a ParentWebID and it's Full URL is always blank (also, the WebTemplate for Portals is 20) sbSQL.Append("WHERE ParentWebId IS NULL "); } else { sbSQL.AppendFormat("WHERE ParentWebId = '{0}' ", parentId); } return(_DB.ExecuteReader(sbSQL.ToString())); }