コード例 #1
0
        public static List <DocumentType> GetAllAsList()
        {
            var documentTypes = new List <DocumentType>();

            using (IRecordsReader dr =
                       SqlHelper.ExecuteReader(m_SQLOptimizedGetAll.Trim(), SqlHelper.CreateParameter("@nodeObjectType", DocumentType._objectType)))
            {
                while (dr.Read())
                {
                    //check if the document id has already been added
                    if (documentTypes.Where(x => x.Id == dr.Get <int>("id")).Count() == 0)
                    {
                        //create the DocumentType object without setting up
                        DocumentType dt = new DocumentType(dr.Get <int>("id"), true);
                        //populate it's CMSNode properties
                        dt.PopulateCMSNodeFromReader(dr);
                        //populate it's ContentType properties
                        dt.PopulateContentTypeNodeFromReader(dr);
                        //populate from it's DocumentType properties
                        dt.PopulateDocumentTypeNodeFromReader(dr);

                        documentTypes.Add(dt);
                    }
                    else
                    {
                        //we've already created the document type with this id, so we'll add the rest of it's templates to itself
                        var dt = documentTypes.Where(x => x.Id == dr.Get <int>("id")).Single();
                        dt.PopulateDocumentTypeNodeFromReader(dr);
                    }
                }
            }

            return(documentTypes.OrderBy(x => x.Text).ToList());
        }
コード例 #2
0
ファイル: DocumentType.cs プロジェクト: elrute/Triphulcas
        public static List<DocumentType> GetAllAsList()
        {

            var documentTypes = new List<DocumentType>();

            using (IRecordsReader dr =
                SqlHelper.ExecuteReader(m_SQLOptimizedGetAll.Trim(), SqlHelper.CreateParameter("@nodeObjectType", DocumentType._objectType)))
            {
                while (dr.Read())
                {
                    //check if the document id has already been added
                    if (documentTypes.Where(x => x.Id == dr.Get<int>("id")).Count() == 0)
                    {
                        //create the DocumentType object without setting up
                        DocumentType dt = new DocumentType(dr.Get<int>("id"), true);
                        //populate it's CMSNode properties
                        dt.PopulateCMSNodeFromReader(dr);
                        //populate it's ContentType properties
                        dt.PopulateContentTypeNodeFromReader(dr);
                        //populate from it's DocumentType properties
                        dt.PopulateDocumentTypeNodeFromReader(dr);

                        documentTypes.Add(dt);
                    }
                    else
                    {
                        //we've already created the document type with this id, so we'll add the rest of it's templates to itself
                        var dt = documentTypes.Where(x => x.Id == dr.Get<int>("id")).Single();
                        dt.PopulateDocumentTypeNodeFromReader(dr);
                    }
                }
            }

            return documentTypes.OrderBy(x => x.Text).ToList();

        }