public List<Period> getStoragePeriods(int bsID) { PeriodCtr pCtr = new PeriodCtr(); List<MPeriod> periods = pCtr.getStoragePeriods(bsID); List<Period> ps = new List<Period>(); foreach (MPeriod period in periods) { Period p = new Period(); p.availNumber = period.initBatteryNumber; p.bookedNumber = period.bookedBatteryNumber; p.time = period.time; ps.Add(p); } return ps; }
public Period getPeriod(int bsID, DateTime time) { PeriodCtr pCtr = new PeriodCtr(); MPeriod period = pCtr.getRecord(bsID, time, true); Period p = new Period(); if (period != null) { p.bsID = bsID; p.availNumber = period.initBatteryNumber; p.bookedNumber = period.bookedBatteryNumber; p.time = period.time; } return p; }
public BatteryStorage getStorage(int id) { BatteryStorageCtr sCtr = new BatteryStorageCtr(); PeriodCtr pCtr = new PeriodCtr(); MBatteryStorage storage = sCtr.getRecord(id, true); BatteryStorage s = new BatteryStorage(); if (storage != null) { s.ID = storage.id; s.typeID = storage.type.id; s.periods = getStoragePeriods(id); s.storageNumber = storage.storageNumber; } return s; }
public List<Period> getAllPeriods() { PeriodCtr pCtr = new PeriodCtr(); List<MPeriod> periods = pCtr.getAllRecord(true); List<Period> ps = new List<Period>(); foreach (MPeriod period in periods) { Period p = new Period(); p.availNumber = period.initBatteryNumber; p.bookedNumber = period.bookedBatteryNumber; p.time = period.time; ps.Add(p); } return ps; }