public CManagedComponentWrapper AddTargetTask(MainPipe dataFlow, string Name, string TargetName, TargetType Targettype, ConnectionManager conMgrDestination, out IDTSComponentMetaData100 targetTask, string tableStorageConnectionString) { string tName = Name + " Destination"; string classID = ""; switch (Targettype) { case TargetType.Excel: classID = SSISMoniker.EXCEL_DESTINATION; break; case TargetType.FlatFile: classID = SSISMoniker.FLAT_FILE_DESTINATION; break; case TargetType.Table: classID = SSISMoniker.OLEDB_DESTINATION; break; case TargetType.TableStorage: classID = SSISMoniker.OLEDB_TABLESTORAGE_DESTINATION; break; case TargetType.SPList: classID = SSISMoniker.OLEDB_SP_DESTINATION; break; } targetTask = dataFlow.AddPipeLine(classID, tName); CManagedComponentWrapper InstanceDestination = targetTask.InitializeTask(); if (Targettype == TargetType.TableStorage) { InstanceDestination.SetTableStorageDestination(TargetName, tableStorageConnectionString); } if (Targettype == TargetType.SPList) { InstanceDestination.SetSharePointListDestination(TargetName, tableStorageConnectionString); } else { targetTask.SetConnection(conMgrDestination); } if (Targettype == TargetType.Table) { InstanceDestination.SetTableDestination(TargetName); InstanceDestination.ConnectAndReinitializeMetaData(TargetName); } else if (Targettype == TargetType.FlatFile) { } return(InstanceDestination); }
public MainPipe AddSourceTask(MainPipe dataFlow, string Name, string SourceName, SourceType Sourcetype, ConnectionManager conMgrSource, out IDTSComponentMetaData100 sourceTask, bool SQLStatementASVariable = false, string ConnectionString = "") { CManagedComponentWrapper InstanceSource; switch (Sourcetype) { case SourceType.SELECTSQL: sourceTask = dataFlow.AddPipeLine(SSISMoniker.OLEDB_SOURCE, Name + " Source"); break; case SourceType.Table: sourceTask = dataFlow.AddPipeLine(SSISMoniker.OLEDB_SOURCE, Name + " Source"); break; case SourceType.FlatFile: sourceTask = dataFlow.AddPipeLine(SSISMoniker.FLAT_FILE_SOURCE, Name + " Source"); break; case SourceType.Excel: sourceTask = dataFlow.AddPipeLine(SSISMoniker.EXCEL_SOURCE, Name + " Source"); break; case SourceType.TableStorage: sourceTask = dataFlow.AddPipeLine(SSISMoniker.OLEDB_TABLESTORAGE_SOURCE, Name + " Source"); break; case SourceType.SPList: sourceTask = dataFlow.AddPipeLine(SSISMoniker.OLEDB_SPList_SOURCE, Name + " Source"); break; default: throw new Exception("Feature not implemented yet"); } InstanceSource = sourceTask.InitializeTask(); if (Sourcetype != SourceType.TableStorage && Sourcetype != SourceType.SPList) { sourceTask.SetConnection(conMgrSource); } switch (Sourcetype) { case SourceType.SELECTSQL: InstanceSource.SetSQLSource(SourceName, SQLStatementASVariable); break; case SourceType.Table: InstanceSource.SetTableSource(SourceName); break; case SourceType.Excel: InstanceSource.SetTableSource(SourceName); break; case SourceType.FlatFile: break; case SourceType.TableStorage: InstanceSource.SetTableStorageSource(SourceName, ConnectionString); break; case SourceType.SPList: InstanceSource.SetSharePointListSource(SourceName, ConnectionString); break; default: throw new Exception("Feature not implemented yet"); } InstanceSource.ConnectAndReinitializeMetaData(Name); return(dataFlow); }