Пример #1
0
        public void GetListTest1()
        {
            ContentLibrary    target    = new ContentLibrary(); // TODO: Initialize to an appropriate value
            long              siteId    = 7512913955264234783;  // TODO: Initialize to an appropriate value
            string            @where    = string.Empty;         // TODO: Initialize to an appropriate value
            string            sortField = string.Empty;         // TODO: Initialize to an appropriate value
            IList <awContent> expected  = null;                 // TODO: Initialize to an appropriate value
            IList <awContent> actual;

            actual = target.GetList(siteId, @where, sortField);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }
Пример #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="where"></param>
        /// <param name="sortField"></param>
        /// <returns></returns>
        public IList <AWAPI_Data.CustomEntities.ContentExtended> GetList(long siteId, string where, string sortField)
        {
            System.Collections.Generic.IList <awContent> list =
                _contentLibrary.GetList(siteId, where, sortField);

            if (list == null || list.Count == 0)
            {
                return(null);
            }

            var tmp = from l in list
                      select new AWAPI_Data.CustomEntities.ContentExtended
            {
                contentId       = l.contentId,
                alias           = l.alias,
                title           = l.title,
                description     = l.description,
                lineage         = l.lineage,
                sortOrder       = l.sortOrder,
                pubDate         = l.pubDate,
                pubEndDate      = l.pubEndDate,
                contentType     = l.contentType,
                eventStartDate  = l.eventStartDate,
                eventEndDate    = l.eventEndDate,
                imageurl        = l.imageurl,
                isCommentable   = l.isCommentable,
                isEnabled       = l.isEnabled,
                link            = l.link,
                parentContentId = l.parentContentId,
                lastBuildDate   = l.lastBuildDate,
                createDate      = l.createDate,
                siteId          = l.siteId,
                userId          = l.userId
            };

            return(tmp.ToList <AWAPI_Data.CustomEntities.ContentExtended>());
        }
Пример #3
0
        public void LoadCurrentContentList()
        {
            long siteId = App_Code.SessionInfo.CurrentSite.siteId;

            _currentServerContentListSource = _contentLib.GetList(siteId, "", "");
        }
Пример #4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="siteId"></param>
        /// <param name="siteTagId"></param>
        /// <param name="Lineage"></param>
        /// <param name="deep"></param>
        void GetList(long siteId, long contentId, string Lineage, int deep, string tags, string cultureCode)
        {
            awContent parentContent = GetContent(siteId, contentId, Lineage, deep, cultureCode);

            if (parentContent == null)
            {
                return;
            }

            StringBuilder where = new StringBuilder();
            where.Append(" parentContentId=" + parentContent.contentId);

            if (Where.Trim() != "")
            {
                where.Append(" AND ( " + Where + "  ) ");
            }

            IList <awContent> contentList = _contentLib.GetList(true, SiteId, where.ToString(), SortBy, cultureCode).ToList();

            if (contentList == null || contentList.Count() == 0)
            {
                return;
            }

            //FILTER FOR TAGS
            if (tags.Trim().Length > 0)
            {
                IList <awContent> taggedContents = _tagLib.GetTaggedContentList(tags);
                if (taggedContents == null || taggedContents.Count == 0)
                {
                    return;
                }

                ArrayList arrIds = new ArrayList();
                foreach (awContent c in taggedContents)
                {
                    arrIds.Add(c.contentId);
                }

                var taggeds = from t in contentList
                              where arrIds.Contains(t.contentId)
                              select t;
                if (taggeds == null || taggeds.ToList().Count == 0)
                {
                    return;
                }
                contentList = taggeds.ToList();
            }

            //create syndication items for each blog item
            AWAPI_BusinessLibrary.library.ContentCustomFieldLibrary custFieldLib = new ContentCustomFieldLibrary();
            List <SyndicationItem> items = new List <SyndicationItem>();
            int rowNo      = 0;
            int startRowNo = PageIndex * PageSize;

            foreach (awContent content in contentList.ToList())
            {
                //Check if paging is enabled.
                if (PageSize > 0)
                {
                    if (rowNo < startRowNo)
                    {
                        rowNo++;
                        continue;
                    }
                    else if (rowNo >= startRowNo + PageSize)
                    {
                        break;
                    }
                }

                SyndicationItem contentItem = CreateContentSyndicationItem(content);

                AddCustomField(content.contentId, content.parentContentId, cultureCode, ref contentItem);

                items.Add(contentItem);
                rowNo++;
            }

            _feed.Items = items;
        }