public string GetArticleByTopic(string DetailTopic, string articleid, string isPreview) { Dictionary <string, object> dic = new Dictionary <string, object>(); PSCPortal.CMS.Article article = isPreview != null?PSCPortal.CMS.Article.GetArticleUnPublish(articleid) : PSCPortal.CMS.Article.GetArticleByDescription(articleid, DetailTopic); //if (articleid == null) // return; //if (article.Id == Guid.Empty) // return; PSCPortal.CMS.ArticleCollection articleCollection; PSCPortal.CMS.Topic topic = PSCPortal.CMS.Topic.GetTopicPrimary(article.Id.ToString()); if (topic != null) { string chuoi = ""; chuoi = chuoi + " <a style='color:#666;' href=/?TopicId=" + topic.Id.ToString() + ">" + topic.Name + " </a> "; dic.Add("TopicId", topic.Id.ToString()); dic.Add("TopicName", topic.Name); dic.Add("ListTopic", chuoi); dic.Add("ArticleCreatedDate", article.CreatedDate); dic.Add("ArticleTitle", article.Title); dic.Add("ArticleId", article.Id.ToString()); dic.Add("ArticleDescription", PSCPortal.CMS.Article.GetDescription(article.Id)); dic.Add("ArticleContent", PSCPortal.CMS.Article.GetContent(article.Id)); articleCollection = PSCPortal.CMS.ArticleCollection.GetArticleCollectionPublish(topic); int index = 0; for (; index < articleCollection.Count; index++) { if (articleCollection[index].Id.ToString() == articleid) { break; } } IEnumerable <PSCPortal.CMS.Article> it = articleCollection.Skip(index + 1).Take(10); dic.Add("oldListArticle", it); ///////////Commnet////////////// PSCPortal.CMS.ArticleCommentCollection commentList = PSCPortal.CMS.ArticleCommentCollection.GetArticleCommentPublicCollection(article.Id); //if (commentList.Count == 0) // pnCommnet.Visible = false; IEnumerable <PSCPortal.CMS.ArticleComment> commentDB = commentList.Take(5); dic.Add("commentList", commentDB); //RadListView1.DataSource = commentDB; //RadListView1.DataBind(); //if (articleCollection.Count == 1) // pnCactinkhac.Visible = false; } System.Web.Script.Serialization.JavaScriptSerializer js = new System.Web.Script.Serialization.JavaScriptSerializer(); return(js.Serialize(dic)); }
public static bool GetCommentList(string id) { bool result = false; Guid idArticle = new Guid(id); Article article = Article.GetArticle(idArticle.ToString()); PSCPortal.CMS.ArticleCommentCollection CommentList = PSCPortal.CMS.ArticleCommentCollection.GetArticleCommentCollection(idArticle); if (CommentList.Count != 0) { result = true; PSCDialog.DataShare = new PSCPortal.CMS.ArticleArgs(article, article.GetDescription(), article.GetContent(), true); } return(result); }
public static bool GetCommentList(string id) { bool result = false; Guid idArticle = new Guid(id); Article article = ArticleList.Where(a => a.Id == idArticle).Single(); PSCPortal.CMS.ArticleCommentCollection CommentList = PSCPortal.CMS.ArticleCommentCollection.GetArticleCommentCollection(article.Id); // PSCPortal.Modules.FeedBack.Libs.FeedBackCollection CommentList1=PSCPortal.Modules.FeedBack.Libs.FeedBackCollection.GetFeedBackPublicCollectionOfArticle(id); if (CommentList.Count != 0) { result = true; PSCDialog.DataShare = new ArticleArgs(article, article.GetDescription(), article.GetContent(), true); } return(result); }
protected void LoadData() { string articleid = Page.RouteData.Values["Id"] != null ? Page.RouteData.Values["Id"].ToString() : Request.QueryString["ArticleId"]; int index1 = articleid.IndexOf("/"); int review = articleid.IndexOf("Preview"); if (index1 > 0) { articleid = articleid.Substring(0, index1); } PSCPortal.CMS.Article article = review > -1 ? PSCPortal.CMS.Article.GetArticleUnPublish(articleid) : PSCPortal.CMS.Article.GetArticle(articleid); if (articleid == null) { return; } if (article.Id == Guid.Empty) { return; } PSCPortal.CMS.ArticleCollection articleCollection; PSCPortal.CMS.Topic topic = PSCPortal.CMS.Topic.GetTopicPrimary(article.Id.ToString()); if (topic != null) { string chuoi = ""; TopicId = topic.Id.ToString(); chuoi = chuoi + " <a style='color:#666;' href=/?TopicId=" + TopicId + ">" + topic.Name + " </a> "; ListTopic = chuoi; ArticleCreatedDate = article.CreatedDate; ArticleTitle = article.Title; ArticleId = article.Id.ToString(); IsVisibleComment = PSCPortal.CMS.Article.CheckVisibleComment(article.Id); articleCollection = PSCPortal.CMS.ArticleCollection.GetArticleCollectionPublish(topic); int index = 0; for (; index < articleCollection.Count; index++) { if (articleCollection[index].Id.ToString() == articleid) { break; } } int OrtherArticleNumber = int.Parse(System.Configuration.ConfigurationManager.AppSettings["OrtherArticleNumber"]); IEnumerable <PSCPortal.CMS.Article> it = articleCollection.Skip(index + 1).Take(OrtherArticleNumber); rptArticleOld.DataSource = it; rptArticleOld.DataBind(); if (articleCollection.Count == 1) { pnCactinkhac.Visible = false; } } else { PSCPortal.CMS.TopicCollection TopicCollection = PSCPortal.CMS.TopicCollection.GetTopicCollectionByArticleId(article.Id.ToString()); string chuoi = ""; List <string> listobj = new List <string>(); foreach (PSCPortal.CMS.Topic item in TopicCollection) { if (item.Id != Guid.Empty) { chuoi = chuoi + " <a style='color:#666;' href='/?TopicId=" + item.Id + "'> " + item.Name + " </a> "; listobj.Add(item.Id.ToString()); } } ListTopic = chuoi; ArticleCreatedDate = article.CreatedDate; ArticleTitle = article.Title; ArticleId = article.Id.ToString(); IsVisibleComment = article.IsVisibleComment.HasValue ? article.IsVisibleComment : false; articleCollection = PSCPortal.CMS.ArticleCollection.GetListArticleOld(article.CreatedDate, listobj); rptArticleOld.DataSource = articleCollection; rptArticleOld.DataBind(); if (articleCollection.Count == 0) { pnCactinkhac.Visible = false; } } /////////Commment////////////// PSCPortal.CMS.ArticleCommentCollection commentList = PSCPortal.CMS.ArticleCommentCollection.GetArticleCommentPublicCollection(article.Id); //if (commentList.Count == 0) // pnCommnet.Visible = false; //IEnumerable<PSCPortal.CMS.ArticleComment> commentDB = commentList.Take(5); //RadListView1.DataSource = commentDB; //RadListView1.DataBind(); article.IncViewTime(); UserLogin.ArticleId = article.Id.ToString(); }
public static string GetArticleList(int startIndex, int maximumRows, string sortExpressions) { FeedBackList = PSCPortal.CMS.ArticleCommentCollection.GetArticleCommentCollection(artId); System.Web.Script.Serialization.JavaScriptSerializer js = new System.Web.Script.Serialization.JavaScriptSerializer(); return(js.Serialize(FeedBackList.GetSegment(startIndex, maximumRows, sortExpressions))); }