/// <summary> /// Imports records from source database to target database/template /// </summary> /// <param name="selectedNids"></param> /// <param name="allSelected">Set true to import all records</param> public override void ImportValues(List <string> SelectedNids, bool allSelected) { DI7MetaDataBuilder MetaData = new DI7MetaDataBuilder(this._TargetDBConnection, this._TargetDBQueries); MetaData.BeforeProcess += new ProcessInfoDelegate(MetaData_BeforeProcess); MetaData.ProcessInfo += new ProcessInfoDelegate(MetaData_ProcessInfo); if (this.InputFileType != DataSourceType.Database && this.InputFileType != DataSourceType.Template) { // Import data from xml file this.RaiseInitializeProgessBarEvent(1); if (System.IO.Path.GetExtension(this._SelectedFiles[0]).ToUpper() == DICommon.FileExtension.Excel.ToUpper()) { // import from excel MetaData.ImportMetataFromExcel(MetadataElementType.Area, MetaDataType.Map, this.SelectedNidInTrgDatabase, this._SelectedFiles[0].ToString(), this.XsltFolderPath); } else { ////MetaData.ImportMetadataFromXML(this.GetFileText(this._SelectedFiles[0]), MetaDataType.Map, this.SelectedNidInTrgDatabase, this.XsltFolderPath); MetaData.ImportMetadataFromXML(this.GetFileText(this._SelectedFiles[0]), MetadataElementType.Area, this.SelectedNidInTrgDatabase, this.XsltFolderPath); } this.RaiseIncrementProgessBarEvent(1); } else { int SelectedCount = SelectedNids.Count; if (allSelected) { SelectedCount = -1; } MetaData.ImportAreaMetadata(this._TargetDBQueries.DataPrefix, this.SourceDBConnection, this.SourceDBQueries, string.Join(",", SelectedNids.ToArray()), SelectedCount, MetaDataType.Map); } }
/// <summary> /// Imports records from source database to target database/template /// </summary> /// <param name="selectedNids"></param> /// <param name="allSelected">Set true to import all records</param> public override void ImportValues(List <string> SelectedNids, bool allSelected) { DI7MetaDataBuilder MetaData = new DI7MetaDataBuilder(this._TargetDBConnection, this._TargetDBQueries); MetaDataType MetaDataType = MetaDataType.Sector; switch (this._IndicatorClassificationType) { case ICType.Sector: MetaDataType = MetaDataType.Sector; break; case ICType.Goal: MetaDataType = MetaDataType.Goal; break; case ICType.CF: MetaDataType = MetaDataType.CF; break; case ICType.Theme: MetaDataType = MetaDataType.Theme; break; case ICType.Source: MetaDataType = MetaDataType.Source; break; case ICType.Institution: MetaDataType = MetaDataType.Institution; break; case ICType.Convention: MetaDataType = MetaDataType.Convention; break; default: break; } if (this.InputFileType != DataSourceType.Database && this.InputFileType != DataSourceType.Template) { this.RaiseInitializeProgessBarEvent(1); if (MetaDataType == MetaDataType.Source) { if (System.IO.Path.GetExtension(this._SelectedFiles[0]).ToUpper() == DICommon.FileExtension.Excel.ToUpper()) { // import from excel MetaData.ImportMetataFromExcel(MetadataElementType.Source, MetaDataType.Source, this.SelectedNidInTrgDatabase, this._SelectedFiles[0].ToString(), this.XsltFolderPath); } else { // Import data from xml file ////MetaData.ImportMetadataFromXML(this.GetFileText(this._SelectedFiles[0]), MetaDataType, this.SelectedNidInTrgDatabase, this.XsltFolderPath); MetaData.ImportMetadataFromXML(this.GetFileText(this._SelectedFiles[0]), MetadataElementType.Source, this.SelectedNidInTrgDatabase, this.XsltFolderPath); } } else { // Import data from rtf file MetaData.ImportMetadataFromRTFFile(this.GetFileText(this._SelectedFiles[0]), MetaDataType, this.SelectedNidInTrgDatabase); } this.RaiseIncrementProgessBarEvent(1); } else { //improt data from database/template MetaData.BeforeProcess += new ProcessInfoDelegate(MetaData_BeforeProcess); MetaData.ProcessInfo += new ProcessInfoDelegate(MetaData_ProcessInfo); if (MetaDataType == MetaDataType.Source) { MetaData.ImportSourceMetadata(this._TargetDBQueries.DataPrefix, this.SourceDBConnection, this.SourceDBQueries, string.Join(",", SelectedNids.ToArray()), SelectedNids.Count, MetaDataType); } else { MetaData.ImportICMetadata(this._TargetDBQueries.DataPrefix, this.SourceDBConnection, this.SourceDBQueries, string.Join(",", SelectedNids.ToArray()), SelectedNids.Count, MetaDataType, this._IndicatorClassificationType); } } }