コード例 #1
0
        //Thống kê truy cập bài viết
        public static List <Article> ThongKeTruyCapBaiViet(string tungay, string denngay)
        {
            PSCPortal.CMS.ArticleCollection ArticleList = ArticleCollection.GetArticleViewTimeCollectionPublish();
            List <Article> result = new List <Article>();
            Guid           subId  = SessionHelper.GetSession(SessionKey.SubDomain) == string.Empty ? Guid.Empty : new Guid(SessionHelper.GetSession(SessionKey.SubDomain));

            if (subId == Guid.Empty)
            {
                result = ArticleList.ToList();
            }
            else
            {
                result = new List <Article>();
                PSCPortal.Engine.SubDomain subDomain = new PSCPortal.Engine.SubDomain {
                    Id = subId
                };
                nameWorksheet = PSCPortal.Engine.SubDomain.GetSubById(subId.ToString()).Description;
                PageCollection listPage = subDomain.GetPagesBelongTo();
                foreach (var item in listPage)
                {
                    foreach (var article in ArticleList.Where(ar => ar.PageId == item.Id))
                    {
                        result.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);
                result = result.Where(ar => ar.CreatedDate >= startDate && ar.CreatedDate <= endDate).ToList <Article>();
            }
            return(result);
        }
コード例 #2
0
ファイル: TrashManage.aspx.cs プロジェクト: minhchau2236/pgkh
        public static string GetArticleTrashList(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)
            {
                DisplayArticleTrashList = ArticleTrashList.ToList();
            }
            else
            {
                DisplayArticleTrashList = 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 ArticleTrashList.Where(ar => ar.PageId == item.Id))
                    {
                        DisplayArticleTrashList.Add(article);
                    }
                }
            }
            // kiem tra nhung bai viet duoc goi den da xu ly ?
            foreach (var item in ArticleSendList.Where(ar => ar.IsCheck == false))
            {
                Article article = DisplayArticleTrashList.SingleOrDefault(ar => ar.Id == item.Id);
                if (article != null)
                {
                    DisplayArticleTrashList.Remove(article);
                }
            }
            System.Web.Script.Serialization.JavaScriptSerializer js = new System.Web.Script.Serialization.JavaScriptSerializer();
            return(js.Serialize(Libs.IEnumerableExtentionMethods.GetSegmentList(DisplayArticleTrashList, startIndex, maximumRows, sortExpressions)));
        }
コード例 #3
0
        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);
        }
コード例 #4
0
ファイル: SubDomainArgs.cs プロジェクト: minhchau2236/pgkh
 public SubDomainArgs(SubDomain sub, bool isEdit)
 {
     _subdomain = sub;
     _isEdit    = isEdit;
 }