private void ProcessDataHandler(DataPropertyBdo dataPropertyBdo) { var dataHandler = _dataHandlerDictionary[dataPropertyBdo.DataProcessTypeBdo.ProcessType]; var dataSet = dataHandler.ExtractDataTables(dataPropertyBdo); _sqlInjector.Inject(dataSet); }
public DataSet ExtractDataTables(DataPropertyBdo dataPropertyBdo) { _dataSet = new DataSet(); _dataPropertyBdo = dataPropertyBdo; _delimiter = char.Parse(_dataPropertyBdo.DataDelimiterBdo.Character); if (File.Exists(_dataPropertyBdo.DataPath)) { using (_streamFile = new StreamReader(_dataPropertyBdo.DataPath)) { _dataTable = new DataTable { Prefix = "dbo", TableName = dataPropertyBdo.OutputTableName }; if (_streamFile.Peek() != -1) { ConfigureColumns(); AddRowData(); FilterColumns(); //TODO: refactor into SQL injector } } _dataSet.Tables.Add(_dataTable); } return(_dataSet); }
public void Run() { var dataPropertyBdo = new DataPropertyBdo { DataDelimiterBdo = DataDelimiterConst.Comma, DataPath = @"C:\Source\vr-capital\vrc.data.console\input.csv", DataProcessTypeBdo = DataProcessTypeConst.Csv, DataExtensionBdo = DataExtensionConst.Csv, OutputTableName = "TestTable" }; try { ProcessDataHandler(dataPropertyBdo); } catch (Exception ex) { _log.WriteErrorToPublish("The following DataProperty could not be loaded: " + dataPropertyBdo.OutputTableName + " (DataPropertyId: " + dataPropertyBdo.DataPropertyId + ")"); _log.WriteErrorForDevTeam(ex.ToString()); _log.WriteErrorToPublish(""); } }