private static DataLockEventPeriodsTableColumnStructure ParseDataLockEventPeriodsTableStructure(Table dataLockEventErrors) { var structure = new DataLockEventPeriodsTableColumnStructure(); for (var c = 0; c < dataLockEventErrors.Header.Count; c++) { var header = dataLockEventErrors.Header.ElementAt(c); switch (header) { case "Price Episode identifier": structure.PriceEpisodeIdentifierIndex = c; break; case "Period": structure.PeriodIndex = c; break; case "Payable Flag": structure.PayableFlagIndex = c; break; case "Transaction Type": structure.TransactionTypeIndex = c; break; } } if (structure.PriceEpisodeIdentifierIndex == -1) { throw new ArgumentException("Data lock event periods table is missing Price Episode identifier column"); } return(structure); }
private static DataLockEventPeriodReferenceData ParseDataLockEventPeriodsRow(TableRow row, DataLockEventPeriodsTableColumnStructure structure, LookupContext lookupContext) { return(new DataLockEventPeriodReferenceData { PriceEpisodeIdentifier = row.ReadRowColumnValue <string>(structure.PriceEpisodeIdentifierIndex, "Price Episode identifier"), Period = row.ReadRowColumnValue <string>(structure.PeriodIndex, "Period"), PayableFlag = row.ReadRowColumnValue <bool>(structure.PayableFlagIndex, "Payable Flag"), TransactionType = (TransactionType)row.ReadRowColumnValue <string>(structure.TransactionTypeIndex, "Transaction Type").ToEnumByDescription(typeof(TransactionType)), }); }