Ejemplo 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);
            }
        }
Ejemplo n.º 2
0
        void getIns()
        {
#if UNITY_ANDROID
            mInsCall = AndroidCall.AndroidCallIns;
#elif UNITY_IOS
            mInsCall = IOSCall.IOSCallIns;
#endif
        }
            public ChainCall Next()
            {
                var newPos = Position + 1;

                if (newPos == StepIds.Length && BaseCall != null)
                {
                    return(BaseCall.Next());
                }
                return(new ChainCall(StepIds, newPos));
            }
Ejemplo n.º 4
0
        public void CreateCall(BaseCall call)
        {
            if (call is CallTreatment)
            {
                call.WorkType = _workTypesRepository.GetById(Constants.TREATMENT_WORKTYPE);
            }
            else if (call is CallVaccine)
            {
                call.WorkType = _workTypesRepository.GetById(Constants.VACCINE_WORKTYPE);
            }

            Validate(call);

            _dbContext.Calls.Add(call);
            _dbContext.SaveChanges();
        }
Ejemplo n.º 5
0
        private static CallDto MapBaseCallToDto(BaseCall call)
        {
            var callsDto = new CallDto
            {
                Address   = call.Address,
                BreedName = call.Animal.Breed.Name,
                Date      = call.Date,
                Id        = call.Id,
                WorkType  = call.WorkType.Name
            };

            if (call is CallTreatment callTreatment)
            {
                callsDto.WorkName = callTreatment.Treatment.Name;
            }
            else if (call is CallVaccine callVaccine)
            {
                callsDto.WorkName = callVaccine.Vaccine.Name;
            }

            return(callsDto);
        }