private Location GetClosestNodeToDest()
        {
            Console.WriteLine("[DEBUG MESSAGE]: GetClosestNodeToDest() Start");
            Location foundLocation = null;
            LocationCtr locationCtr = new LocationCtr();

            // Get all locations from database, filter them using List<T>.FindAll(...) method.
            List<Location> allLocations = locationCtr.GetAllLocations().FindAll(l => l.Type == 3);

            // Set the currently shortest distance to Dest to positive infinity.
            this.MinDistanceToDest = Double.PositiveInfinity;

            // Iterate over the filtered collection, finding the closest matching location.
            foreach (Location l in allLocations)
            {
                // It's necessary to copy information regarding latitude and longitude
                // to their GeoCoordinate siblings. GeoCoordinate is not represented in
                // the database.
                l.GeoCoordinate.Latitude = l.Latitude;
                l.GeoCoordinate.Longitude = l.Longitude;

                // Get the euclidian distance from current location to original start point
                double fromStart = l.GetDistanceToKM(Start.GeoCoordinate);

                // Get the euclidian distance from current location to original end point
                double toDest = l.GetDistanceToKM(Dest.GeoCoordinate);

                // IF, the distance from the original start point to the current location is less than or
                // equal to the original distance
                // AND the distance to the original endpoint is closer than previous locations
                // THEN proceed.
                if (fromStart <= this.FinalStraightLine && this.MinDistanceToDest > toDest)
                {
                    foundLocation = l;
                    this.MinDistanceToDest = fromStart;
                }
            }
            Console.WriteLine("[DEBUG MESSAGE]: GetClosestNodeToDest() End");
            return foundLocation;
        }
        private void GenerateGraph(string planningMode, BatteryType batteryType)
        {
            Console.WriteLine("[DEBUG MESSAGE]: GenerateGraph() Start");
            LocationCtr locationCtr = new LocationCtr();

            // Get all locations, filter for type 3 (BatteryStation)
            // l => l.Type == 3 (Return l where l.type is equal to 3)
            List<Location> locations = locationCtr.GetAllLocations().FindAll(l => l.Type == 3);
            List<Connection> connections = locationCtr.GetAllConnections();

            // Iterate over the location collection, add these to the graph.
            foreach (Location l in locations)
            {
                this.graph.AddLocation(l);
            }

            // Iterate over the connection collection, add these to the graph
            // including start vertex, end vertex and edge weight.
            foreach (Connection c in connections)
            {
                //TODO Uncomment
                //this.graph.AddConnection(c.From, c.To, c.Distance);
            }

            Console.WriteLine("[DEBUG MESSAGE]: GenerateGraph() End");
        }
        /// <summary>
        /// Generates the graph with all locations and connections. 
        /// The connections are added to the adjacents list on the location.
        /// </summary>
        private void GenerateGraph()
        {
            LocationCtr locationCtr = new LocationCtr();

            List<Location> locations = locationCtr.GetAllLocations();

            List<Connection> connections = locationCtr.GetAllConnections();

            foreach (Location l in locations)
            {
                l.GeoCoordinate.Longitude = l.Longitude;
                l.GeoCoordinate.Latitude = l.Latitude;
                this.graph.AddLocation(l);
            }

            foreach (Connection c in connections)
            {
                this.graph.AddConnection(c.From, c.To, c.Distance);
            }
        }