コード例 #1
0
ファイル: productDetail.aspx.cs プロジェクト: zimo1988/dtcms
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Request.QueryString["id"] != null && Request.QueryString["id"].ToString() != "")
     {
         modelArticle = new DTcms.BLL.article().GetModel(Convert.ToInt32(Request.QueryString["id"]));
     }
 }
コード例 #2
0
        /// <summary>
        /// 验证频道列表数据
        /// </summary>
        /// <param name="channel_name"></param>
        public void validate_channel_data(string channel_name)
        {
            this.channel = channel_name;
            channelModel = new BLL.site_channel().GetModel(channel_name);
            if (null != channelModel && !channelModel.name.Equals(channel_name))
            {
                Response.Redirect(linkurl("error"));
                return;
            }

            BLL.article bll = new BLL.article();
            if (id > 0) //如果ID获取到,将使用ID
            {
                if (!bll.ArticleExists(channel, id))
                {
                    Response.Redirect(linkurl("error"));
                    return;
                }
                model = bll.ArticleModel(channel, id);
            }
            else if (!string.IsNullOrEmpty(call_index)) //否则检查设置的别名
            {
                if (!bll.ArticleExists(channel, call_index))
                {
                    Response.Redirect(linkurl("error"));
                    return;
                }
                model = bll.ArticleModel(channel, call_index);
                //赋值文章ID
                id = model.id;
            }
            else
            {
                Response.Redirect(linkurl("error"));
                return;
            }
            if (model.status == 1)
            {
                Response.Redirect(linkurl("error", "?msg=" + Utils.UrlEncode("浏览得该信息审核还未通过!")));
                return;
            }
            //判断是否是链接
            if (!string.IsNullOrEmpty(model.link_url))
            {
                Response.Redirect(model.link_url);
                return;
            }
            //判断SEO标题
            if (string.IsNullOrEmpty(model.seo_title))
            {
                model.seo_title = site.seo_title;
            }
            if (string.IsNullOrEmpty(model.seo_keywords))
            {
                model.seo_keywords = site.seo_keywords;
            }
            if (string.IsNullOrEmpty(model.seo_description))
            {
                model.seo_description = site.seo_description;
            }
            //获取频道内容
            channelModel = new BLL.site_channel().GetModel(model.channel_id);

            //获取类别内容
            categoryModel = new BLL.article_category().GetModel(model.category_id);

            ViewBag.model = model;
        }