Exemple #1
0
        public static WeightedTagList AddUserStoryTags(string tagString, User user, int storyID, int hostID)
        {
            WeightedTagList tags = GetOrInsertTags(tagString, user.IsAdministrator);

            StoryUserHostTagCollection storyUserHostTags = new StoryUserHostTagCollection();
            foreach (WeightedTag tag in tags) {
                StoryUserHostTag storyUserHostTag = new StoryUserHostTag(); //TODO: GJ: move to WeightedTag.ToStoryUserHostTag()
                storyUserHostTag.StoryID = storyID;
                storyUserHostTag.HostID = hostID;
                storyUserHostTag.UserID = user.UserID;
                storyUserHostTag.TagID = tag.TagID;
                storyUserHostTags.Add(storyUserHostTag);
                StoryCache.ClearUserTaggedStories(tag.TagName, user.UserID, storyID);
            }

            storyUserHostTags.BatchSave();

            UserAction.RecordTag(hostID, user, Story.FetchByID(storyID), tags);

            //when a user adds a tag, we need to mark the story as updated
            //so update the index during the incremental crawl
            Story story = Story.FetchByID(storyID);
            story.UpdatedOn = DateTime.Now;
            story.Save();

            return tags;
        }
        public static void Destroy(int storyID, int userID, int hostID, int tagID)
        {
            //NOTE: GJ: there is most likely a much better way of doing this with subsonic
            Query query = new Query(StoryUserHostTag.Schema).WHERE(StoryUserHostTag.Columns.StoryID, storyID).AND(StoryUserHostTag.Columns.UserID, userID).AND(StoryUserHostTag.Columns.HostID, hostID).AND(StoryUserHostTag.Columns.TagID, tagID);
            StoryUserHostTag storyUserHostTag = new StoryUserHostTag();
            storyUserHostTag.LoadAndCloseReader(StoryUserHostTag.FetchByQuery(query));
            StoryUserHostTag.Destroy(storyUserHostTag.StoryUserHostTagID);

            //update the story for the next crawl to pickup the change
            Story story = Story.FetchByID(storyID);
            story.UpdatedOn = DateTime.Now;
            story.Save();
        }
        public static void Destroy(int storyID, int userID, int hostID, int tagID)
        {
            //NOTE: GJ: there is most likely a much better way of doing this with subsonic
            Query            query            = new Query(StoryUserHostTag.Schema).WHERE(StoryUserHostTag.Columns.StoryID, storyID).AND(StoryUserHostTag.Columns.UserID, userID).AND(StoryUserHostTag.Columns.HostID, hostID).AND(StoryUserHostTag.Columns.TagID, tagID);
            StoryUserHostTag storyUserHostTag = new StoryUserHostTag();

            storyUserHostTag.LoadAndCloseReader(StoryUserHostTag.FetchByQuery(query));
            StoryUserHostTag.Destroy(storyUserHostTag.StoryUserHostTagID);

            //update the story for the next crawl to pickup the change
            Story story = Story.FetchByID(storyID);

            story.UpdatedOn = DateTime.Now;
            story.Save();
        }
        public void Insert(int StoryID, int UserID, int HostID, int TagID, DateTime CreatedOn)
        {
            StoryUserHostTag item = new StoryUserHostTag();

            item.StoryID = StoryID;

            item.UserID = UserID;

            item.HostID = HostID;

            item.TagID = TagID;

            item.CreatedOn = CreatedOn;


            item.Save(UserName);
        }
 public bool Destroy(object StoryUserHostTagID)
 {
     return(StoryUserHostTag.Destroy(StoryUserHostTagID) == 1);
 }
 public bool Delete(object StoryUserHostTagID)
 {
     return(StoryUserHostTag.Delete(StoryUserHostTagID) == 1);
 }
        public void Insert(int StoryID,int UserID,int HostID,int TagID,DateTime CreatedOn)
        {
            StoryUserHostTag item = new StoryUserHostTag();

            item.StoryID = StoryID;

            item.UserID = UserID;

            item.HostID = HostID;

            item.TagID = TagID;

            item.CreatedOn = CreatedOn;

            item.Save(UserName);
        }