Ejemplo n.º 1
0
        private void CreateContent(TradeInformation info)
        {
            var contentLine = ConsoleTableCreator.CreateContentLine(info.Name.TruncateLength(35),
                                                                    info.TypeOfAction,
                                                                    info.Quantity.ToString(),
                                                                    info.Rate.ToString());

            ConsoleTableCreator.PrintLine(contentLine);
        }
Ejemplo n.º 2
0
 private static TradeActionEvent CreateTradeAction(TradeInformation line)
 {
     return(new TradeActionEvent
     {
         RecordNumber = line.RecordNumber,
         DateOfAction = line.DateOfAction,
         Quantity = line.Quantity,
         Rate = Convert.ToSingle(line.Rate * line.ExchangeCurrency),
         TotalTransactionAmount = Convert.ToSingle(line.TotalTransactionCost)
     });
 }
Ejemplo n.º 3
0
        private IEnumerable <TradeInformation> ReadExcelFileContent(string fileName)
        {
            var collection = new List <TradeInformation>();

            using (var stream = File.Open(fileName, FileMode.Open, FileAccess.Read))
            {
                using (var reader = ExcelReaderFactory.CreateReader(stream))
                {
                    reader.Read();
                    do
                    {
                        while (reader.Read())
                        {
                            var info = new TradeInformation(recordNumber: reader.GetString(0),
                                                            typeOfAction: reader.GetString(1),
                                                            name: reader.GetString(2),
                                                            isinCode: reader.GetString(3),
                                                            tradeIdentifier: reader.GetString(4),
                                                            stockExchange: reader.GetString(5),
                                                            dateOfAction: reader.GetString(6),
                                                            paymentDate: reader.GetString(7),
                                                            quantity: reader.GetValue(8),
                                                            rate: reader.GetDouble(9),
                                                            currency: reader.GetString(10),
                                                            exchangeCurrency: reader.GetDouble(11),
                                                            marketValue: reader.GetValue(12),
                                                            commision: reader.GetValue(13),
                                                            totalTransactionCost: reader.GetValue(14));

                            collection.Add(info);
                        }
                    } while (reader.NextResult());
                }
            }

            return(collection);
        }