public static List <Transaction> GetTransactions(string sourceFilePath, string accountMappingPath) { List <AccountMapping> listofAccountMappings = ProcessAccountMapping.GetAccountMappings(accountMappingPath); return(File.ReadAllLines(sourceFilePath) .Skip(1) .Select(s => { var str = s.Split(','); return new Transaction { id = str[0], loadDate = str[1], iban = str[2], companyCode = listofAccountMappings.Where(a => a.iban == str[2]).Select(a => a.companyCode).First(), fixedGLAccountNumber = listofAccountMappings.Where(a => a.iban == str[2]).Select(a => a.fixedGLAccountNumber).First(), documentCode = listofAccountMappings.Where(a => a.iban == str[2]).Select(a => a.documentCode).First(), statementNumber = str[3], entryDate = str[4], valueDate = str[5], transactionDescription = str[6], amount = str[7], additionaInfo = str[8], glAccountNumber = "NA", codaDescription = "" }; } ).ToList()); }
public static List <Transaction> GetTransactions(DataTable sourceDataTable, DataTable accountMapping) { List <AccountMapping> listofAccountMappings = ProcessAccountMapping.GetAccountMappings(accountMapping); return(sourceDataTable.AsEnumerable().Select(dr => { return GetTransaction(dr, listofAccountMappings); }).ToList()); }