protected override void AttachChildControls()
 {
     if (!int.TryParse(this.Page.Request.QueryString["articleId"], out this.articleId))
     {
         base.GotoResourceNotFound();
     }
     this.litArticleAddedDate   = (FormatedTimeLabel)this.FindControl("litArticleAddedDate");
     this.litArticleContent     = (Literal)this.FindControl("litArticleContent");
     this.litArticleDescription = (Literal)this.FindControl("litArticleDescription");
     this.litArticleTitle       = (Literal)this.FindControl("litArticleTitle");
     this.lblFront      = (Label)this.FindControl("lblFront");
     this.lblNext       = (Label)this.FindControl("lblNext");
     this.lblFrontTitle = (Label)this.FindControl("lblFrontTitle");
     this.lblNextTitle  = (Label)this.FindControl("lblNextTitle");
     this.aFront        = (HtmlAnchor)this.FindControl("front");
     this.aNext         = (HtmlAnchor)this.FindControl("next");
     this.ariticlative  = (Common_ArticleRelative)this.FindControl("list_Common_ArticleRelative");
     if (!this.Page.IsPostBack)
     {
         ArticleInfo article = CommentBrowser.GetArticle(this.articleId);
         if ((article != null) && article.IsRelease)
         {
             PageTitle.AddSiteNameTitle(article.Title, HiContext.Current.Context);
             if (!string.IsNullOrEmpty(article.MetaKeywords))
             {
                 MetaTags.AddMetaKeywords(article.MetaKeywords, HiContext.Current.Context);
             }
             if (!string.IsNullOrEmpty(article.MetaDescription))
             {
                 MetaTags.AddMetaDescription(article.MetaDescription, HiContext.Current.Context);
             }
             this.litArticleTitle.Text       = article.Title;
             this.litArticleDescription.Text = article.Description;
             string str = HiContext.Current.HostPath + Globals.GetSiteUrls().UrlData.FormatUrl("ArticleDetails", new object[] { this.articleId });
             this.litArticleContent.Text   = article.Content.Replace("href=\"#\"", "href=\"" + str + "\"");
             this.litArticleAddedDate.Time = article.AddedDate;
             ArticleInfo info2 = CommentBrowser.GetFrontOrNextArticle(this.articleId, "Front", article.CategoryId);
             if ((info2 != null) && (info2.ArticleId > 0))
             {
                 if (this.lblFront != null)
                 {
                     this.lblFront.Visible   = true;
                     this.aFront.HRef        = Globals.GetSiteUrls().UrlData.FormatUrl("ArticleDetails", new object[] { info2.ArticleId });
                     this.lblFrontTitle.Text = info2.Title;
                 }
             }
             else if (this.lblFront != null)
             {
                 this.lblFront.Visible = false;
             }
             ArticleInfo info3 = CommentBrowser.GetFrontOrNextArticle(this.articleId, "Next", article.CategoryId);
             if ((info3 != null) && (info3.ArticleId > 0))
             {
                 if (this.lblNext != null)
                 {
                     this.lblNext.Visible   = true;
                     this.aNext.HRef        = Globals.GetSiteUrls().UrlData.FormatUrl("ArticleDetails", new object[] { info3.ArticleId });
                     this.lblNextTitle.Text = info3.Title;
                 }
             }
             else if (this.lblNext != null)
             {
                 this.lblNext.Visible = false;
             }
             this.ariticlative.DataSource = CommentBrowser.GetArticlProductList(this.articleId);
             this.ariticlative.DataBind();
         }
     }
 }
        protected override void AttachChildControls()
        {
            if (!int.TryParse(this.Page.Request.QueryString["articleId"], out this.articleId))
            {
                base.GotoResourceNotFound("");
            }
            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");
            this.txtCatgoryId          = (HtmlInputHidden)this.FindControl("txtCatgoryId");
            this.litArticleAddedDate   = (FormatedTimeLabel)this.FindControl("litArticleAddedDate");
            this.litArticleContent     = (Literal)this.FindControl("litArticleContent");
            this.litArticleDescription = (Literal)this.FindControl("litArticleDescription");
            this.litArticleTitle       = (Literal)this.FindControl("litArticleTitle");
            this.lblFront              = (Label)this.FindControl("lblFront");
            this.lblNext               = (Label)this.FindControl("lblNext");
            this.lblFrontTitle         = (Label)this.FindControl("lblFrontTitle");
            this.lblNextTitle          = (Label)this.FindControl("lblNextTitle");
            this.aFront                = (HtmlAnchor)this.FindControl("front");
            this.aNext        = (HtmlAnchor)this.FindControl("next");
            this.ariticlative = (Common_ArticleRelative)this.FindControl("list_Common_ArticleRelative");
            SiteSettings siteSettings = HiContext.Current.SiteSettings;

            this.hdAppId.Value = siteSettings.WeixinAppId;
            if (!this.Page.IsPostBack)
            {
                ArticleInfo article = CommentBrowser.GetArticle(this.articleId);
                if (article?.IsRelease ?? false)
                {
                    this.hdDesc.Value   = (string.IsNullOrEmpty(article.Description) ? article.Title : article.Title);
                    this.hdImgUrl.Value = (string.IsNullOrEmpty(article.IconUrl) ? Globals.FullPath(siteSettings.DefaultProductImage) : (article.IconUrl.Contains("http://") ? article.IconUrl : ("http://" + HttpContext.Current.Request.Url.Host + article.IconUrl)));
                    this.hdLink.Value   = Globals.FullPath(HttpContext.Current.Request.Url.ToString());
                    this.hdTitle.Value  = article.Title;
                    ArticleHelper.AddHits(this.articleId);
                    if (this.txtCatgoryId != null)
                    {
                        this.txtCatgoryId.Value = article.CategoryId.ToString();
                    }
                    PageTitle.AddSiteNameTitle(article.Title);
                    if (!string.IsNullOrEmpty(article.Meta_Keywords))
                    {
                        MetaTags.AddMetaKeywords(article.Meta_Keywords, HiContext.Current.Context);
                    }
                    if (!string.IsNullOrEmpty(article.Meta_Description))
                    {
                        MetaTags.AddMetaDescription(article.Meta_Description, HiContext.Current.Context);
                    }
                    this.litArticleTitle.Text       = article.Title;
                    this.litArticleDescription.Text = article.Description;
                    string str = HiContext.Current.HostPath + base.GetRouteUrl("ArticleDetails", new
                    {
                        this.articleId
                    });
                    this.litArticleContent.Text   = article.Content.Replace("href=\"#\"", "href=\"" + str + "\"");
                    this.litArticleAddedDate.Time = article.AddedDate;
                    ArticleInfo frontOrNextArticle = CommentBrowser.GetFrontOrNextArticle(this.articleId, "Front", article.CategoryId);
                    if (frontOrNextArticle != null && frontOrNextArticle.ArticleId > 0)
                    {
                        if (this.lblFront != null)
                        {
                            this.lblFront.Visible   = true;
                            this.aFront.HRef        = "ArticleDetails.aspx?ArticleId=" + frontOrNextArticle.ArticleId;
                            this.lblFrontTitle.Text = frontOrNextArticle.Title;
                        }
                    }
                    else if (this.lblFront != null)
                    {
                        this.lblFront.Visible = false;
                    }
                    ArticleInfo frontOrNextArticle2 = CommentBrowser.GetFrontOrNextArticle(this.articleId, "Next", article.CategoryId);
                    if (frontOrNextArticle2 != null && frontOrNextArticle2.ArticleId > 0)
                    {
                        if (this.lblNext != null)
                        {
                            this.lblNext.Visible   = true;
                            this.aNext.HRef        = "ArticleDetails.aspx?ArticleId=" + frontOrNextArticle2.ArticleId;
                            this.lblNextTitle.Text = frontOrNextArticle2.Title;
                        }
                    }
                    else if (this.lblNext != null)
                    {
                        this.lblNext.Visible = false;
                    }
                }
            }
        }
 protected override void AttachChildControls()
 {
     if (!int.TryParse(this.Page.Request.QueryString["articleId"], out this.articleId))
     {
         base.GotoResourceNotFound("");
     }
     this.txtCatgoryId          = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("txtCatgoryId");
     this.litArticleAddedDate   = (FormatedTimeLabel)this.FindControl("litArticleAddedDate");
     this.litArticleContent     = (System.Web.UI.WebControls.Literal) this.FindControl("litArticleContent");
     this.litArticleDescription = (System.Web.UI.WebControls.Literal) this.FindControl("litArticleDescription");
     this.litArticleTitle       = (System.Web.UI.WebControls.Literal) this.FindControl("litArticleTitle");
     this.lblFront      = (System.Web.UI.WebControls.Label) this.FindControl("lblFront");
     this.lblNext       = (System.Web.UI.WebControls.Label) this.FindControl("lblNext");
     this.lblFrontTitle = (System.Web.UI.WebControls.Label) this.FindControl("lblFrontTitle");
     this.lblNextTitle  = (System.Web.UI.WebControls.Label) this.FindControl("lblNextTitle");
     this.aFront        = (System.Web.UI.HtmlControls.HtmlAnchor) this.FindControl("front");
     this.aNext         = (System.Web.UI.HtmlControls.HtmlAnchor) this.FindControl("next");
     this.ariticlative  = (Common_ArticleRelative)this.FindControl("list_Common_ArticleRelative");
     if (!this.Page.IsPostBack)
     {
         ArticleInfo article = CommentBrowser.GetArticle(this.articleId);
         if (article != null && article.IsRelease)
         {
             if (this.txtCatgoryId != null)
             {
                 this.txtCatgoryId.Value = article.CategoryId.ToString();
             }
             PageTitle.AddSiteNameTitle(article.Title);
             if (!string.IsNullOrEmpty(article.MetaKeywords))
             {
                 MetaTags.AddMetaKeywords(article.MetaKeywords, HiContext.Current.Context);
             }
             if (!string.IsNullOrEmpty(article.MetaDescription))
             {
                 MetaTags.AddMetaDescription(article.MetaDescription, HiContext.Current.Context);
             }
             this.litArticleTitle.Text       = article.Title;
             this.litArticleDescription.Text = article.Description;
             string str = HiContext.Current.HostPath + Globals.GetSiteUrls().UrlData.FormatUrl("ArticleDetails", new object[]
             {
                 this.articleId
             });
             this.litArticleContent.Text   = article.Content.Replace("href=\"#\"", "href=\"" + str + "\"");
             this.litArticleAddedDate.Time = article.AddedDate;
             ArticleInfo frontOrNextArticle = CommentBrowser.GetFrontOrNextArticle(this.articleId, "Front", article.CategoryId);
             if (frontOrNextArticle != null && frontOrNextArticle.ArticleId > 0)
             {
                 if (this.lblFront != null)
                 {
                     this.lblFront.Visible   = true;
                     this.aFront.HRef        = "/WapShop/ArticleDetails.aspx?ArticleId=" + frontOrNextArticle.ArticleId;
                     this.lblFrontTitle.Text = frontOrNextArticle.Title;
                 }
             }
             else
             {
                 if (this.lblFront != null)
                 {
                     this.lblFront.Visible = false;
                 }
             }
             ArticleInfo frontOrNextArticle2 = CommentBrowser.GetFrontOrNextArticle(this.articleId, "Next", article.CategoryId);
             if (frontOrNextArticle2 != null && frontOrNextArticle2.ArticleId > 0)
             {
                 if (this.lblNext != null)
                 {
                     this.lblNext.Visible   = true;
                     this.aNext.HRef        = "/WapShop/ArticleDetails.aspx?ArticleId=" + frontOrNextArticle2.ArticleId;
                     this.lblNextTitle.Text = frontOrNextArticle2.Title;
                     return;
                 }
             }
             else
             {
                 if (this.lblNext != null)
                 {
                     this.lblNext.Visible = false;
                 }
             }
         }
     }
 }
