Exemple #1
0
        /// <summary>
        /// 由标签名和关联的资源ID查找标签ID
        /// </summary>
        /// <param name="tagName"></param>
        /// <param name="resourceId"></param>
        /// <returns></returns>
        private long GetDataByTagNameAndRelation(string tagName, int resourceId)
        {
            MoonDataSet.TagsDataTable dt = TagTableAdapter.GetDataByTagNameAndRelation(tagName, resourceId);
            DataRowCollection         dr = dt.Rows;

            if (dr.Count > 0)
            {
                return((dr[0] as MoonDataSet.TagsRow).TagId);
            }
            return(-1);
        }
Exemple #2
0
        /// <summary>
        /// 查找标签名相同的所有标签的集合
        /// </summary>
        /// <param name="tagName"></param>
        /// <returns></returns>
        private List <Tag> GetDataByTagName(string tagName)
        {
            MoonDataSet.TagsDataTable dt = TagTableAdapter.GetDataByTagName("%" + tagName + "%");
            DataRowCollection         dr = dt.Rows;

            MoonDataSet.TagsRow r;
            List <Tag>          tags = new List <Tag>();

            for (int i = 0; i < dr.Count; i++)
            {
                r = dt[i] as MoonDataSet.TagsRow;
                tags.Add(new Tag(r.TagId.ToString(), r.TagName, r.ResourceId.ToString()));
            }

            return(tags);
        }