public override void Import(string selectedNids) { DataTable Table = null; int ProgressCounter = 0; DI6SubgroupTypeBuilder SGBuilderObj = null; DI6SubgroupTypeInfo SGInfoObj = null; Dictionary <string, DataRow> FileWithNids = new Dictionary <string, DataRow>(); DIConnection SourceDBConnection = null; DIQueries SourceDBQueries = null; DI6SubgroupTypeBuilder SourceSGTypeBuilder = null; //-- Step 1: Get TempTable with Sorted SourceFileName Table = this._TargetDBConnection.ExecuteDataTable(this.ImportQueries.GetImportSubgroupDimensions(selectedNids)); //-- Step 2:Initialise Indicator Builder with Target DBConnection SGBuilderObj = new DI6SubgroupTypeBuilder(this.TargetDBConnection, this.TargetDBQueries); // Initialize progress bar this.RaiseProgressBarInitialize(selectedNids.Split(',').GetUpperBound(0) + 1); //-- Step 3: Import Nids for each SourceFile foreach (DataRow Row in Table.Copy().Rows) { try { string SourceFileWPath = Convert.ToString(Row[MergetTemplateConstants.Columns.COLUMN_SOURCEFILENAME]); SourceDBConnection = new DIConnection(DIServerType.MsAccess, String.Empty, String.Empty, SourceFileWPath, String.Empty, MergetTemplateConstants.DBPassword); SourceDBQueries = DataExchange.GetDBQueries(SourceDBConnection); // get subgroup type info from source SourceSGTypeBuilder = new DI6SubgroupTypeBuilder(SourceDBConnection, SourceDBQueries); SGInfoObj = SourceSGTypeBuilder.GetSubgroupTypeInfoByNid(Convert.ToInt32(Row[MergetTemplateConstants.Columns.COLUMN_SRCNID])); // import subgroup type only if doesnt exist SGBuilderObj.ImportSubgroupType(SGInfoObj, Convert.ToInt32(Row[MergetTemplateConstants.Columns.COLUMN_SRCNID]), SourceDBQueries, SourceDBConnection); ProgressCounter += 1; this.RaiseProgressBarIncrement(ProgressCounter); } catch (Exception ex) { ExceptionFacade.ThrowException(ex); } finally { if (SourceDBConnection != null) { SourceDBConnection.Dispose(); } if (SourceDBQueries != null) { SourceDBQueries.Dispose(); } } } this._AvailableTable = this.GetAvailableTable(); this._UnmatchedTable = this.GetUnmatchedTable(); // Close ProgressBar this.RaiseProgressBarClose(); }
public override void Import(string selectedNids) { DataTable Table = null; int ProgressCounter = 0; AreaBuilder AreaBuilderObj = null; AreaInfo AreaInfoObj = null; Dictionary <string, DataRow> FileWithNids = new Dictionary <string, DataRow>(); DIConnection SourceDBConnection = null; DIQueries SourceDBQueries = null; // Initialize progress bar this.RaiseProgressBarInitialize(selectedNids.Split(',').GetUpperBound(0) + 1); //////-- Step 1: Get TempTable with Sorted SourceFileName ////Table = this._TargetDBConnection.ExecuteDataTable(this.ImportQueries.GetImportAreas(this._CurrentTemplateFileNameWPath,selectedNids)); //-- Step 2:Initialise Indicator Builder with Target DBConnection AreaBuilderObj = new AreaBuilder(this.TargetDBConnection, this.TargetDBQueries); ////-- Step 3: Import Nids for each SourceFile //foreach (DataRow Row in Table.Copy().Rows) //{ try { SourceDBConnection = new DIConnection(DIServerType.MsAccess, String.Empty, String.Empty, this._CurrentTemplateFileNameWPath, String.Empty, MergetTemplateConstants.DBPassword); SourceDBQueries = DataExchange.GetDBQueries(SourceDBConnection); // AreaInfoObj = this.GetIndicatorInfo(Row); //AreaBuilderObj.ImportArea(selectedNids, 1, SourceDBConnection, SourceDBQueries); //AreaBuilderObj.ImportAreaMaps(selectedNids, 1, SourceDBConnection, SourceDBQueries); AreaBuilderObj.ImportArea(selectedNids, DICommon.SplitString(selectedNids, ",").Length, SourceDBConnection, SourceDBQueries, true); ProgressCounter += 1; this.RaiseProgressBarIncrement(ProgressCounter); } catch (Exception ex) { ExceptionFacade.ThrowException(ex); } finally { if (SourceDBConnection != null) { SourceDBConnection.Dispose(); } if (SourceDBQueries != null) { SourceDBQueries.Dispose(); } } //} this._UnmatchedTable = this.GetUnmatchedTable(); this._AvailableTable = this.GetAvailableTable(); // Close ProgressBar this.RaiseProgressBarClose(); }
public override void Import(string selectedNids) { DataTable Table = null; int ProgressCounter = 0; UnitBuilder TrgUnitBuilderObj = null; UnitBuilder SourceUnitBuilderObj = null; UnitInfo SrcUnitInfoObj = null; DIConnection SourceDBConnection = null; DIQueries SourceDBQueries = null; //-- Step 1: Get TempTable with Sorted SourceFileName Table = this._TargetDBConnection.ExecuteDataTable(this.ImportQueries.GetImportUnits(selectedNids)); //-- Step 2:Initialise Indicator Builder with Target DBConnection TrgUnitBuilderObj = new UnitBuilder(this.TargetDBConnection, this.TargetDBQueries); // Initialize progress bar this.RaiseProgressBarInitialize(selectedNids.Split(',').GetUpperBound(0) + 1); //-- Step 3: Import Nids for each SourceFile foreach (DataRow Row in Table.Copy().Rows) { try { string SourceFileWPath = Convert.ToString(Row[MergetTemplateConstants.Columns.COLUMN_SOURCEFILENAME]); SourceDBConnection = new DIConnection(DIServerType.MsAccess, String.Empty, String.Empty, SourceFileWPath, String.Empty, MergetTemplateConstants.DBPassword); SourceDBQueries = DataExchange.GetDBQueries(SourceDBConnection); SourceUnitBuilderObj = new UnitBuilder(SourceDBConnection, SourceDBQueries); SrcUnitInfoObj = SourceUnitBuilderObj.GetUnitInfo(FilterFieldType.NId, Convert.ToString(Row[MergetTemplateConstants.Columns.COLUMN_SRCNID])); // Import Unit from Source TrgUnitBuilderObj.ImportUnit(SrcUnitInfoObj, Convert.ToInt32(Row[MergetTemplateConstants.Columns.COLUMN_SRCNID]), SourceDBQueries, SourceDBConnection); ProgressCounter += 1; this.RaiseProgressBarIncrement(ProgressCounter); } catch (Exception ex) { ExceptionFacade.ThrowException(ex); } finally { if (SourceDBConnection != null) { SourceDBConnection.Dispose(); } if (SourceDBQueries != null) { SourceDBQueries.Dispose(); } } } this._AvailableTable = this.GetAvailableTable(); this._UnmatchedTable = this.GetUnmatchedTable(); // Close ProgressBar this.RaiseProgressBarClose(); }
public override void Import(string selectedNIds) { IndicatorClassificationInfo SrcClassification; string SrcFileName = string.Empty; DataTable Table = null; int ProgressCounter = 0; //IndicatorClassificationBuilder ICBuilder = null; //Dictionary<string, DataRow> FileWithNids = new Dictionary<string, DataRow>(); DIConnection SourceDBConnection = null; DIQueries SourceDBQueries = null; // Initialize progress bar this.RaiseProgressBarInitialize(selectedNIds.Split(',').GetUpperBound(0) + 1); //-- Step 1: Get TempTable with Sorted SourceFileName Table = this._TargetDBConnection.ExecuteDataTable(this.ImportQueries.GetImportICs(selectedNIds)); ////-- Step 2:Initialise Indicator Builder with Target DBConnection //ICBuilder = new IndicatorClassificationBuilder(this.TargetDBConnection, this.TargetDBQueries); try { //-- Step 3: Import Nids for each SourceFile foreach (DataRow Row in Table.Copy().Rows) { try { if (SrcFileName != Convert.ToString(Row[MergetTemplateConstants.Columns.COLUMN_SOURCEFILENAME])) { SrcFileName = Convert.ToString(Row[MergetTemplateConstants.Columns.COLUMN_SOURCEFILENAME]); //-- Step 2:Initialise DBConnection if (SourceDBConnection != null) { SourceDBConnection.Dispose(); } SourceDBConnection = new DIConnection(DIServerType.MsAccess, String.Empty, String.Empty, SrcFileName, String.Empty, MergetTemplateConstants.DBPassword); SourceDBQueries = DataExchange.GetDBQueries(SourceDBConnection); } SrcClassification = new IndicatorClassificationInfo(); SrcClassification.Name = DICommon.RemoveQuotes(Row[IndicatorClassifications.ICName].ToString()); SrcClassification.GID = Row[IndicatorClassifications.ICGId].ToString(); SrcClassification.IsGlobal = Convert.ToBoolean(Row[IndicatorClassifications.ICGlobal]); SrcClassification.Nid = Convert.ToInt32(Row[IndicatorClassifications.ICNId]); if (!string.IsNullOrEmpty(Convert.ToString((Row[IndicatorClassifications.ICInfo])))) { SrcClassification.ClassificationInfo = DICommon.RemoveQuotes(Row[IndicatorClassifications.ICInfo].ToString()); } SrcClassification.Parent = new IndicatorClassificationInfo(); SrcClassification.Parent.Nid = Convert.ToInt32(Row[IndicatorClassifications.ICParent_NId]); SrcClassification.Type = this._CurrentICType; //import into target database this.CreateClassificationChainFromExtDB( SrcClassification.Nid, SrcClassification.Parent.Nid, SrcClassification.GID, SrcClassification.Name, SrcClassification.Type, SrcClassification.ClassificationInfo, SrcClassification.IsGlobal, SourceDBQueries, SourceDBConnection, this._TargetDBQueries, this._TargetDBConnection); ProgressCounter += 1; this.RaiseProgressBarIncrement(ProgressCounter); } catch (Exception ex) { ExceptionFacade.ThrowException(ex); } this._UnmatchedTable = this.GetUnmatchedTable(); this._AvailableTable = this.GetAvailableTable(); } } catch (Exception ex) { ExceptionFacade.ThrowException(ex); } finally { if (SourceDBConnection != null) { SourceDBConnection.Dispose(); } } // Close ProgressBar this.RaiseProgressBarClose(); }