Example #1
0
        public GetWatchListOutput Execute(GetWatchListInput input)
        {
            // Assign and Validate Input
            _input = input;
            _input.ValidateInput();

            // Initialize Output
            _output = new GetWatchListOutput();

            string filename = "WatchList";
            string fullFilePath = string.Format(@"..\..\Data\WatchList\{0}.csv", filename);

            var readExcelSheetInput = new ReadExcelSheetInput();
            readExcelSheetInput.ConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source={0};Mode=ReadWrite;Extended Properties=""text;HDR=Yes;FMT=Delimited"";";
            readExcelSheetInput.SelectCommand = @"SELECT * FROM [{0}.csv]";

            readExcelSheetInput.ConnectionString = string.Format(readExcelSheetInput.ConnectionString, fullFilePath.Substring(0, fullFilePath.LastIndexOf('\\')));
            readExcelSheetInput.SelectCommand = string.Format(readExcelSheetInput.SelectCommand, filename);

            var readExcelSheetOutput = new ReadExcelSheet().Execute(readExcelSheetInput);

            // Convert the Stock Price Data Table to a List
            var watchList = _FormatDataTableAsList(readExcelSheetOutput.ExcelSheetTable);

            _output.WatchList = watchList;
            return _output;
        }
Example #2
0
        public GetWatchListOutput Execute(GetWatchListInput input)
        {
            // Assign and Validate Input
            _input = input;
            _input.ValidateInput();

            // Initialize Output
            _output = new GetWatchListOutput();

            string filename     = "WatchList";
            string fullFilePath = string.Format(@"..\..\Data\WatchList\{0}.csv", filename);

            var readExcelSheetInput = new ReadExcelSheetInput();

            readExcelSheetInput.ConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source={0};Mode=ReadWrite;Extended Properties=""text;HDR=Yes;FMT=Delimited"";";
            readExcelSheetInput.SelectCommand    = @"SELECT * FROM [{0}.csv]";

            readExcelSheetInput.ConnectionString = string.Format(readExcelSheetInput.ConnectionString, fullFilePath.Substring(0, fullFilePath.LastIndexOf('\\')));
            readExcelSheetInput.SelectCommand    = string.Format(readExcelSheetInput.SelectCommand, filename);

            var readExcelSheetOutput = new ReadExcelSheet().Execute(readExcelSheetInput);

            // Convert the Stock Price Data Table to a List
            var watchList = _FormatDataTableAsList(readExcelSheetOutput.ExcelSheetTable);

            _output.WatchList = watchList;
            return(_output);
        }