Exemple #1
0
        public List <Vacinacao> listarVacinacaoForAnimal(int animalId)
        {
            try
            {
                // verificar se o int passado é maior q 0
                if (animalId <= 0)
                {
                    throw new ValidacaoException("Parametro passado é invalido, isto é ,  menor ou igual à 0 ");
                }

                //verificar se o animal existe
                AnimalDaoImp animalDao = new AnimalDaoImp();

                Animal animal = animalDao.getAnimal(animalId);

                // verifica se o animal existe
                if (animal == null)
                {
                    throw new ValidacaoException("Animal inexistente.");
                }

                return(vacinacaoDao.listVacinacaoForAnimal(animal));
            }
            catch (ConexaoException c)
            {
                throw new GeralException(c.Message);
            }
            catch (DaoException d)
            {
                throw new GeralException(d.Message);
            }
            catch (ValidacaoException v) {
                throw new GeralException(v.Message);
            }
        }
Exemple #2
0
        public int getSequenciaDose(int animalId, int vacinaId)
        {
            try
            {
                // verificar se o int passado é maior q 0
                if (animalId <= 0 || vacinaId <= 0)
                {
                    throw new ValidacaoException("Parametro passado é invalido, isto é ,  menor ou igual à 0 ");
                }

                //verificar se o animal existe
                AnimalDaoImp animalDao = new AnimalDaoImp();

                Animal animal = animalDao.getAnimal(animalId);

                // verifica se o animal existe
                if (animal == null)
                {
                    throw new ValidacaoException("Animal inexistente.");
                }


                VacinaDaoImp vacinaDao = new VacinaDaoImp();

                Vacina vacina = vacinaDao.getVacina(vacinaId);

                // verifica se a vacina existe
                if (vacina == null)
                {
                    throw new ValidacaoException("Vacina inexistente.");
                }


                return(vacinacaoDao.getSequenciaDose(animal, vacina));
            }
            catch (ConexaoException c)
            {
                throw new GeralException(c.Message);
            }
            catch (DaoException d)
            {
                throw new GeralException(d.Message);
            }
            catch (ValidacaoException v) {
                throw new GeralException(v.Message);
            }
        }
Exemple #3
0
 public AnimalController()
 {
     this.animalDaoImp = new AnimalDaoImp();
 }