Exemple #1
0
        protected override void AttachChildControls()
        {
            int.TryParse(this.Page.Request.QueryString["categoryId"], out this.categoryId);
            this.txtCategoryName = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("txtCategoryName");
            this.txtCategoryId   = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("txtCategoryId");
            this.keyWord         = this.Page.Request.QueryString["keyWord"];
            if (!string.IsNullOrWhiteSpace(this.keyWord))
            {
                this.keyWord = this.keyWord.Trim();
            }
            this.rptArticles   = (VshopTemplatedRepeater)this.FindControl("rptArticles");
            this.txtTotalPages = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("txtTotal");
            int pageIndex;

            if (!int.TryParse(this.Page.Request.QueryString["page"], out pageIndex))
            {
                pageIndex = 1;
            }
            int pageSize;

            if (!int.TryParse(this.Page.Request.QueryString["size"], out pageSize))
            {
                pageSize = 20;
            }
            ArticleQuery articleQuery = new ArticleQuery();

            if (!string.IsNullOrEmpty(this.Page.Request.QueryString["CategoryId"]))
            {
                int value = 0;
                if (int.TryParse(this.Page.Request.QueryString["CategoryId"], out value))
                {
                    ArticleCategoryInfo articleCategory = CommentBrowser.GetArticleCategory(value);
                    if (articleCategory != null)
                    {
                        PageTitle.AddSiteNameTitle(articleCategory.Name);
                        articleQuery.CategoryId    = new int?(value);
                        this.txtCategoryId.Value   = value.ToString();
                        this.txtCategoryName.Value = articleCategory.Name;
                    }
                    else
                    {
                        PageTitle.AddSiteNameTitle("文章分类搜索页");
                    }
                }
            }
            articleQuery.Keywords  = this.keyWord;
            articleQuery.PageIndex = pageIndex;
            articleQuery.PageSize  = pageSize;
            articleQuery.SortBy    = "AddedDate";
            articleQuery.SortOrder = SortAction.Desc;
            DbQueryResult articleList = CommentBrowser.GetArticleList(articleQuery);

            this.rptArticles.DataSource = articleList.Data;
            this.rptArticles.DataBind();
            int totalRecords = articleList.TotalRecords;

            this.txtTotalPages.SetWhenIsNotNull(totalRecords.ToString());
        }
Exemple #2
0
 protected override void AttachChildControls()
 {
     this.rptArticles = (WapTemplatedRepeater)this.FindControl("rpt_ArticleCategory");
     int.TryParse(this.Page.Request.QueryString["categoryId"], out this.categoryId);
     if (!this.Page.IsPostBack)
     {
         if (!string.IsNullOrEmpty(this.Page.Request.QueryString["CategoryId"]))
         {
             int.TryParse(this.Page.Request.QueryString["CategoryId"], out this.categoryId);
             ArticleCategoryInfo articleCategory = CommentBrowser.GetArticleCategory(this.categoryId);
             if (articleCategory != null)
             {
                 PageTitle.AddSiteNameTitle(articleCategory.Name);
             }
         }
         else
         {
             PageTitle.AddSiteNameTitle("文章中心");
         }
         this.rptArticles.DataSource = this.GetDataSource();
         this.rptArticles.DataBind();
     }
 }
Exemple #3
0
 protected override void AttachChildControls()
 {
     this.rptArticles = (ThemedTemplatedRepeater)this.FindControl("rptArticles");
     this.pager       = (Pager)this.FindControl("pager");
     if (!this.Page.IsPostBack)
     {
         if (!string.IsNullOrEmpty(this.Page.Request.QueryString["CategoryId"]))
         {
             int categoryId = 0;
             int.TryParse(this.Page.Request.QueryString["CategoryId"], out categoryId);
             ArticleCategoryInfo articleCategory = CommentBrowser.GetArticleCategory(categoryId);
             if (articleCategory != null)
             {
                 PageTitle.AddSiteNameTitle(articleCategory.Name, Hidistro.Membership.Context.HiContext.Current.Context);
             }
         }
         else
         {
             PageTitle.AddSiteNameTitle("文章中心", Hidistro.Membership.Context.HiContext.Current.Context);
         }
         this.BindList();
     }
 }
Exemple #4
0
 protected override void AttachChildControls()
 {
     this.rptArticles = (ThemedTemplatedRepeater)this.FindControl("rptArticles");
     this.pager       = (Pager)this.FindControl("pager");
     if (!this.Page.IsPostBack)
     {
         string parameter = base.GetParameter("CategoryId", false);
         if (!string.IsNullOrEmpty(parameter))
         {
             int categoryId = 0;
             int.TryParse(parameter, out categoryId);
             ArticleCategoryInfo articleCategory = CommentBrowser.GetArticleCategory(categoryId);
             if (articleCategory != null)
             {
                 PageTitle.AddSiteNameTitle(articleCategory.Name);
             }
         }
         else
         {
             PageTitle.AddSiteNameTitle("文章中心");
         }
         this.BindList(parameter);
     }
 }
