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<BatteryStorage> getStationStorages(int sID) { BatteryStorageCtr sCtr = new BatteryStorageCtr(); List<MBatteryStorage> storages = sCtr.getStationStorages(sID); List<BatteryStorage> bss = new List<BatteryStorage>(); foreach (MBatteryStorage storage in storages) { BatteryStorage bs = new BatteryStorage(); bs.ID = storage.id; bs.typeID = storage.type.id; bs.periods = getStoragePeriods(bs.ID); bs.storageNumber = storage.storageNumber; bss.Add(bs); } return bss; }