Ejemplo n.º 1
0
      private string[] ReverseGeocodeCoordinates(RouteCoords latLngVals)
      {
          string lat = latLngVals.lat;
          string lng = latLngVals.lng;

          string[] cityState = Geocoder.ReverseGeocoder(lat, lng);
          return(cityState);
      }
Ejemplo n.º 2
0
        private void ReverseGeocodeStartingPoint(RouteCoords addressCoords, Event vent)
        {
            string addressEst = Geocoder.FullAddressReverseGeocoder(addressCoords.lat, addressCoords.lng);

            vent.Address        = addressEst;
            vent.LatitudeStart  = addressCoords.lat;
            vent.LongitudeStart = addressCoords.lng;
        }
Ejemplo n.º 3
0
 private RouteCoords[] GetCoordinatesOfPointComments(List <PointComment> pointComments)
 {
     RouteCoords[] pointCoords = new RouteCoords[pointComments.Count()];
     for (int i = 0; i < pointCoords.Length; i++)
     {
         RouteCoords coord = new RouteCoords();
         coord.lat      = pointComments[i].Latitude1;
         coord.lng      = pointComments[i].Longitude1;
         pointCoords[i] = coord;
     }
     return(pointCoords);
 }
Ejemplo n.º 4
0
 private RouteCoords[] CreateRouteCoordsArrayForClient(List <RouteCoordinate> points)
 {
     RouteCoords[] coords = new RouteCoords[points.Count()];
     for (int i = 0; i < coords.Length; i++)
     {
         RouteCoords routeCoord = new RouteCoords();
         routeCoord.lat = points[i].Latitude1;
         routeCoord.lng = points[i].Longitude1;
         coords[i]      = routeCoord;
     }
     return(coords);
 }
Ejemplo n.º 5
0
      private RouteCoords[] GetRouteCoordinates(int routeId)
      {
          var points = _context.RouteCoordinates.Where(a => a.RouteId == routeId).OrderBy(a => a.SortOrder).ToList();

          RouteCoords[] coords = new RouteCoords[points.Count()];
          for (int i = 0; i < coords.Length; i++)
          {
              RouteCoords routeCoord = new RouteCoords();
              routeCoord.lat = points[i].Latitude1;
              routeCoord.lng = points[i].Longitude1;
              coords[i]      = routeCoord;
          }
          return(coords);
      }
Ejemplo n.º 6
0
        private List <RouteCoords[]> CreateRouteCoordsArrayForClient(List <PathComment> pathComments)
        {
            List <RouteCoords[]> pathCoords = new List <RouteCoords[]>(pathComments.Count());

            foreach (PathComment comment in pathComments)
            {
                RouteCoords[] arr    = new RouteCoords[2];
                RouteCoords   coord1 = new RouteCoords();
                coord1.lat = comment.Latitude1;
                coord1.lng = comment.Longitude1;
                RouteCoords coord2 = new RouteCoords();
                coord2.lat = comment.Latitude2;
                coord2.lng = comment.Longitude2;
                arr[0]     = coord1;
                arr[1]     = coord2;
                pathCoords.Add(arr);
            }
            return(pathCoords);
        }
Ejemplo n.º 7
0
      private List <RouteCoords[]> GetPathCommentsCoordinates(List <PathComment> pathComments)
      {
          List <RouteCoords[]> pathCoords = new List <RouteCoords[]> {
          };

          foreach (PathComment comment in pathComments)
          {
              RouteCoords[] arr    = new RouteCoords[2];
              RouteCoords   coord1 = new RouteCoords();
              coord1.lat = comment.Latitude1;
              coord1.lng = comment.Longitude1;
              RouteCoords coord2 = new RouteCoords();
              coord2.lat = comment.Latitude2;
              coord2.lng = comment.Longitude2;
              arr[0]     = coord1;
              arr[1]     = coord2;
              pathCoords.Add(arr);
          }
          return(pathCoords);
      }
Ejemplo n.º 8
0
        public ViewEventVM GetAllEventInfo(int id)
        {
            var         vent    = _context.Events.Find(id);
            ViewEventVM results = new ViewEventVM();

            results.address     = vent.Address;
            results.description = vent.Description;
            var           joinedPeopleInvites = _context.Invites.Join(_context.Users, a => a.UserId, b => b.Id, (a, b) => new { a, b }).Where(c => c.a.Going == true && c.a.EventId == id).ToList();
            List <string> firstNames          = joinedPeopleInvites.Select(d => d.b.FirstName).ToList();
            List <string> lastNames           = joinedPeopleInvites.Select(d => d.b.LastName).ToList();
            List <string> goingMembers        = new List <string>();

            for (int i = 0; i < firstNames.Count(); i++)
            {
                goingMembers.Add($"{firstNames[i]} {lastNames[i]}");
            }
            results.goingNames = goingMembers;
            var routeId = _context.EventRoutes.Where(a => a.EventId == id).Select(a => a.RouteId).ToList();

            if (routeId.Count() > 0)
            {
                results.route1        = GetEventRoute(routeId[0]);
                results.route1Details = _context.EventRoutes.FirstOrDefault(a => a.RouteId == routeId[0]).Details;
            }
            if (routeId.Count() > 1)
            {
                results.route2        = GetEventRoute(routeId[1]);
                results.route2Details = _context.EventRoutes.FirstOrDefault(a => a.RouteId == routeId[1]).Details;
            }
            RouteCoords vm = new RouteCoords();

            vm.lat             = vent.LatitudeStart;
            vm.lng             = vent.LongitudeStart;
            results.startPoint = vm;
            return(results);
        }