示例#1
0
 /// <summary>
 /// 更新数据
 /// </summary>
 /// <param name="obj"></param>
 /// <returns>返回:ture 成功,false 失败</returns>
 public bool Update(D_Tag obj)
 {
     return dal.Update(obj);
 }
示例#2
0
 /// <summary>
 /// 插入数据
 /// </summary>
 /// <param name="obj">对象</param>
 /// <returns>返回:该条数据的主键Id</returns>
 public int Insert(D_Tag obj)
 {
     return dal.Insert(obj);
 }
示例#3
0
 /// <summary>
 /// 更新数据
 /// </summary>
 /// <param name="obj"></param>
 /// <returns>返回:ture 成功,false 失败</returns>
 public bool Update(D_Tag obj)
 {
     if (obj == null) throw new ArgumentNullException("obj");
     String stmtId = "D_Tag.Update";
     int result = SqlMapper.Instance().QueryForObject<int>(stmtId, obj);
     return result > 0 ? true : false;
 }
示例#4
0
        /// <summary>
        /// 通过文章的标签字段来更新标签表,标签存在更新数量,不存在新增标签
        /// </summary>
        /// <param name="tags"></param>
        public void UpdateFromDoc(string[] tags,int docId)
        {
            D_Rel_DocTagBLL drBll = new D_Rel_DocTagBLL();
            //先删除该文档的关联关系
            drBll.DeleteDoc(docId);

            foreach (string s in tags) {
                if (!string.IsNullOrEmpty(s.Trim()))
                {
                    int tagId = 0;
                    Hashtable p = new Hashtable();
                    p.Add("Tag", s);
                    IList<D_Tag> list = GetList(p, null, 0, 1);
                    if (list.Count > 0)
                    {
                        tagId = list[0].TagId;
                        D_Tag oldTag = list[0];
                        oldTag.UseCount += 1;
                        Update(oldTag);
                    }
                    else
                    {
                        D_Tag tag = new D_Tag()
                        {
                            Tag = s,
                            UseCount = 1
                        };
                        tagId = Insert(tag);

                    }
                    //写入文档-标签关联表
                    D_Rel_DocTag dr = new D_Rel_DocTag()
                    {
                        DocId = docId,
                        TagId = tagId
                    };

                    drBll.Insert(dr);
                }
            }
        }
示例#5
0
 /// <summary>
 /// 插入数据
 /// </summary>
 /// <param name="obj">对象</param>
 /// <returns>返回:该条数据的主键Id</returns>
 public int Insert(D_Tag obj)
 {
     if (obj == null) throw new ArgumentNullException("obj");
     String stmtId = "D_Tag.Insert";
     return SqlMapper.Instance().QueryForObject<int>(stmtId, obj);
 }