Example #1
0
        private PostsQuery GetQuery()
        {
            var query = new PostsQuery().SetOffset((int)_context.StartIndex).SetCount((int)_context.Count);

            _context.SetDataPaginated();
            return(query);
        }
Example #2
0
        private static void GetAnswersByIds()
        {
            PostsQuery p = new PostsQuery { Site = NetworkSiteEnum.StackOverflow };
            IBridgeResponseCollection<Answer> answers = client.GetAnswers(new long[] { 7300527 }, p);

            Console.WriteLine(answers.First().AnswerId);
        }
Example #3
0
        private static void GetAnswersWithParams()
        {
            PostsQuery p = new PostsQuery { Site = NetworkSiteEnum.StackOverflow, Sort = QuerySortEnum.Votes, Order = QueryOrderEnum.Descending, Min = 4000 };
            IBridgeResponseCollection<Answer> answers = client.GetAnswers(p);

            Console.WriteLine(answers.First().AnswerId);
        }
Example #4
0
        protected override void PageLoad()
        {
            Guid?userId = null;

            if (!String.IsNullOrEmpty(UserID))
            {
                userId = Guid.NewGuid();
                try
                {
                    userId = new Guid(UserID);
                }
                catch
                {
                }
            }

            var postsQuery = new PostsQuery();

            mainContainer.BreadCrumbs.Add(new BreadCrumb {
                Caption = BlogsResource.AddonName, NavigationUrl = VirtualPathUtility.ToAbsolute(ASC.Blogs.Core.Constants.BaseVirtualPath)
            });
            if (userId.HasValue)
            {
                mainContainer.BreadCrumbs.Add(new BreadCrumb {
                    Caption = DisplayUserSettings.GetFullUserName(userId.Value, false)
                });
                postsQuery.SetUser(userId.Value);
            }
            else if (!String.IsNullOrEmpty(TagName))
            {
                mainContainer.BreadCrumbs.Add(new BreadCrumb {
                    Caption = HeaderStringHelper.GetHTMLSearchHeader(TagName)
                });
                postsQuery.SetTag(TagName);
            }
            else if (!String.IsNullOrEmpty(Search))
            {
                mainContainer.BreadCrumbs.Add(new BreadCrumb {
                    Caption = HeaderStringHelper.GetHTMLSearchHeader(Search)
                });
                postsQuery.SetSearch(Search);
            }

            if (!IsPostBack)
            {
                var engine = BasePage.GetEngine();
                FillPosts(postsQuery, engine);

                InitSidePanel(engine, TagCloud);
                sideRecentActivity.TenantId  = TenantProvider.CurrentTenantID;
                sideRecentActivity.ProductId = Product.CommunityProduct.ID;
                sideRecentActivity.ModuleId  = ASC.Blogs.Core.Constants.ModuleID;

                base.InitSubscribers(actions);
            }

            this.Title = HeaderStringHelper.GetPageTitle(BlogsResource.AddonName, mainContainer.BreadCrumbs);
        }
Example #5
0
        private static void GetPosts()
        {
            PostsQuery p = new PostsQuery {
                Site = NetworkSiteEnum.StackOverflow
            };
            IBridgeResponseCollection <Post> posts = client.GetPosts(p);

            Console.WriteLine(posts.First().PostId);
        }
Example #6
0
        private static void GetAnswers()
        {
            PostsQuery p = new PostsQuery {
                Site = NetworkSiteEnum.StackOverflow
            };
            IBridgeResponseCollection <Answer> answers = client.GetAnswers(p);

            Console.WriteLine(answers.First().AnswerId);
        }
Example #7
0
        private static void GetAnswersWithParams()
        {
            PostsQuery p = new PostsQuery {
                Site = NetworkSiteEnum.StackOverflow, Sort = QuerySortEnum.Votes, Order = QueryOrderEnum.Descending, Min = 4000
            };
            IBridgeResponseCollection <Answer> answers = client.GetAnswers(p);

            Console.WriteLine(answers.First().AnswerId);
        }
        private void FillPosts(PostsQuery query, BlogsEngine engine)
        {
            query
            .SetOffset((SelectedPage - 1) * BlogsPageSize)
            .SetCount(BlogsPageSize);

            SetTotalPostsCount(engine.GetPostsCount(query));
            var posts = engine.SelectPosts(query);

            FillSelectedPage(posts, engine);
        }
        public async Task <List <Post> > GetLatestPostAsync(int perPage = 10)
        {
            List <Post> result;
            var         query = new PostsQuery {
                PerPage = perPage
            };

            result = await _client.GetPosts(query);

            return(result);
        }
