Пример #1
0
        /// <summary>
        /// Returns the instance of DIData based on the importFile type
        /// </summary>
        /// <param name="importFileType"></param>
        /// <param name="sourceFileNamesWPath">List of source files with path</param>
        /// <param name="targetFileNamesWPath">Target file name with path</param>
        /// <param name="tempFolderPath">Temproray folder path</param>
        /// <param name="htmlLogOutputPath">Spreadsheet folder path</param>
        /// <returns></returns>
        public static DIData CreateInstance(DIImportFileType importFileType, List<string> sourceFileNamesWPath, string targetFileNamesWPath, string tempFolderPath, string htmlLogOutputPath)
        {
            DIData RetVal = null;
            switch (importFileType)
            {
                case DIImportFileType.DataEntrySpreasheet:
                    RetVal = new DataEntrySpreadsheets(sourceFileNamesWPath, targetFileNamesWPath, tempFolderPath, htmlLogOutputPath);
                    break;
                case DIImportFileType.Database:
                    RetVal = new Database.Database(sourceFileNamesWPath, targetFileNamesWPath, tempFolderPath, htmlLogOutputPath);
                    break;
                case DIImportFileType.Template:
                    break;
                case DIImportFileType.SDMXXml:
                    RetVal = new SDMX.SDMXXml(sourceFileNamesWPath, targetFileNamesWPath, tempFolderPath, htmlLogOutputPath);
                    break;
                case DIImportFileType.CSV:
                    RetVal = new CSV.CSVImporter(sourceFileNamesWPath, targetFileNamesWPath, tempFolderPath, htmlLogOutputPath);
                    break;
                default:
                    break;
            }

            if (RetVal != null)
            {
                RetVal.ImportFileType = importFileType;
            }
            return RetVal;
        }
Пример #2
0
        public static DIData CreateInstance(DIImportFileType importFileType, string sourceFileNamesWPath,
                  string tempFolderPath, DIConnection dbConnection, DIQueries dbQueries)
        {
            DIData RetVal = null;
            switch (importFileType)
            {
                case DIImportFileType.DataEntrySpreasheet:
                    RetVal = new DataEntrySpreadsheets(sourceFileNamesWPath, tempFolderPath, dbConnection, dbQueries);
                    break;
                case DIImportFileType.Database:
                    break;
                case DIImportFileType.Template:
                    break;
                case DIImportFileType.SDMXXml:
                    break;
                default:
                    break;
            }

            if (RetVal != null)
            {
                RetVal.ImportFileType = importFileType;
            }
            return RetVal;
        }
Пример #3
0
        public bool CreateTemplateFrmDES(string templateFileName, List<string> DESFilenames, string tempFolderPath)
        {
            bool RetVal;

            //create temp template file
            DIDatabase TempTemplateFile = new DIDatabase(templateFileName);

            //import data from DES
            this.Spreadsheets = new DataEntrySpreadsheets(DESFilenames, templateFileName, tempFolderPath, string.Empty);
            RetVal = this.Spreadsheets.StartImportProcess();

            if (RetVal)
            {
                //import only ius
                DataTable TempDataTable = this.Spreadsheets.DBConnection.ExecuteDataTable("Select * from " + DevInfo.Lib.DI_LibBAL.Import.DAImport.Common.Constants.TempDataTableName);
                foreach (DataRow Row in TempDataTable.Rows)
                {
                    TempTemplateFile.DIIUS.CheckNCreateIUS(this.GetIUSInfo(Row));
                }

                //delete temp tables
                this.Spreadsheets.DBConnection.ExecuteNonQuery("DROP Table " + DAImportCommon.Constants.TempDataTableName);
                this.Spreadsheets.DBConnection.ExecuteNonQuery("DROP Table " + DAImportCommon.Constants.TempUnmatchedIUSTable);
                this.Spreadsheets.DBConnection.ExecuteNonQuery("DROP Table " + DAImportCommon.Constants.TempBlankIUSTable);

                //dispose objects
                this.Spreadsheets.Dispose();
                TempTemplateFile.Dispose();

                RetVal = true;
            }

            return RetVal;
        }