public Battery GetBatteryByTypeAndLocation(BatteryType batteryType, Location location)
 {
     return (from batteryStation in this.context.BatteryStations
             from battery in batteryStation.Batteries
             where battery.BatteryType == batteryType && batteryStation.ID == location.ID
             select battery).AsNoTracking().FirstOrDefault();
 }
        public BatteryType CreateBatteryType(string name, double chargeTime, double rangeFullyCharged)
        {
            BatteryType batteryType = new BatteryType
            {
                Name = name,
                ChargeTime = chargeTime,
                RangeFullyCharged = rangeFullyCharged,
            };

            this.batteryRepository.InsertBatteryType(batteryType);
            this.batteryRepository.Save();
            return batteryType;
        }
 public void AddBatteryTypeToStation(BatteryStation batteryStation, BatteryType batteryType)
 {
     this.locationRepository.AddBatteryTypeToStation(batteryStation, batteryType);
     this.locationRepository.Save();
 }
 public void RemoveBatteryTypeFromStation(BatteryStation batteryStation, BatteryType batteryType)
 {
     this.locationRepository.RemoveBatteryTypeFromStation(batteryStation, batteryType);
     this.locationRepository.Save();
 }
 public void InsertBatteryType(BatteryType batteryType)
 {
     this.context.BatteryTypes.Add(batteryType);
 }
 public void UpdateBatteryType(BatteryType batteryType)
 {
     this.context.Entry(batteryType).State = EntityState.Modified;
     this.context.SaveChanges();
 }
        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");
        }
 public void UpdateBatteryType(BatteryType batteryType)
 {
     controller.UpdateBatteryType(batteryType);
 }
 public void AddBatteryTypeToStation(BatteryStation batteryStation, BatteryType batteryType)
 {
     controller.AddBatteryTypeToStation(batteryStation, batteryType);
 }
 public void RemoveBatteryTypeFromStation(BatteryStation batteryStation, BatteryType batteryType)
 {
     controller.RemoveBatteryTypeFromStation(batteryStation, batteryType);
 }
示例#11
0
 public Battery GetBatteryByTypeAndLocation(BatteryType batteryType, Location loc)
 {
     return this.batteryRepository.GetBatteryByTypeAndLocation(batteryType, loc);
 }
示例#12
0
 public void UpdateBatteryType(BatteryType batteryType)
 {
     this.batteryRepository.UpdateBatteryType(batteryType);
     this.batteryRepository.Save();
 }
 public void AddBatteryTypeToStation(BatteryStation batteryStation, BatteryType batteryType)
 {
     batteryStation.BatteryTypes.Add(batteryType);
     this.context.Entry(batteryStation).State = EntityState.Modified;
 }
 public void RemoveBatteryTypeFromStation(BatteryStation batteryStation, BatteryType batteryType)
 {
     batteryStation.BatteryTypes.Remove(batteryType);
     this.context.Entry(batteryStation).State = EntityState.Modified;
 }