예제 #1
0
파일: ProductBLL.cs 프로젝트: evelh/Done
        public bool DeleteProductCate(long cateId, long userId)
        {
            d_general_dal dgDal   = new d_general_dal();
            var           proList = _dal.FindListBySql <ivt_product>($"SELECT * from ivt_product where delete_time = 0 and cate_id =" + cateId.ToString());

            if (proList != null && proList.Count > 0)
            {
                proList.ForEach(_ => {
                    _.cate_id = null;
                    EditProduct(_, userId);
                });
            }
            var childCateList = dgDal.GetGeneralByParentId(cateId);

            if (childCateList != null && childCateList.Count > 0)
            {
                GeneralBLL genBll = new GeneralBLL();
                childCateList.ForEach(_ => {
                    genBll.Delete(_.id, userId, (long)GeneralTableEnum.PRODUCT_CATE);
                });
            }
            return(true);
        }