public int DeleteCatalogue(CatalogueDTO catalogue, SqlTransaction trans) { CatalogueDAO dao = new CatalogueDAO(); CopyBUS copyBus = new CopyBUS(); bool isInScopeCreated = false; int rs = 1; if (trans == null) { isInScopeCreated = true; trans = ConnectionManager.Con.BeginTransaction("CAT_DEL_TRANSACT"); } List<CopyDTO> list = copyBus.GetCopyByISBN(catalogue.ISBN); foreach (CopyDTO copyDTO in list) { rs = rs & copyBus.DeleteCopy(copyDTO, trans); if (rs == 0) break; } if (rs == 0) { if (isInScopeCreated) trans.Rollback(); } else { rs = rs & dao.DeleteCatalogue(catalogue, trans); if (isInScopeCreated) if (rs == 0) trans.Rollback(); else trans.Commit(); } return rs; }
public List<CopyDTO> LoadCopy(String isbn) { CopyBUS copyBus = new CopyBUS(); return copyBus.GetCopyByISBN(isbn).Where(c => c.Status != 3).ToList(); }