Exemple #4
0
        protected override void AttachChildControls()
        {
            if (!int.TryParse(this.Page.Request.QueryString["articleId"], out this.articleId))
            {
                base.GotoResourceNotFound("");
            }
            this.txtCatgoryId          = (HtmlInputHidden)this.FindControl("txtCatgoryId");
            this.litArticleAddedDate   = (FormatedTimeLabel)this.FindControl("litArticleAddedDate");
            this.litArticleContent     = (Literal)this.FindControl("litArticleContent");
            this.litArticleDescription = (Literal)this.FindControl("litArticleDescription");
            this.litArticleTitle       = (Literal)this.FindControl("litArticleTitle");
            this.lblFront      = (Label)this.FindControl("lblFront");
            this.lblNext       = (Label)this.FindControl("lblNext");
            this.lblFrontTitle = (Label)this.FindControl("lblFrontTitle");
            this.lblNextTitle  = (Label)this.FindControl("lblNextTitle");
            this.aFront        = (HtmlAnchor)this.FindControl("front");
            this.aNext         = (HtmlAnchor)this.FindControl("next");
            this.ariticlative  = (Common_ArticleRelative)this.FindControl("list_Common_ArticleRelative");
            if (!this.Page.IsPostBack)
            {
                ArticleInfo article = CommentBrowser.GetArticle(this.articleId);
                if ((article != null) && article.IsRelease)
                {
                    if (this.txtCatgoryId != null)
                    {
                        this.txtCatgoryId.Value = article.CategoryId.ToString();
                    }
                    PageTitle.AddSiteNameTitle(article.Title);
                    if (!string.IsNullOrEmpty(article.MetaKeywords))
                    {
                        MetaTags.AddMetaKeywords(article.MetaKeywords, HiContext.Current.Context);
                    }
                    if (!string.IsNullOrEmpty(article.MetaDescription))
                    {
                        MetaTags.AddMetaDescription(article.MetaDescription, HiContext.Current.Context);
                    }
                    this.litArticleTitle.Text       = article.Title;
                    this.litArticleDescription.Text = article.Description;
                    string str = HiContext.Current.HostPath + Globals.GetSiteUrls().UrlData.FormatUrl("ArticleDetails", new object[] { this.articleId });
                    this.litArticleContent.Text   = article.Content.Replace("href=\"#\"", "href=\"" + str + "\"");
                    this.litArticleAddedDate.Time = article.AddedDate;
                    ArticleInfo info2 = CommentBrowser.GetFrontOrNextArticle(this.articleId, "Front", article.CategoryId);
                    if ((info2 != null) && (info2.ArticleId > 0))
                    {
                        if (this.lblFront != null)
                        {
                            this.lblFront.Visible   = true;
                            this.aFront.HRef        = "ArticleDetails.aspx?ArticleId=" + info2.ArticleId;
                            this.lblFrontTitle.Text = info2.Title;
                        }
                    }
                    else if (this.lblFront != null)
                    {
                        this.lblFront.Visible = false;
                    }
                    ArticleInfo info3 = CommentBrowser.GetFrontOrNextArticle(this.articleId, "Next", article.CategoryId);
                    if ((info3 != null) && (info3.ArticleId > 0))
                    {
                        if (this.lblNext != null)
                        {
                            this.lblNext.Visible   = true;
                            this.aNext.HRef        = "ArticleDetails.aspx?ArticleId=" + info3.ArticleId;
                            this.lblNextTitle.Text = info3.Title;
                        }
                    }
                    else if (this.lblNext != null)
                    {
                        this.lblNext.Visible = false;
                    }


                    //如果该文章绑定了优惠券,则自动领取优惠券
                    if (article.CouponId > 0)
                    {
                        MemberInfo currentMember = MemberProcessor.GetCurrentMember();
                        if (!CouponHelper.CheckUserIsCoupon(currentMember.UserId, article.CouponId))
                        {
                            //如果还没有领取过,开始领取优惠券
                            int    number;
                            string claimCode = string.Empty;
                            claimCode += article.CouponId + "|" + currentMember.UserId;
                            claimCode  = claimCode.PadLeft(15, 'w');//w代表文章列表获取的
                            CouponItemInfo item = new CouponItemInfo();
                            System.Collections.Generic.IList <CouponItemInfo> listCouponItem = new System.Collections.Generic.List <CouponItemInfo>();
                            item = new CouponItemInfo(article.CouponId, claimCode, new int?(currentMember.UserId), currentMember.UserName, currentMember.Email, System.DateTime.Now);
                            listCouponItem.Add(item);
                            CouponHelper.SendClaimCodes(article.CouponId, listCouponItem);
                            this.Page.Response.Write("<script>alert('恭喜您成功领取了一张优惠券!')</script>");
                        }
                        else
                        {
                            //this.Page.Response.Write("<script>alert('请勿重复领取!')</script>");
                        }
                    }
                }
            }
        }
 protected override void AttachChildControls()
 {
     if (!int.TryParse(base.GetParameter("articleId", false), out this.articleId))
     {
         base.GotoResourceNotFound();
     }
     this.litArticleAddedDate   = (FormatedTimeLabel)this.FindControl("litArticleAddedDate");
     this.litArticleContent     = (Literal)this.FindControl("litArticleContent");
     this.litArticleDescription = (Literal)this.FindControl("litArticleDescription");
     this.litArticleTitle       = (Literal)this.FindControl("litArticleTitle");
     this.lblFront      = (Label)this.FindControl("lblFront");
     this.lblNext       = (Label)this.FindControl("lblNext");
     this.lblFrontTitle = (Label)this.FindControl("lblFrontTitle");
     this.lblNextTitle  = (Label)this.FindControl("lblNextTitle");
     this.aFront        = (HtmlAnchor)this.FindControl("front");
     this.aNext         = (HtmlAnchor)this.FindControl("next");
     this.ariticlative  = (Common_ArticleRelative)this.FindControl("list_Common_ArticleRelative");
     if (!this.Page.IsPostBack)
     {
         ArticleInfo article = CommentBrowser.GetArticle(this.articleId);
         if (article?.IsRelease ?? false)
         {
             ArticleHelper.AddHits(this.articleId);
             PageTitle.AddSiteNameTitle(article.Title);
             if (!string.IsNullOrEmpty(article.Meta_Keywords))
             {
                 MetaTags.AddMetaKeywords(article.Meta_Keywords, HiContext.Current.Context);
             }
             if (!string.IsNullOrEmpty(article.Meta_Description))
             {
                 MetaTags.AddMetaDescription(article.Meta_Description, HiContext.Current.Context);
             }
             this.litArticleTitle.Text       = article.Title;
             this.litArticleDescription.Text = article.Description;
             string str = HiContext.Current.HostPath + base.GetRouteUrl("ArticleDetails", new
             {
                 this.articleId
             });
             this.litArticleContent.Text   = article.Content.Replace("href=\"#\"", "href=\"" + str + "\"");
             this.litArticleAddedDate.Time = article.AddedDate;
             ArticleInfo frontOrNextArticle = CommentBrowser.GetFrontOrNextArticle(this.articleId, "Front", article.CategoryId);
             if (frontOrNextArticle != null && frontOrNextArticle.ArticleId > 0)
             {
                 if (this.lblFront != null)
                 {
                     this.lblFront.Visible = true;
                     this.aFront.HRef      = base.GetRouteUrl("ArticleDetails", new
                     {
                         articleId = frontOrNextArticle.ArticleId
                     });
                     this.lblFrontTitle.Text = frontOrNextArticle.Title;
                 }
             }
             else if (this.lblFront != null)
             {
                 this.lblFront.Visible = false;
             }
             ArticleInfo frontOrNextArticle2 = CommentBrowser.GetFrontOrNextArticle(this.articleId, "Next", article.CategoryId);
             if (frontOrNextArticle2 != null && frontOrNextArticle2.ArticleId > 0)
             {
                 if (this.lblNext != null)
                 {
                     this.lblNext.Visible = true;
                     this.aNext.HRef      = base.GetRouteUrl("ArticleDetails", new
                     {
                         articleId = frontOrNextArticle2.ArticleId
                     });
                     this.lblNextTitle.Text = frontOrNextArticle2.Title;
                 }
             }
             else if (this.lblNext != null)
             {
                 this.lblNext.Visible = false;
             }
             this.ariticlative.DataSource = CommentBrowser.GetArticlProductList(this.articleId);
             this.ariticlative.DataBind();
         }
     }
 }