示例#1
0
        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);
        }
示例#2
0
 public virtual bool RemoveVisit(SiteVisit visit)
 {
     if (Visits.Remove(visit))
     {
         visit.Site = null;
         return(true);
     }
     return(false);
 }
示例#3
0
        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());
        }
示例#4
0
 public virtual void AddVisit(SiteVisit visit)
 {
     Visits.Add(visit);
     visit.Site = this;
 }
示例#5
0
 protected internal SiteVisitPhotoReference(Photo photo, SiteVisit siteVisit)
     : base(photo)
 {
     this.SiteVisit = siteVisit;
 }