public TagCollection FetchAll()
 {
     TagCollection coll = new TagCollection();
     Query qry = new Query(Tag.Schema);
     coll.LoadAndCloseReader(qry.ExecuteReader());
     return coll;
 }
Beispiel #2
0
        public static WeightedTagList GetOrInsertTags(string tagString, bool isAdministrator)
        {
            List<string> rawTags = TagHelper.DistillTagInput(tagString, isAdministrator);

            WeightedTagList tags = new WeightedTagList();
            TagCollection newTags = new TagCollection();
            foreach (string tagIdentifier in rawTags) {
                //TODO: GJ: get from cache
                Tag tag = Tag.FetchTagByIdentifier(tagIdentifier);

                if (tag == null) {
                    tag = new Tag();
                    tag.TagIdentifier = tagIdentifier;
                    newTags.Add(tag);
                } else {
                    tags.Add(new WeightedTag(tag.TagID, tag.TagIdentifier, 1));
                }
            }

            // newTags.BatchSave(); //TODO: GJ: does BatchSave update identity colums after save?

            foreach (Tag newTag in newTags) {
                newTag.Save(); //TODO: GJ: does BatchSave update identity colums after save?
                tags.Add(new WeightedTag(newTag.TagID, newTag.TagIdentifier, 1));
            }

            return tags;
        }
Beispiel #3
0
 public static Tag FetchTagByParameter(string columnName, object value)
 {
     //NOTE: GJ: maybe we should add support for this in SubSonic? (like rails does)
     TagCollection t = new TagCollection();
     t.Load(Tag.FetchByParameter(columnName, value));
     if (t.Count == 0)
         return null;
     else
         return t[0];
 }
Beispiel #4
0
 public static TagCollection FetchUserTags(int userID)
 {
     TagCollection tags = new TagCollection();
     tags.Load(SPs.Kick_GetTagsByUserID(userID).GetReader());
     return tags;
 }
Beispiel #5
0
 public static TagCollection FetchTags(int hostID, DateTime createdOnLower, DateTime createdOnUpper)
 {
     TagCollection tags = new TagCollection();
     tags.Load(SPs.Kick_GetTagsByHostIDAndCreatedOnRange(hostID, createdOnLower, createdOnUpper).GetReader());
     return tags;
 }
Beispiel #6
0
 public static TagCollection FetchStoryTags(int storyID)
 {
     TagCollection tags = new TagCollection();
     tags.LoadAndCloseReader(SPs.Kick_GetTagsByStoryID(storyID).GetReader());
     return tags;
 }
 public TagCollection FetchByQuery(Query qry)
 {
     TagCollection coll = new TagCollection();
     coll.LoadAndCloseReader(qry.ExecuteReader());
     return coll;
 }
 public TagCollection FetchByID(object TagID)
 {
     TagCollection coll = new TagCollection().Where("TagID", TagID).Load();
     return coll;
 }
Beispiel #9
0
        public TagCollection FetchByID(object TagID)
        {
            TagCollection coll = new TagCollection().Where("TagID", TagID).Load();

            return(coll);
        }