/// <summary> /// Returns the metadata text from database /// </summary> /// <param name="elementNid"></param> /// <returns></returns> public override string GetMetadataTextFrmDB(int elementNid) { string RetVal = string.Empty; string ElementGID = string.Empty; IndicatorBuilder Indicators; DI7MetaDataBuilder MDBuilder = null; try { Indicators = new IndicatorBuilder(this.DBConnection, this.DBQueries); ElementGID = Indicators.GetIndicatorInfo(FilterFieldType.NId, elementNid.ToString(), FieldSelection.Light).GID; // get xml file from SDMX library RetVal = DevInfo.Lib.DI_LibSDMX.SDMXUtility.Get_MetadataReport(DI_LibSDMX.SDMXSchemaType.Two_One, ElementGID, DevInfo.Lib.DI_LibSDMX.MetadataTypes.Indicator, "MDAgency", this.DBQueries.LanguageCode.Replace("_", ""), this.DBConnection, this.DBQueries).InnerXml; MDBuilder = new DI7MetaDataBuilder(this.DBConnection, this.DBQueries); RetVal = MDBuilder.GetMetadataReportWCategoryName(RetVal, MetadataElementType.Indicator).InnerXml; } catch (Exception) { RetVal = string.Empty; } return(RetVal); }
public override void Import(string selectedGIds) { int ProgressCounter = 0; DataTable Table = null; string selectedNids = string.Empty; selectedNids = selectedGIds; // Initialize progress bar this.RaiseProgressBarInitialize(selectedGIds.Split(',').GetUpperBound(0) + 1); IndicatorBuilder TrgIndicatorBuilderObj = null; IndicatorBuilder SourceIndicatorBuilder = null; IndicatorInfo IndicatorInfoObj = null; Dictionary <string, DataRow> FileWithNids = new Dictionary <string, DataRow>(); DIConnection SourceDBConnection = null; DIQueries SourceDBQueries = null; //-- Step 1: Get TempTable with Sorted SourceFileName Table = this._TargetDBConnection.ExecuteDataTable(this.ImportQueries.GetImportIndicator(selectedNids)); //-- Step 2:Initialise Indicator Builder with Target DBConnection TrgIndicatorBuilderObj = new IndicatorBuilder(this.TargetDBConnection, this.TargetDBQueries); //-- 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 Source Indicator Info SourceIndicatorBuilder = new IndicatorBuilder(SourceDBConnection, SourceDBQueries); IndicatorInfoObj = SourceIndicatorBuilder.GetIndicatorInfo(FilterFieldType.NId, Convert.ToString(Row[MergetTemplateConstants.Columns.COLUMN_SRCNID]), FieldSelection.Light); // Import INdicator By Nid TrgIndicatorBuilderObj.ImportIndicator(IndicatorInfoObj, 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(); }