public static SiteVisit Create(Imports.Site importedSite) { importedSite.Trip.AssertIsImported(); var visit = new SiteVisit { ImportingTrip = importedSite.Trip, Visited = importedSite.Trip.Date.Value, Name = importedSite.Name, State = importedSite.State, County = importedSite.County, OwnershipType = importedSite.OwnershipType, Coordinates = importedSite.Coordinates, CalculatedCoordinates = importedSite.CalculateCoordinates(), OwnershipContactInfo = importedSite.OwnershipContactInfo, MakeOwnershipContactInfoPublic = importedSite.MakeOwnershipContactInfoPublic, Comments = importedSite.Comments, Photos = new List <IPhoto>(), Visitors = new List <Name>(importedSite.Trip.Measurers), TripReportUrl = importedSite.Trip.Website }; visit.Photos.AddRange(from photo in importedSite.Photos select new SiteVisitPhotoReference(photo.ToPhoto(), visit)); return(visit); }
public virtual bool RemoveVisit(SiteVisit visit) { if (Visits.Remove(visit)) { visit.Site = null; return(true); } return(false); }
public static Site Create(Imports.Site importedSite) { importedSite.Trip.AssertIsImported(); var site = new Site { Trees = new List <Tree>(), Visits = new List <SiteVisit>(), Name = importedSite.Name, State = importedSite.State, County = importedSite.County, Photos = new List <IPhoto>(), Visitors = new List <Name>() }; site.AddVisit(SiteVisit.Create(importedSite)); foreach (var tree in importedSite.Trees.Select(importedTree => Tree.Create(importedTree))) { site.AddTree(tree); } return(site.RecalculateProperties()); }
public virtual void AddVisit(SiteVisit visit) { Visits.Add(visit); visit.Site = this; }
protected internal SiteVisitPhotoReference(Photo photo, SiteVisit siteVisit) : base(photo) { this.SiteVisit = siteVisit; }