public static string ArticleSearch(string ArticleTitle, int startIndex, int maximumRows, string sortExpressions) { ArticleCollection ArticleListSearch = new ArticleCollection(); Dictionary <string, object> dic = new Dictionary <string, object>(); ArticleList = ArticleCollection.GetArticleBySearch(ArticleTitle); Guid subId = SessionHelper.GetSession(SessionKey.SubDomain) == string.Empty ? Guid.Empty : new Guid(SessionHelper.GetSession(SessionKey.SubDomain)); if (subId == Guid.Empty) { ArticleListSearch = ArticleList; } else { PSCPortal.Engine.SubDomain subDomain = new PSCPortal.Engine.SubDomain { Id = subId }; PSCPortal.Engine.PageCollection listPage = subDomain.GetPagesBelongTo(); foreach (var item in listPage) { foreach (var article in ArticleList.Where(ar => ar.PageId == item.Id)) { ArticleListSearch.Add(article); } } } dic.Add("Data", ArticleListSearch.GetSegment(startIndex, maximumRows, sortExpressions)); dic.Add("Count", ArticleListSearch.Count); System.Web.Script.Serialization.JavaScriptSerializer js = new System.Web.Script.Serialization.JavaScriptSerializer(); return(js.Serialize(dic)); }
public static void ArticleEditTopic(string id) { Guid idArticle = new Guid(id); Article article = ArticleList.Where(a => a.Id == idArticle).Single(); article.UserAdd = System.Web.HttpContext.Current.User.Identity.Name; PSCDialog.DataShare = new ArticleArgs(article, article.GetDescription(), article.GetContent(), true); }
public static void ArticleDelete(string[] arrId) { foreach (string id in arrId) { Guid idArticle = new Guid(id); ArticleList.RemoveDB(ArticleList.Where(a => a.Id == idArticle).Single()); Libs.Ultility.DeleteArticleIndexing(idArticle); } }
public static void ArticleSend(string id) { Guid idArticle = new Guid(id); Article article = ArticleList.Where(a => a.Id == idArticle).Single(); Article model = Article.GetArticleAlbum(idArticle); article.ArticleHangDate = article.GetArticleHang(); article.AlbumPath = model.AlbumPath; article.DocumentPath = model.DocumentPath; PSCDialog.DataShare = new ArticleArgs(article, article.GetDescription(), article.GetContent(), true); }
public static bool ArticleChangeTopicPrimary(Guid id) { bool result = false; Article article = ArticleList.Where(a => a.Id == id).Single(); List <Topic> listTopic = article.GetTopicBelong(); if (listTopic.Count > 1) { result = true; PSCDialog.DataShare = new ArticleArgs(article, article.GetDescription(), article.GetContent(), true); } return(result); }
public static void ArticleUnPublish(string[] arrId) { foreach (string id in arrId) { Guid idArticle = new Guid(id); Article article = ArticleList.Where(a => a.Id == idArticle).Single(); Article model = Article.GetArticleAlbum(idArticle); article.IsPublish = false; article.AlbumPath = model.AlbumPath; article.DocumentPath = model.DocumentPath; article.Update(); Libs.Ultility.DeleteArticleIndexing(idArticle); } }
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); }
public static object Search(string tungay, string denngay, int startIndex, int maximumRows, string sortExpressions) { Guid subId = SessionHelper.GetSession(SessionKey.SubDomain) == string.Empty ? Guid.Empty : new Guid(SessionHelper.GetSession(SessionKey.SubDomain)); if (subId == Guid.Empty) { DisplayArticleList = ArticleList.ToList(); } else { DisplayArticleList = new List <Article>(); PSCPortal.Engine.SubDomain subDomain = new PSCPortal.Engine.SubDomain { Id = subId }; PageCollection listPage = subDomain.GetPagesBelongTo(); foreach (var item in listPage) { foreach (var article in ArticleList.Where(ar => ar.PageId == item.Id)) { DisplayArticleList.Add(article); } } } if (tungay != string.Empty && denngay != string.Empty) { IFormatProvider provider = new System.Globalization.CultureInfo("en-CA", true); DateTime startDate = DateTime.Parse(tungay, provider, System.Globalization.DateTimeStyles.NoCurrentDateDefault); DateTime endDate = DateTime.Parse(denngay, provider, System.Globalization.DateTimeStyles.NoCurrentDateDefault); DisplayArticleList = DisplayArticleList.Where(ar => ar.CreatedDate >= startDate && ar.CreatedDate <= endDate).ToList <Article>(); } Dictionary <string, object> result = new Dictionary <string, object>(); try { result["Data"] = IEnumerableExtentionMethods.GetSegmentList(DisplayArticleList, startIndex, maximumRows, sortExpressions); result["Count"] = DisplayArticleList.Count(); } catch (Exception) { throw; } return(result); }