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); } }
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)); }
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(); }
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); }