//tag a product to tagName public Guid Tag(string tagName, Guid userId, string comment) { bn_HashTag bnHashTag = new bn_HashTag(); var hashTag = bnHashTag.GetByTagName(tagName); Guid re = Guid.Empty; if (hashTag != null) { //exists tagName re = Create( hashTag.HashTagId, userId, comment); } else { //not exists var hashTagId = bnHashTag.Create( userId, EHashtag_Type.Public, null, tagName, null, null, null); if (hashTagId != Guid.Empty) { re = Create( hashTagId, userId, comment); } } return(re); }
public pb_ProductTag GetByUserAndTagName(Guid userId, string tagName) { bn_HashTag bnHashTag = new bn_HashTag(); var hashTag = bnHashTag.GetByTagName(tagName); if (hashTag != null) { return(GetByUserAndTagId(userId, hashTag.HashTagId)); } else { return(null); } }
public List <pb_Product> GetByUserAndTagName(Guid userId, string tagName) { bn_HashTag bnHashTag = new bn_HashTag(); List <pb_Product> result = new List <pb_Product>(); var hashTag = bnHashTag.GetByTagName(tagName); if (hashTag != null) { return(GetByUserAndTagId(userId, hashTag.HashTagId)); } else { return(result); } }
public bool IsExists(string tagName) { bn_HashTag bnHashTag = new bn_HashTag(); var hashTag = bnHashTag.GetByTagName(tagName); var productTag = GetByHashTagId(hashTag.HashTagId); if (productTag != null) { return(true); } else { return(false); } }
public Guid Create(Guid hashTagId, Nullable <System.Guid> userId, string comment) { bn_HashTag bnHashTag = new bn_HashTag(); var hashtag = bnHashTag.GetById(hashTagId); var productTagId = Guid.NewGuid(); if (hashtag.Type == EHashtag_Type.System) { if (userId.HasValue && !IsExistsInUser((Guid)userId, hashTagId)) { var re = (int)db.pb_ProductTag_Create( productTagId, productId, hashTagId, userId, comment).Single(); if (re >= 0) { return(productTagId); } } } else { if (!IsExists(hashTagId)) { var re = (int)db.pb_ProductTag_Create( productTagId, productId, hashTagId, userId, comment).Single(); if (re >= 0) { return(productTagId); } } } return(Guid.Empty); }
public static List <string> DivTags(string tags) { List <string> temp; List <string> tagList = new List <string>(); temp = tags.Split(new[] { '#', ' ', ',', '@' }).ToList(); foreach (var item in temp) { if (item != "") { tagList.Add(item.Replace(" ", "")); } } bn_HashTag bnHashTag = new bn_HashTag(); bnHashTag.Create(tagList); return(tagList); }