public void ExcluirLeitor(int id) { try { dal = new DAL.LeitorDAL(); DAL.EmprestimoDAL dalEmp = new DAL.EmprestimoDAL(); if (dalEmp.LeitorTemLivro(id)) // se o leitor não tem livros emprestados { throw new Exception("Leitor tem livros emprestados!"); } dal.DeleteLeitor(id); } catch (Exception ex) { throw ex; } }
public void ExcluirLeitor(Leitor leitor) { try { DAL.EmprestimoDAL dalEm = new DAL.EmprestimoDAL(); if (dalEm.SelectEmprestimosByIdLeitor(leitor.IdLeitor).Count > 0) { throw new Exception("Leitor possui pendencias, Impossivel Exclui-lo"); } dal = new DAL.LeitorDAL(); dal.DeleteLeitor(leitor); } catch (Exception ex) { throw ex; } }