/// <summary> /// 修改知识库的类别( 某一类别下的所有知识库包括子类别的所有知识库 ) /// </summary> public void ChangeArtCate(long cateId, long userId, int parentId) { var subArt = _dal.GetArtByCate(cateId); var dgDal = new d_general_dal(); var gBll = new GeneralBLL(); var subMenu = dgDal.GetGeneralByParentId(cateId); if (subArt != null && subArt.Count > 0) { foreach (var art in subArt) { subArt.ForEach(_ => { _.kb_category_id = parentId; UpdateKnow(_, userId); }); } } if (subMenu != null && subMenu.Count > 0) { foreach (var menu in subMenu) { ChangeArtCate(menu.id, userId, parentId); dgDal.SoftDelete(menu, userId); OperLogBLL.OperLogAdd <d_general>(menu, menu.id, userId, OPER_LOG_OBJ_CATE.General_Code, "删除知识库目录"); } } }
/// <summary> /// 删除知识库目录 /// </summary> public bool DeleteKnowMenu(long cateId, long userId, ref string failReason) { var dgDal = new d_general_dal(); var cate = dgDal.FindNoDeleteById(cateId); if (cate == null) { return(true); } if (cate.parent_id == null) { failReason = "根目录不可删除"; return(false); } var gBll = new GeneralBLL(); ChangeArtCate(cateId, userId, (int)cate.parent_id); //var subMenu = dgDal.GetGeneralByParentId(cateId); //if (subMenu != null && subMenu.Count > 0) // subMenu.ForEach(_ => { // _.parent_id = cate.parent_id; // gBll.EditGeneral(_,userId); // }); //var subArt = _dal.GetArtByCate(cateId); //if(subArt!=null&& subArt.Count > 0) // subArt.ForEach(_=> { // _.kb_category_id = (int)cate.parent_id; // UpdateKnow(_,userId); // }); dgDal.SoftDelete(cate, userId); OperLogBLL.OperLogAdd <d_general>(cate, cate.id, userId, OPER_LOG_OBJ_CATE.General_Code, "删除知识库目录"); return(true); }