Ejemplo n.º 1
0
 public void updateRecord(int bsID, DateTime time)
 {
     IDPeriod dbPeriod = new DBPeriod();
     IDBBatteryStorage dbStorage = new DBBatteryStorage();
     MBatteryStorage storage = dbStorage.getRecord(bsID, true);
     int init = storage.storageNumber;
     dbPeriod.updateRecord(bsID, time, init);
 }
Ejemplo n.º 2
0
 public bool deleteBookingForStation(int sId, int btId, int quantity, DateTime time)
 {
     bool success = false;
     IDBBatteryStorage dbStorage = new DBBatteryStorage();
     MBatteryStorage storage = dbStorage.getRecord(btId, sId, true);
     IDPeriod dbPeriod = new DBPeriod();
     PeriodCalculator pCalc = new PeriodCalculator();
     try
     {
         MPeriod period = pCalc.getBookingPeriod(storage, time);
         period.bookedBatteryNumber = period.bookedBatteryNumber - quantity;
         dbPeriod.updateRecord(storage.id, period.time, period.initBatteryNumber, period.bookedBatteryNumber);
         success = true;
     }
     catch (Exception)
     {
         throw new SystemException("Can not delete Booking");
     }
     return success;
 }
Ejemplo n.º 3
0
 public void updateRecord(int id, int btid, int sID, int storageNumber)
 {
     IDBBatteryStorage dbStorage = new DBBatteryStorage();
     dbStorage.updateRecord(id, btid, sID, storageNumber);
     IDPeriod dbPeriod = new DBPeriod();
     PeriodCalculator pCalc = new PeriodCalculator();
     MPeriod period = pCalc.getBookingPeriod(getRecord(id,true),DateTime.Now);
     List<MPeriod> periods = pCalc.getAllPeriodsAfter(getRecord(id, true), period);
     foreach (MPeriod p in periods)
     {
         dbPeriod.updateRecord(id, p.time, pCalc.getInitNumber(getRecord(id, true)));
     }
 }