Exemple #5
0
        protected override void AttachChildControls()
        {
            this.rptArticleCategorys = (WapTemplatedRepeater)this.FindControl("rpt_ArticleCategory");
            this.hdAppId             = (HtmlInputHidden)this.FindControl("hdAppId");
            this.hdTitle             = (HtmlInputHidden)this.FindControl("hdTitle");
            this.hdDesc   = (HtmlInputHidden)this.FindControl("hdDesc");
            this.hdImgUrl = (HtmlInputHidden)this.FindControl("hdImgUrl");
            this.hdLink   = (HtmlInputHidden)this.FindControl("hdLink");
            int.TryParse(this.Page.Request.QueryString["categoryId"], out this.categoryId);
            this.txtCategoryName = (HtmlInputHidden)this.FindControl("txtCategoryName");
            this.txtCategoryId   = (HtmlInputHidden)this.FindControl("txtCategoryId");
            this.keyWord         = this.Page.Request.QueryString["keyWord"].ToNullString();
            if (!string.IsNullOrWhiteSpace(this.keyWord))
            {
                this.keyWord = HttpUtility.UrlDecode(HttpUtility.UrlDecode(this.keyWord)).Trim();
            }
            this.rptArticles   = (WapTemplatedRepeater)this.FindControl("rptArticles");
            this.txtTotalPages = (HtmlInputHidden)this.FindControl("txtTotal");
            int pageIndex = default(int);

            if (!int.TryParse(this.Page.Request.QueryString["page"], out pageIndex))
            {
                pageIndex = 1;
            }
            int pageSize = default(int);

            if (!int.TryParse(this.Page.Request.QueryString["size"], out pageSize))
            {
                pageSize = 20;
            }
            SiteSettings siteSettings = HiContext.Current.SiteSettings;

            this.hdAppId.Value = siteSettings.WeixinAppId;
            ArticleQuery articleQuery = new ArticleQuery();

            this.hdDesc.Value   = siteSettings.SiteDescription;
            this.hdTitle.Value  = siteSettings.SiteName;
            this.hdLink.Value   = Globals.FullPath(HttpContext.Current.Request.Url.ToString());
            this.hdImgUrl.Value = Globals.FullPath(siteSettings.LogoUrl);
            if (!string.IsNullOrEmpty(this.Page.Request.QueryString["CategoryId"]))
            {
                int value = 0;
                if (int.TryParse(this.Page.Request.QueryString["CategoryId"], out value))
                {
                    ArticleCategoryInfo articleCategory = CommentBrowser.GetArticleCategory(value);
                    if (articleCategory != null)
                    {
                        this.hdDesc.Value   = (string.IsNullOrEmpty(articleCategory.Description) ? articleCategory.Description : articleCategory.Name);
                        this.hdImgUrl.Value = (string.IsNullOrEmpty(articleCategory.IconUrl) ? Globals.FullPath(siteSettings.DefaultProductImage) : (articleCategory.IconUrl.Contains("http://") ? articleCategory.IconUrl : ("http://" + HttpContext.Current.Request.Url.Host + articleCategory.IconUrl)));
                        this.hdTitle.Value  = articleCategory.Name;
                        PageTitle.AddSiteNameTitle(articleCategory.Name + "-文章列表");
                        articleQuery.CategoryId    = value;
                        this.txtCategoryId.Value   = value.ToString();
                        this.txtCategoryName.Value = articleCategory.Name;
                    }
                    else
                    {
                        PageTitle.AddSiteNameTitle("文章列表");
                    }
                }
            }
            articleQuery.Keywords  = this.keyWord;
            articleQuery.PageIndex = pageIndex;
            articleQuery.PageSize  = pageSize;
            articleQuery.SortBy    = "AddedDate";
            articleQuery.SortOrder = SortAction.Desc;
            articleQuery.IsRelease = true;
            int           num         = 0;
            DbQueryResult articleList = CommentBrowser.GetArticleList(articleQuery);

            this.rptArticles.DataSource = articleList.Data;
            this.rptArticles.DataBind();
            num = articleList.TotalRecords;
            this.txtTotalPages.SetWhenIsNotNull(num.ToString());
            IList <ArticleCategoryInfo> articleMainCategories = CommentBrowser.GetArticleMainCategories();

            this.rptArticleCategorys.DataSource = articleMainCategories;
            this.rptArticleCategorys.DataBind();
        }