示例#1
0
        public static IEnumerable<AlbumInfo> GetAnswerCollection(int pageSize, int pageIndex, SortInfo objSorting, IEnumerable<AlbumInfo> resultsCollection)
        {
            var defaultResults = resultsCollection.Skip(pageSize * pageIndex).Take(pageSize).ToList();

            if (objSorting != null)
                switch (objSorting.Column)
                {
                    case "oldest":
                        switch (objSorting.Direction)
                        {
                            case Constants.SortDirection.Descending:
                                return (from t in resultsCollection orderby t.PostId descending, t.CreatedOnDate descending select t).Skip(pageSize * pageIndex).Take(pageSize);
                            default:
                                return (from t in resultsCollection orderby t.PostId descending, t.CreatedOnDate ascending select t).Skip(pageSize * pageIndex).Take(pageSize);
                        }
                    case "active":
                        switch (objSorting.Direction)
                        {
                            case Constants.SortDirection.Descending:
                                return (from t in resultsCollection orderby t.PostId descending, t.LastModifiedOnDate descending select t).Skip(pageSize * pageIndex).Take(pageSize);
                            default:
                                return (from t in resultsCollection orderby t.PostId descending, t.LastModifiedOnDate ascending select t).Skip(pageSize * pageIndex).Take(pageSize);
                        }
                    default: // "votes";
                        //CUONGVV
                        switch (objSorting.Direction)
                        {
                            // we always want the accepted answer first, then number of votes, and finally if 2+ answers have same number of votes, we want the newest one on top.
                            case Constants.SortDirection.Descending:
                                return (from t in resultsCollection orderby t.PostId descending, t.CreatedOnDate descending select t).Skip(pageSize * pageIndex).Take(pageSize);
                            default:
                                return (from t in resultsCollection orderby t.PostId descending,t.CreatedOnDate descending select t).Skip(pageSize * pageIndex).Take(pageSize);
                        }
                }
            return defaultResults;
        }
示例#2
0
 public static List<TermInfo> GetTermCollection(int PageSize, int currentPage, SortInfo objSort, List<GB.Album.Entities.TermInfo> topTags)
 {
     throw new System.NotImplementedException();
 }
示例#3
0
        internal static IEnumerable<TermInfo> GetTermCollection(int pageSize, int pageIndex, SortInfo objSorting, IEnumerable<TermInfo> resultsCollection)
        {
            var defaultResults = resultsCollection.Skip(pageSize * pageIndex).Take(pageSize).ToList();

            if (objSorting != null)
                switch (objSorting.Column)
                {
                    case "name":
                        switch (objSorting.Direction)
                        {
                            case Constants.SortDirection.Descending:
                                return (from t in resultsCollection orderby t.Name descending select t).Skip(pageSize * pageIndex).Take(pageSize);
                            default:
                                return (from t in resultsCollection orderby t.Name ascending select t).Skip(pageSize * pageIndex).Take(pageSize);
                        }
                    case "popular":
                        switch (objSorting.Direction)
                        {
                            case Constants.SortDirection.Descending:
                                return (from t in resultsCollection orderby t.TotalTermUsage descending select t).Skip(pageSize * pageIndex).Take(pageSize);
                            default:
                                return (from t in resultsCollection orderby t.TotalTermUsage ascending select t).Skip(pageSize * pageIndex).Take(pageSize);
                        }
                    case "newest":
                        switch (objSorting.Direction)
                        {
                            case Constants.SortDirection.Descending:
                                return (from t in resultsCollection orderby t.CreatedOnDate descending select t).Skip(pageSize * pageIndex).Take(pageSize);
                            default:
                                return (from t in resultsCollection orderby t.CreatedOnDate ascending select t).Skip(pageSize * pageIndex).Take(pageSize);
                        }
                    default: // "daily";
                        switch (objSorting.Direction)
                        {
                            case Constants.SortDirection.Descending:
                                return (from t in resultsCollection orderby t.DayTermUsage descending select t).Skip(pageSize * pageIndex).Take(pageSize);
                            default:
                                return (from t in resultsCollection orderby t.DayTermUsage ascending select t).Skip(pageSize * pageIndex).Take(pageSize);
                        }
                }
            return defaultResults;
        }
示例#4
0
 //internal static IEnumerable<AlbumInfo> GetKeywordSearchCollection(int pageSize, int pageIndex, SortInfo objSorting, IEnumerable<AlbumInfo> resultsCollection)
 //{
 //    var defaultResults = resultsCollection.Skip(pageSize * pageIndex).Take(pageSize).ToList();
 //    if (objSorting != null)
 //        switch (objSorting.Column)
 //        {
 //            case "newest":
 //                switch (objSorting.Direction)
 //                {
 //                    case Constants.SortDirection.Descending:
 //                        return (from t in resultsCollection orderby t.CreatedOnDate descending select t).Skip(pageSize * pageIndex).Take(pageSize);
 //                    default:
 //                        return (from t in resultsCollection orderby t.CreatedOnDate ascending select t).Skip(pageSize * pageIndex).Take(pageSize);
 //                }
 //            case "votes":
 //                switch (objSorting.Direction)
 //                {
 //                    case Constants.SortDirection.Descending:
 //                        return (from t in resultsCollection orderby t.Score descending select t).Skip(pageSize * pageIndex).Take(pageSize);
 //                    default:
 //                        return (from t in resultsCollection orderby t.Score ascending select t).Skip(pageSize * pageIndex).Take(pageSize);
 //                }
 //            default: // "active";
 //                switch (objSorting.Direction)
 //                {
 //                    case Constants.SortDirection.Descending:
 //                        return (from t in resultsCollection orderby t.LastApprovedDate descending select t).Skip(pageSize * pageIndex).Take(pageSize);
 //                    default:
 //                        return (from t in resultsCollection orderby t.LastApprovedDate ascending select t).Skip(pageSize * pageIndex).Take(pageSize);
 //                }
 //        }
 //    return defaultResults;
 //}
 //internal static IEnumerable<UserScoreLogInfo> GetUserRepCollection(int pageSize, IEnumerable<UserScoreLogInfo> resultsCollection)
 //{
 //    return (from t in resultsCollection where t.Score != 0 orderby t.CreatedOnDate descending select t).Skip(0).Take(pageSize);
 //}
 public static object GetTermCollection(int PageSize, int currentPage, SortInfo objSort, List<DotNetNuke.Entities.Content.Taxonomy.Term> topTags)
 {
     throw new System.NotImplementedException();
 }