private void ScheduleVisit(FieldVisit visit) { // Mark the visit as in progress var updatedVisit = _client.Put(new PutFieldVisit { Id = visit.Id, PlanningStatus = PlanningStatusType.IN_PROGRESS }); var message = $"Trip '{visit.FieldTrip.CustomId}' on {visit.StartTime} @ '{visit.SamplingLocation.CustomId}': "; foreach (var plannedActivity in visit.PlannedActivities.Where(a => a.ActivityTemplate.SpecimenTemplates.Any())) { var activityTemplate = plannedActivity.ActivityTemplate; message += $" '{activityTemplate.CustomId}' with {activityTemplate.SpecimenTemplates.Count} specimens {string.Join(", ", activityTemplate.SpecimenTemplates.Select(s => s.Name))}"; var activity = _client.Post(new PostSpecimensFromPlannedActivity { VisitId = visit.Id, Id = plannedActivity.Id, ActivityTemplate = new ActivityTemplate { Id = activityTemplate.Id, Medium = activityTemplate.Medium, SpecimenTemplates = null, Type = activityTemplate.Type }, ActivityType = plannedActivity.ActivityType }); } Info(message); }
public static FieldVisit Create(TreatmentBMP treatmentBMP) { var person = TestPerson.Create(); var fieldVisit = new FieldVisit(treatmentBMP, FieldVisitStatus.InProgress, person, DateTime.Now, false, FieldVisitType.DryWeather, false); return(fieldVisit); }
private bool IsCandidateVisit(FieldVisit visit) { return(visit.FieldTrip != null && visit.PlanningStatus == PlanningStatusType.PLANNED && visit.StartTime.HasValue && visit.PlannedActivities.Any(a => a.ActivityTemplate.SpecimenTemplates.Any())); }