コード例 #1
0
        private void AppendVisit(FieldVisitInfo importedVisit)
        {
            var locationInfo = LocationInfo ?? ResultsAppender.GetLocationByIdentifier(importedVisit.LocationInfo.LocationIdentifier);

            var visit = ResultsAppender.AddFieldVisit(locationInfo, importedVisit.FieldVisitDetails);

            foreach (var controlCondition in importedVisit.ControlConditions)
            {
                ResultsAppender.AddControlCondition(visit, controlCondition);
            }

            foreach (var crossSectionSurvey in importedVisit.CrossSectionSurveys)
            {
                UpgradeCrossSectionSurvey(crossSectionSurvey);
                ResultsAppender.AddCrossSectionSurvey(visit, crossSectionSurvey);
            }

            foreach (var dischargeActivity in importedVisit.DischargeActivities)
            {
                ResultsAppender.AddDischargeActivity(visit, dischargeActivity);
            }

            foreach (var levelSurvey in importedVisit.LevelSurveys)
            {
                ResultsAppender.AddLevelSurvey(visit, levelSurvey);
            }

            foreach (var reading in importedVisit.Readings)
            {
                ResultsAppender.AddReading(visit, reading);
            }
        }
コード例 #2
0
        private void ParseRow()
        {
            var locationIdentifier = GetColumnValue(Survey.LocationColumn);

            if (Survey.LocationAliases.TryGetValue(locationIdentifier, out var aliasedIdentifier))
            {
                locationIdentifier = aliasedIdentifier;
            }

            var locationInfo = LocationInfo ?? ResultsAppender.GetLocationByIdentifier(locationIdentifier);
            var comments     = MergeTextColumns(Survey.CommentColumns);
            var party        = MergeTextColumns(Survey.PartyColumns);
            var timestamp    = ParseTimestamp(locationInfo);

            var readings = Survey
                           .ReadingColumns
                           .Select(ParseReading)
                           .Where(r => r != null)
                           .Select(r =>
            {
                r.DateTimeOffset = timestamp;
                return(r);
            })
                           .ToList();

            var fieldVisitInfo = ResultsAppender.AddFieldVisit(locationInfo,
                                                               new FieldVisitDetails(new DateTimeInterval(timestamp, TimeSpan.Zero))
            {
                Comments = comments,
                Party    = party
            });

            foreach (var reading in readings)
            {
                ResultsAppender.AddReading(fieldVisitInfo, reading);
            }
        }