public bool MoveCategory(int oldcatelv1, int oldcatelv2, int newcatelv1, int newcatelv2, int newcatelv3) { var svProduct = new ProductService(); var svBuylead = new BuyleadService(); var svCategory = new CategoryService(); using (var trans = new TransactionScope()) { svProduct.MoveProductInCate(2, oldcatelv2, newcatelv2, newcatelv3); svProduct.MoveProductInCate(1, oldcatelv1, newcatelv1, newcatelv3); trans.Complete(); } using (var trans = new TransactionScope()) { svBuylead.MoveBuyleadInCate(2, oldcatelv2, newcatelv2, newcatelv3); svBuylead.MoveBuyleadInCate(1, oldcatelv1, newcatelv1, newcatelv3); trans.Complete(); } if (svProduct.IsResult) { var categoryNameLV1 = svCategory.SelectData <b2bCategory>("CategoryID,CategoryName", "CategoryID = " + newcatelv1).First(); var categoryNameLV2 = svCategory.SelectData <b2bCategory>("CategoryID,CategoryName", "CategoryID = " + newcatelv2).First(); var categoryNameLV3 = svCategory.SelectData <b2bCategory>("CategoryID,CategoryName", "CategoryID = " + newcatelv3).First(); using (var trans = new TransactionScope()) { var strParent = @"ParentCategoryPath = N'" + categoryNameLV1.CategoryName + " >> " + categoryNameLV2.CategoryName + " >> " + categoryNameLV3.CategoryName + "'"; UpdateByCondition <b2bCategory>("ParentCategoryID = " + newcatelv2 + " , " + strParent, " CategoryID = " + newcatelv3); trans.Complete(); } #region Update Product Count UpdateProductCount(3, newcatelv3); UpdateProductCount(2, oldcatelv2); UpdateProductCount(1, oldcatelv1); UpdateProductCount(3, newcatelv3); UpdateProductCount(2, newcatelv2); UpdateProductCount(1, newcatelv1); #endregion #region Update Buylead Count UpdateBuyleadCount(3, newcatelv3); UpdateBuyleadCount(2, oldcatelv2); UpdateBuyleadCount(1, oldcatelv1); UpdateBuyleadCount(3, newcatelv3); UpdateBuyleadCount(2, newcatelv2); UpdateBuyleadCount(1, newcatelv1); #endregion } return(IsResult); }