Exemplo n.º 1
0
        public void Save(Place place)
        {
            PlaceEnvelope envelope = null;

            envelope = _db.SingleOrDefault <PlaceEnvelope>("Name = @name AND Namespace = @nspace",
                                                           new { name = place.Name, nspace = place.Namespace });

            if (envelope == null)
            {
                Add(place);
            }
        }
Exemplo n.º 2
0
        public void Add(Place place)
        {
            var envelope = new PlaceEnvelope();

            envelope.Id                    = place.Id;
            envelope.UserId                = place.UserId;
            envelope.Name                  = place.Name;
            envelope.Namespace             = place.Namespace;
            envelope.Latitude              = place.Location.Latitude;
            envelope.Longitude             = place.Location.Longitude;
            envelope.Altitude              = place.Location.Altitude;
            envelope.BoundaryLatitudeNorth = place.Polygon.Boudary.NorthEast.Latitude;
            envelope.BoundaryLatitudeSouth = place.Polygon.Boudary.SouthWest.Latitude;
            envelope.BoundaryLongitudeEast = place.Polygon.Boudary.NorthEast.Longitude;
            envelope.BoundaryLongitudeWest = place.Polygon.Boudary.SouthWest.Longitude;
            envelope.JsonPayload           = Serialize(place);
            envelope.UsageLevel            = place.UsageLevel;

            _db.Insert(envelope);
        }