public OverrideEntry([NotNull] string complexName, HeatingSystemType heatingSystemType, EnergyDemandSource source, double amount) { ComplexName = complexName; HeatingSystemType = heatingSystemType; Source = source; Amount = amount; }
public List <OverrideEntry> ReadEntries() { string path = @"V:\Dropbox\BurgdorfStatistics\Corrections\Corrections.xlsx"; var p = new ExcelPackage(new FileInfo(path)); var ws = p.Workbook.Worksheets[1]; int row = 2; List <OverrideEntry> ores = new List <OverrideEntry>(); while (ws.Cells[row, 1].Value != null) { string name = (string)ws.Cells[row, 1].Value; string heatingSystemTypeStr = (string)ws.Cells[row, 2].Value; HeatingSystemType hst = (HeatingSystemType)Enum.Parse(typeof(HeatingSystemType), heatingSystemTypeStr); string energyDemandSourceStr = (string)ws.Cells[row, 3].Value; EnergyDemandSource eds = (EnergyDemandSource)Enum.Parse(typeof(EnergyDemandSource), energyDemandSourceStr); double amount = (double)ws.Cells[row, 4].Value; OverrideEntry ore = new OverrideEntry(name, hst, eds, amount); ores.Add(ore); row = row + 1; } p.Dispose(); return(ores); }
public List <OverrideEntry> ReadEntries([NotNull] ServiceRepository services) { string path = Path.Combine(services.RunningConfig.Directories.BaseUserSettingsDirectory, "HeatingSystemOverrides.xlsx"); var p = new ExcelPackage(new FileInfo(path)); var ws = p.Workbook.Worksheets[1]; int row = 2; List <OverrideEntry> ores = new List <OverrideEntry>(); while (ws.Cells[row, 1].Value != null) { string name = (string)ws.Cells[row, 1].Value; string heatingSystemTypeStr = (string)ws.Cells[row, 2].Value; HeatingSystemType hst = (HeatingSystemType)Enum.Parse(typeof(HeatingSystemType), heatingSystemTypeStr); string energyDemandSourceStr = (string)ws.Cells[row, 3].Value; EnergyDemandSource eds = (EnergyDemandSource)Enum.Parse(typeof(EnergyDemandSource), energyDemandSourceStr); double amount = (double)ws.Cells[row, 4].Value; OverrideEntry ore = new OverrideEntry(name, hst, eds, amount); ores.Add(ore); row += 1; } p.Dispose(); return(ores); }