예제 #1
0
        public OnlandVisualTrashAssessmentObservationSimple(OnlandVisualTrashAssessmentObservation o)
        {
            OnlandVisualTrashAssessmentObservationID = o.OnlandVisualTrashAssessmentObservationID;
            OnlandVisualTrashAssessmentID            = o.OnlandVisualTrashAssessmentID;
            Note = o.Note;
            ObservationDateTime = o.ObservationDatetime;

            LocationX = o.LocationPoint4326.XCoordinate.GetValueOrDefault();
            LocationY = o.LocationPoint4326.YCoordinate.GetValueOrDefault();

            // todo: ensure there is a database constraint ensuring one photo per observo
            var photo = o.OnlandVisualTrashAssessmentObservationPhotos.SingleOrDefault();

            PhotoID = photo
                      ?.OnlandVisualTrashAssessmentObservationPhotoID;
            PhotoUrl = photo?.FileResource.GetFileResourceUrl();
        }
예제 #2
0
 /// <summary>
 /// Creates a "blank" object of this type and populates primitives with defaults
 /// </summary>
 public static OnlandVisualTrashAssessmentObservationPhoto CreateNewBlank(FileResource fileResource, OnlandVisualTrashAssessmentObservation onlandVisualTrashAssessmentObservation)
 {
     return(new OnlandVisualTrashAssessmentObservationPhoto(fileResource, onlandVisualTrashAssessmentObservation));
 }
예제 #3
0
 public static void DeleteOnlandVisualTrashAssessmentObservation(this IQueryable <OnlandVisualTrashAssessmentObservation> onlandVisualTrashAssessmentObservations, OnlandVisualTrashAssessmentObservation onlandVisualTrashAssessmentObservationToDelete)
 {
     DeleteOnlandVisualTrashAssessmentObservation(onlandVisualTrashAssessmentObservations, new List <OnlandVisualTrashAssessmentObservation> {
         onlandVisualTrashAssessmentObservationToDelete
     });
 }
예제 #4
0
 /// <summary>
 /// Constructor for building a new object with MinimalConstructor required fields, using objects whenever possible
 /// </summary>
 public OnlandVisualTrashAssessmentObservationPhoto(FileResource fileResource, OnlandVisualTrashAssessmentObservation onlandVisualTrashAssessmentObservation) : this()
 {
     // Mark this as a new object by setting primary key with special value
     this.OnlandVisualTrashAssessmentObservationPhotoID = ModelObjectHelpers.MakeNextUnsavedPrimaryKeyValue();
     this.FileResourceID = fileResource.FileResourceID;
     this.FileResource   = fileResource;
     fileResource.OnlandVisualTrashAssessmentObservationPhotos.Add(this);
     this.OnlandVisualTrashAssessmentObservationID = onlandVisualTrashAssessmentObservation.OnlandVisualTrashAssessmentObservationID;
     this.OnlandVisualTrashAssessmentObservation   = onlandVisualTrashAssessmentObservation;
     onlandVisualTrashAssessmentObservation.OnlandVisualTrashAssessmentObservationPhotos.Add(this);
 }