private void NewsTypeBind()
    {
        List <Model.ArticleType> typelist = new BLL.ArticleType().GetList(0, "Lang='zh_cn' and IsShow=1 ", "Sort asc");

        if (typelist != null && typelist.Count > 0)
        {
            classid           = classid == 0 ? typelist[0].ClassID.Value : classid;
            hiddClassId.Value = classid.ToString();

            StringBuilder sb = new StringBuilder();

            foreach (Model.ArticleType model in typelist)
            {
                if (model.ClassID.Value == classid)
                {
                    if (!String.IsNullOrEmpty(model.PageTitle))
                    {
                        this.Title = model.PageTitle;
                    }
                    if (!String.IsNullOrEmpty(model.Matedescription))
                    {
                        base.MateDescription = model.Matedescription;
                    }
                    if (!String.IsNullOrEmpty(model.Matekeyword))
                    {
                        base.MetaKeywords = model.Matekeyword;
                    }
                }
                sb.AppendFormat("<li {0} data-classid='{1}'>{2}</li>", model.ClassID.Value == classid ? "class='active'" : "", model.ClassID.Value, model.ClassName);
            }

            lit_NewsType.Text = sb.ToString();
        }
    }
    private void NewsTypeBind(Model.Article model)
    {
        List <Model.ArticleType> typelist = new BLL.ArticleType().GetList(0, "Lang='zh_cn' and IsShow=1 ", "Sort asc");

        if (typelist != null && typelist.Count > 0)
        {
            StringBuilder sb = new StringBuilder();

            foreach (Model.ArticleType item in typelist)
            {
                sb.AppendFormat("<li {0}>{1}</li>", item.ClassID.Value == model.ClassID.Value ? "class='active'" : "", item.ClassName);
            }

            lit_NewsType.Text = sb.ToString();
        }
    }
Exemple #3
0
        /// <summary>
        /// 执行策略
        /// </summary>
        public override void DoWork <T>(T context)
        {
            var articleContext = context as XCLCMS.Data.BLL.Strategy.Article.ArticleContext;

            if (null == articleContext.Article)
            {
                return;
            }

            bool flag = false;

            XCLCMS.Data.BLL.ArticleType bll = new BLL.ArticleType();

            try
            {
                //删除分类关系
                bll.Delete(articleContext.Article.ArticleID);

                //添加分类关系
                flag = bll.Add(articleContext.Article.ArticleID, articleContext.ArticleTypeIDList, new Model.Custom.ContextModel()
                {
                    UserInfoID = articleContext.CurrentUserInfo.UserInfoID,
                    UserName   = articleContext.CurrentUserInfo.UserName
                });
            }
            catch (Exception ex)
            {
                flag = false;
                this.ResultMessage += string.Format("异常信息:{0}", ex.Message);
            }

            if (flag)
            {
                this.Result = StrategyLib.ResultEnum.SUCCESS;
            }
            else
            {
                this.Result        = StrategyLib.ResultEnum.FAIL;
                this.ResultMessage = string.Format("保存文章附件关系信息失败!{0}", this.ResultMessage);
            }
        }