Exemplo n.º 1
0
 public BatteryStation CreateBatteryStation(int id, int type, double longitude, double latitude, string zipCodeID, string streetAddress)
 {
     var batteryStation = new BatteryStation
     {
         ID = id,
         Type = type,
         Longitude = longitude,
         Latitude = latitude,
         ZipCodeNumber = zipCodeID,
         StreetAddress = streetAddress,
     };
     this.locationRepository.InsertLocation(batteryStation);
     this.locationRepository.Save();
     return batteryStation;
 }
Exemplo n.º 2
0
 public void AddBatteriesToStation(Battery battery, BatteryStation batteryStation)
 {
     this.locationRepository.AddBatteriesToStation(batteryStation, battery);
     this.locationRepository.Save();
 }
Exemplo n.º 3
0
 public void AddBatteryTypeToStation(BatteryStation batteryStation, BatteryType batteryType)
 {
     this.locationRepository.AddBatteryTypeToStation(batteryStation, batteryType);
     this.locationRepository.Save();
 }
Exemplo n.º 4
0
 public void RemoveBatteriesFromStation(BatteryStation batteryStation, Battery battery)
 {
     this.locationRepository.RemoveBatteriesFromStation(batteryStation, battery);
     this.locationRepository.Save();
 }
Exemplo n.º 5
0
 public void RemoveBatteryTypeFromStation(BatteryStation batteryStation, BatteryType batteryType)
 {
     this.locationRepository.RemoveBatteryTypeFromStation(batteryStation, batteryType);
     this.locationRepository.Save();
 }
 public void AddBatteryTypeToStation(BatteryStation batteryStation, BatteryType batteryType)
 {
     controller.AddBatteryTypeToStation(batteryStation, batteryType);
 }
Exemplo n.º 7
0
        public void ReadBatteryStations()
        {
            string locations = @".\..\..\batterystations.xml";
            reader = XmlReader.Create(locations);

            BatteryStation loc = null;
            this.batteryStationList = new List<Location>();

            while (reader.Read())
            {
                if ((reader.NodeType == XmlNodeType.Element))
                {
                    string switchCase = reader.Name;
                    switch (switchCase)
                    {
                        case "RECORD":
                            loc = new BatteryStation();
                            batteryStationList.Add(loc);
                            break;

                        case "streetaddress":
                            reader.Read();
                            loc.StreetAddress = reader.Value;
                            //Console.WriteLine(loc.StreetAddress);
                            break;

                        case "zipcode":
                            reader.Read();
                            //loc.ZipCode = new ZipCodes { ZipCode = reader.Value };
                            loc.ZipCodeNumber = reader.Value;
                            //Console.WriteLine(loc.ZipCode);
                            break;

                        case "city":
                            reader.Read();
                            //loc.City = reader.Value;
                            //Console.WriteLine(loc.City);
                            break;

                        case "longitude":
                            reader.Read();
                            string longitude = reader.Value;
                            loc.Longitude = Convert.ToDouble(reader.Value, System.Globalization.CultureInfo.InvariantCulture);
                            //Console.WriteLine(loc.Longitude);
                            break;

                        case "latitude":
                            reader.Read();
                            loc.Latitude = Convert.ToDouble(reader.Value, System.Globalization.CultureInfo.InvariantCulture);
                            //Console.WriteLine(loc.Latitude);
                            break;

                        case "id":
                            reader.Read();
                            loc.ID = Convert.ToInt16(reader.Value);
                            //Console.WriteLine(loc.Id);
                            break;

                        case "type":
                            reader.Read();
                            loc.Type = Convert.ToInt16(reader.Value);
                            //Console.WriteLine(loc.Type);
                            break;
                    }
                }
            }
        }
 public void AddBatteriesToStation(Battery battery, BatteryStation batteryStation)
 {
     controller.AddBatteriesToStation(battery, batteryStation);
 }
 public void RemoveBatteryTypeFromStation(BatteryStation batteryStation, BatteryType batteryType)
 {
     controller.RemoveBatteryTypeFromStation(batteryStation, batteryType);
 }
 public void RemoveBatteriesFromStation(BatteryStation batteryStation, Battery battery)
 {
     controller.RemoveBatteriesFromStation(batteryStation, battery);
 }
 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;
 }