Пример #1
0
        public void AddBookmarkTag(long tagInfoID)
        {
            var tagInfo = BizTagInfo.LoadByTagInfoID(tagInfoID);

            if (tagInfo != null)
            {
                //非当前用户标签,复制一份
                if (tagInfo.UserInfoID != UserInfoID)
                {
                    var newTagInfo = new BizTagInfo()
                    {
                        TagName    = tagInfo.TagName,
                        CreateTime = DateTime.Now,
                        UserInfoID = UserInfoID,
                    };
                    newTagInfo.Save();
                    tagInfo = newTagInfo;
                }
            }

            BizBookmarkTagInfo bookmarkTagInfo = new BizBookmarkTagInfo();

            bookmarkTagInfo.CreateTime     = DateTime.Now;
            bookmarkTagInfo.BookmarkInfoID = BookmarkInfoID;
            bookmarkTagInfo.UserInfoID     = UserInfoID;
            bookmarkTagInfo.TagInfoID      = tagInfo.TagInfoID;
            bookmarkTagInfo.Save();
        }
Пример #2
0
        public string AddBookmarkTag(string tagname)
        {
            if (string.IsNullOrEmpty(tagname))
            {
                return("标签不能为空呀。");
            }
            var tagInfo = BizTagInfo.LoadByTagNameAndUserID(tagname, UserInfoID);

            if (tagInfo == null)
            {
                tagInfo            = new BizTagInfo();
                tagInfo.TagName    = tagname;
                tagInfo.UserInfoID = UserInfoID;
                tagInfo.CreateTime = DateTime.Now;
                tagInfo.Save();
            }


            var bookmarkTagInfo = BizBookmarkTagInfo.LoadByBookmarkIDAndTagInfoID(BookmarkInfoID, tagInfo.TagInfoID);

            if (bookmarkTagInfo != null)
            {
                return("已经存在一样的标签了,换一个啦。");
            }
            bookmarkTagInfo                = new BizBookmarkTagInfo();
            bookmarkTagInfo.CreateTime     = DateTime.Now;
            bookmarkTagInfo.BookmarkInfoID = BookmarkInfoID;
            bookmarkTagInfo.UserInfoID     = UserInfoID;
            bookmarkTagInfo.TagInfoID      = tagInfo.TagInfoID;
            bookmarkTagInfo.Save();

            return(string.Empty);
        }
Пример #3
0
        public void RemoveByTagName(string tagName)
        {
            if (BizBookmarkTagInfoList != null)
            {
                var tagInfo = BizTagInfo.LoadByTagNameAndUserID(tagName, UserInfoID);
                if (tagInfo == null)
                {
                    return;
                }

                var bookmarkTagInfo = BizBookmarkTagInfoList.Find(model => model.TagInfoID == tagInfo.TagInfoID);
                if (bookmarkTagInfo != null)
                {
                    BizBookmarkTagInfo.DeleteByBookmarkTagInfoID(bookmarkTagInfo.BookmarkTagInfoID);
                    BizBookmarkTagInfoList.Remove(bookmarkTagInfo);
                }
            }
        }