Esempio n. 1
0
        /// <summary>
        /// Performance tuned method for use in the tree
        /// </summary>
        /// <param name="NodeId">The parentdocuments id</param>
        /// <returns></returns>
        public static Document[] GetChildrenForTree(int NodeId)
        {
            var tmp = new List<Document>();
            using (IRecordsReader dr =
                SqlHelper.ExecuteReader(
                                        string.Format(m_SQLOptimizedMany.Trim(), "umbracoNode.parentID = @parentId", "umbracoNode.sortOrder"),
                                        SqlHelper.CreateParameter("@nodeObjectType", Document._objectType),
                                        SqlHelper.CreateParameter("@parentId", NodeId)))
            {
                while (dr.Read())
                {
                    Document d = new Document(dr.GetInt("id"), true);
                    d.PopulateDocumentFromReader(dr);
                    tmp.Add(d);
                }
            }

            return tmp.ToArray();
        }
Esempio n. 2
0
        public static IEnumerable<Document> GetDocumentsOfDocumentType(int docTypeId)
        {
            var tmp = new List<Document>();
            using (IRecordsReader dr =
                SqlHelper.ExecuteReader(
                                        string.Format(m_SQLOptimizedMany.Trim(), "cmsContent.contentType = @contentTypeId", "umbracoNode.sortOrder"),
                                        SqlHelper.CreateParameter("@nodeObjectType", Document._objectType),
                                        SqlHelper.CreateParameter("@contentTypeId", docTypeId)))
            {
                while (dr.Read())
                {
                    Document d = new Document(dr.GetInt("id"), true);
                    d.PopulateDocumentFromReader(dr);
                    tmp.Add(d);
                }
            }

            return tmp.ToArray();
        }
Esempio n. 3
0
        /// <summary>
        /// Returns all decendants of the current document
        /// </summary>
        /// <returns></returns>
        public override IEnumerable GetDescendants()
        {
            var tmp = new List<Document>();
            using (IRecordsReader dr = SqlHelper.ExecuteReader(
                                        string.Format(m_SQLOptimizedMany.Trim(), "umbracoNode.path LIKE '%," + this.Id + ",%'", "umbracoNode.level"),
                                        SqlHelper.CreateParameter("@nodeObjectType", Document._objectType)))
            {
                while (dr.Read())
                {
                    Document d = new Document(dr.GetInt("id"), true);
                    d.PopulateDocumentFromReader(dr);
                    tmp.Add(d);
                }
            }

            return tmp.ToArray();
        }