Example #10
0
        protected override void PageLoad()
        {
            PostsAndCommentsCount = new List <Tuple <Post, int> >();

            BlogsPageSize = string.IsNullOrEmpty(Request["size"]) ? 20 : Convert.ToInt32(Request["size"]);
            Guid?userId = null;

            if (!String.IsNullOrEmpty(UserID))
            {
                userId = Guid.NewGuid();
                try
                {
                    userId = new Guid(UserID);
                }
                catch
                {
                }
            }

            var postsQuery = new PostsQuery();

            if (userId.HasValue)
            {
                postsQuery.SetUser(userId.Value);
            }
            else if (!String.IsNullOrEmpty(TagName))
            {
                postsQuery.SetTag(TagName);
            }
            else if (!String.IsNullOrEmpty(Search))
            {
                postsQuery.SetSearch(Search);
            }

            if (!IsPostBack)
            {
                var engine = GetEngine();
                FillPosts(postsQuery, engine);
            }

            Title = HeaderStringHelper.GetPageTitle(BlogsResource.AddonName);

            var jsResource = new StringBuilder();

            jsResource.Append(String.Format("ASC.Community.BlogsJSResource = {{}};ASC.Community.BlogsJSResource.ReadMoreLink = \"{0}\";", BlogsResource.ReadMoreLink));
            jsResource.Append("jq('#tableForNavigation select').val(" + BlogsPageSize + ").change(function(evt) {changeBlogsCountOfRows(this.value);}).tlCombobox();");
            Page.RegisterInlineScript(jsResource.ToString(), true);
        }
Example #11
0
        protected override void PageLoad()
        {
            Guid? userId = null;
            if (!String.IsNullOrEmpty(UserID))
            {
                userId = Guid.NewGuid();
                try
                {
                    userId = new Guid(UserID);
                }
                catch
                {
                }
            }

            var postsQuery = new PostsQuery();
            mainContainer.BreadCrumbs.Add(new BreadCrumb {Caption = BlogsResource.AddonName, NavigationUrl = VirtualPathUtility.ToAbsolute(ASC.Blogs.Core.Constants.BaseVirtualPath)});
            if (userId.HasValue)
            {
                mainContainer.BreadCrumbs.Add(new BreadCrumb {Caption = DisplayUserSettings.GetFullUserName(userId.Value, false)});
                postsQuery.SetUser(userId.Value);
            }
            else if (!String.IsNullOrEmpty(TagName))
            {
                mainContainer.BreadCrumbs.Add(new BreadCrumb { Caption = HeaderStringHelper.GetHTMLSearchHeader(TagName) });
                postsQuery.SetTag(TagName);
            }
            else if (!String.IsNullOrEmpty(Search))
            {
                mainContainer.BreadCrumbs.Add(new BreadCrumb {Caption = HeaderStringHelper.GetHTMLSearchHeader(Search)});
                postsQuery.SetSearch(Search);
            }

            if (!IsPostBack)
            {
                var engine = BasePage.GetEngine();
                FillPosts(postsQuery, engine);

                InitSidePanel(engine, TagCloud);
                sideRecentActivity.TenantId = TenantProvider.CurrentTenantID;
                sideRecentActivity.ProductId = Product.CommunityProduct.ID;
                sideRecentActivity.ModuleId = ASC.Blogs.Core.Constants.ModuleID;

                base.InitSubscribers(actions);
            }

            this.Title = HeaderStringHelper.GetPageTitle(BlogsResource.AddonName, mainContainer.BreadCrumbs);
        }
Example #12
0
 private PostsQuery GetQuery()
 {
     var query = new PostsQuery().SetOffset((int) _context.StartIndex).SetCount((int) _context.Count);
     _context.SetDataPaginated();
     return query;
 }
Example #13
0
        protected override void PageLoad()
        {
            

            BlogsPageSize = string.IsNullOrEmpty(Request["size"]) ? 20 : Convert.ToInt32(Request["size"]);
            Guid? userId = null;
            if (!String.IsNullOrEmpty(UserID))
            {
                userId = Guid.NewGuid();
                try
                {
                    userId = new Guid(UserID);
                }
                catch
                {
                }
            }

            var postsQuery = new PostsQuery();

            if (userId.HasValue)
            {
                postsQuery.SetUser(userId.Value);
            }
            else if (!String.IsNullOrEmpty(TagName))
            {
                postsQuery.SetTag(TagName);
            }
            else if (!String.IsNullOrEmpty(Search))
            {
                postsQuery.SetSearch(Search);
            }

            if (!IsPostBack)
            {
                var engine = GetEngine();
                FillPosts(postsQuery, engine);
            }

            Title = HeaderStringHelper.GetPageTitle(mainContainer.CurrentPageCaption ?? BlogsResource.AddonName);

            var jsResource = new StringBuilder();
            jsResource.Append(String.Format("ASC.Community.BlogsJSResource = {{}};ASC.Community.BlogsJSResource.ReadMoreLink = \"{0}\";", BlogsResource.ReadMoreLink));
            jsResource.Append("jq('#tableForNavigation select').val(" + BlogsPageSize + ").change(function(evt) {changeBlogsCountOfRows(this.value);}).tlCombobox();");
            Page.RegisterInlineScript(jsResource.ToString(), true);
        }
Example #14
0
        private void FillPosts(PostsQuery query, BlogsEngine engine)
        {
            query
                .SetOffset((SelectedPage - 1)*BlogsPageSize)
                .SetCount(BlogsPageSize);

            SetTotalPostsCount(engine.GetPostsCount(query));
            var posts = engine.SelectPosts(query);
            FillSelectedPage(posts, engine);
        }
Example #15
0
        private static void GetPosts()
        {
            PostsQuery p = new PostsQuery { Site = NetworkSiteEnum.StackOverflow };
            IBridgeResponseCollection<Post> posts = client.GetPosts(p);

            Console.WriteLine(posts.First().PostId);
        }
Example #16
0
 public IEnumerable <ThreadModel> Run(PostsQuery query)
 {
     return(this.userGateway.GetActivity(this.credentialMan.User.Id));
 }