Beispiel #1
0
        public static IEnumerable <WarrantsInterestSheetInputItem> Parse(Stream inputStream, int sheetIndex, List <MonthlyImportFundExceptionRule> exceptionRules)
        {
            var results        = new List <WarrantsInterestSheetInputItem>();
            var columnsToParse = new[] { "Fund", "Name", "Warrant Int" };
            var sheetData      = ImportUtils.ImportXlsxToDataTable(inputStream, sheetIndex, columnsToParse);

            sheetData.AsEnumerable().ForEachWithIndex((row, index) =>
            {
                var fundResult = StringUtils.ApplyMonthlyImportExceptionRuleOnFund(row["Fund"].ToString(), exceptionRules);
                results.Add(new WarrantsInterestSheetInputItem()
                {
                    RowIndex = index + 2, // 2 => one for table header and one for zero-indexed loop
                    FundId   = fundResult.Item2,
                    IsExceptionRuleMatched = fundResult.Item1,
                    Name            = row["Name"].ToString(),
                    WarrantInterest = StringUtils.ParseNegativeValue(row["Warrant Int"].ToString()),
                });
            });

            return(results);
        }