Esempio n. 1
0
        public virtual void Validate(BaseCall call)
        {
            if (string.IsNullOrWhiteSpace(call.Address))
            {
                throw new ArgumentException(NULL_OR_EMPTY_ADDRESS);
            }

            _animalsRepository.Validate(call.Animal);

            if (call.Date < DateTime.Today)
            {
                throw new ArgumentException(INVALID_DATE);
            }

            _workTypesRepository.Validate(call.WorkType);

            if (call is CallTreatment callTreatment)
            {
                _treatmentsRepository.Validate(callTreatment.Treatment);
            }
            else if (call is CallVaccine callVaccine)
            {
                _vaccinesRepository.Validate(callVaccine.Vaccine);
            }
        }
Esempio n. 2
0
        public void Validate(Graphic graphic)
        {
            if (graphic == null)
            {
                throw new ArgumentNullException(NULL_GRAPHIC);
            }

            _breedsRepository.Validate(graphic.Breed);

            if (graphic.Term < 0)
            {
                throw new ArgumentException(string.Format(WRONG_TERM, graphic.Term));
            }

            _vaccinesRepository.Validate(graphic.Vaccine);
        }