Esempio n. 1
0
        string AddArticleTag()
        {
            //检查是否已经存在改标签
            List <string> tagsList = ArticleHelper.GetTags(ObjectID);

            if (tagsList != null && tagsList.Contains(TagName))
            {
                return("{\"success\":false,\"msg\":\"该标签已经存在!\"}");
            }
            else
            {
                Article a = ArticleHelper.GetArticle(ObjectID);
                if (a != null)
                {
                    //更新文章标签
                    a.Tags = a.Tags + "'" + TagName + "'";
                    ArticleHelper.UpdateArticle(a, new string[] { "Tags" });

                    //更新标签使用频率
                    TagsHelper.Add(TagName);

                    //记录日志
                    AddLog("编辑文章", string.Format("为文章【{0}】增加标签【{1}】", a.Title, TagName));


                    return("{\"success\":true,\"msg\":\"添加成功!\"}");
                }
                return("{\"success\":false,\"msg\":\"文章已被删除!\"}");
            }
            //string tagLi = "<LI><IMG class=Icon height=16 src=\"/admin/images/icon_globe.gif\" width=16>{0}<A class=Del title=\"删除标签 {0}?\"   href=\"javascript:removeTag('{0}');\"  >[x]</A> </LI>";

            //return string.Format(tagLi, TagName);
        }
Esempio n. 2
0
        string AddChannelTag()
        {
            //检查是否已经存在改标签
            List <string> tagsList = ChannelHelper.GetTags(ObjectID);

            if (tagsList != null && tagsList.Contains(TagName))
            {
                return("{\"success\":false,\"msg\":\"该标签已经存在!\"}");
            }
            else
            {
                Channel a = ChannelHelper.GetChannelById(ObjectID);
                if (a != null)
                {
                    //更新文章标签
                    a.Tags = a.Tags + "'" + TagName + "'";

                    try
                    {
                        ChannelHelper.UpdateChannel(a, new string[] { "Tags" });

                        //更新标签使用频率

                        TagsHelper.Add(TagName);
                    }
                    catch (Exception ex)
                    {
                        return("{\"success\":false,\"msg\":\"" + ex.Message + "\"}");
                    }

                    //记录日志
                    AddLog("编辑文章", string.Format("为栏目【{0}】增加标签【{1}】", a.Title, TagName));


                    return("{\"success\":true,\"msg\":\"添加成功!\"}");
                }
                return("{\"success\":false,\"msg\":\"文章已被删除!\"}");
            }

            return("");
        }