Exemplo n.º 1
0
        static void InitalizeParkingLot(int rows)
        {
            var ParkingLot = new ParkingLotSystem(Path.GetDirectoryName(Application.ExecutablePath), "ParkingLotDB");

            ParkingLot.TruncateTable();
            ParkingLot.InsertSpaces(rows);
            ParkingLot.Save();
        }
Exemplo n.º 2
0
 public DAL(string path)
 {
     _parkingLot = ParkingLotSystem.Load(path);
     foreach (var space in _parkingLot._parkingSpaces)
     {
         if (space.Occupied)
         {
             AddOccupiedSpace(space.UID);
         }
     }
 }
        public static ParkingLotSystem Load()
        {
            ParkingLotSystem ret = null;

            if (File.Exists(_jsonPath) == true)
            {
                var str = File.ReadAllText(_jsonPath);
                ret = JsonConvert.DeserializeObject <ParkingLotSystem>(str);
                ret._parkingSpaces.Sort((x, y) => x.UID.CompareTo(y.UID));
            }
            return(ret);
        }