Exemplo n.º 1
0
        private static void Test_tags()
        {
            TagsManager tags = new TagsManager(AppDomain.CurrentDomain.BaseDirectory + "tags.xml");

            tags.Add(new Tag {
                Name = "能查不1", Description = "", LinkUri = "/"
            });
            tags.Add(new Tag {
                Name = "能查不2", Description = "", LinkUri = "/"
            });
            tags.Add(new Tag {
                Name = "能查不2", Description = "", LinkUri = "/"
            });
            tags.Delete("24");

            // tags.Update(t);

            foreach (Tag t1 in tags.Tags)
            {
                Console.WriteLine(t1.Name);
            }
        }
Exemplo n.º 2
0
        private void CreateTags()
        {
            string msg = String.Empty;

            string id          = request.Form["id"],
                   name        = request.Form["name"],
                   linkUri     = request.Form["linkuri"],
                   description = request.Form["description"];

            StringBuilder sb = new StringBuilder();

            if (string.IsNullOrEmpty(id))
            {
                sb.Append("编号不能为空!");
            }
            else if (!Regex.IsMatch(id, "^[a-zA-Z0-9]+$"))
            {
                sb.Append("编号必须为字母和数字");
            }

            if (String.IsNullOrEmpty(name))
            {
                sb.Append("名称不能为空!");
            }
            if (sb.Length != 0)
            {
                msg = sb.ToString();
                goto tip;
            }

            bool result = tagsManager.Add(new Tag
            {
                Name        = name,
                LinkUri     = linkUri,
                Description = description
            });

            msg = result ? "添加成功" : "已经存在相同的标签";
tip:
            response.Write(String.Format("<script>window.parent.tip('{0}');</script>", msg));
        }
Exemplo n.º 3
0
        private static void Test_tags()
        {
            TagsManager tags = new TagsManager(AppDomain.CurrentDomain.BaseDirectory+"tags.xml");

            tags.Add(new Tag {  Name = "能查不1", Description = "", LinkUri = "/" });
            tags.Add(new Tag {  Name = "能查不2", Description = "", LinkUri = "/" });
            tags.Add(new Tag {  Name = "能查不2", Description = "", LinkUri = "/" });
            tags.Delete("24");

               // tags.Update(t);

            foreach (Tag t1 in tags.Tags)
            {
                Console.WriteLine(t1.Name);
            }
        }