public DataImportTask(
			IDataImporter importer,
			IImportProfileService importProfileService)
        {
            _importer = importer;
            _importProfileService = importProfileService;
        }
Example #2
0
        public TargetInstance(IDataInstance dataInstance, IDataImporter importer)
        {
            _targetInstance = dataInstance;
            _importer = importer;

            _targetInstance.Initialize();
        }
Example #3
0
        void EpiImport()
        {
            try
            {
                pbData.Value = 0;
                var sourceCon = ConfigurationManager.ConnectionStrings["EPIDATA"].ConnectionString;
                var targetCon = ConfigurationManager.ConnectionStrings["ESRSITUPD"].ConnectionString;

                importStatus = true;
                importer = new EpiDataImporter();
                importer.BulkInsertData(sourceCon, targetCon, 
                    ProgressBarValueSetter, ProgressBarAdd, 
                    ConfigurationManager.AppSettings["EpiCommand"]);
                ActionHelper.WriteAction(ActionsLog.Import, "upload", ActionModule.EpiData);
              

            }
            catch (Exception ex)
            {
                var error = "Error: " + ex.Message;
                MessageBox.Show(error);
                LogHelper.Logger(error, logpath);
            }
           
        }
Example #4
0
        public Warehouse(IWorkSpeedBusinessContext context, IDataImporter dataImporter, IFactoryEmployeeAction factoryEmployeeAction)
        {
            _context              = context ?? throw new ArgumentNullException(nameof(context));
            _dataImporter         = dataImporter ?? throw new ArgumentNullException(nameof(dataImporter));
            FactoryEmployeeAction = factoryEmployeeAction ?? throw new ArgumentNullException(nameof(factoryEmployeeAction));

            _typeRepository = new TypeRepository();
            AddTypesToRepository(_typeRepository);

            _productivities = new ProductivityObservableCollection();
        }
Example #5
0
 protected override void Context()
 {
     _context = A.Fake <IExecutionContext>();
     _applicationController = A.Fake <IApplicationController>();
     _dataImporter          = A.Fake <IDataImporter>();
     _dimensionRepository   = A.Fake <IDimensionRepository>();
     _ontogenyRepository    = A.Fake <IOntogenyRepository>();
     _entityTask            = A.Fake <IEntityTask>();
     _formulaFactory        = A.Fake <IFormulaFactory>();
     sut = new IndividualOntogenyTask(_context, _applicationController, _dataImporter, _dimensionRepository, _ontogenyRepository, _entityTask, _formulaFactory);
 }
Example #6
0
 public OntogenyTask(IExecutionContext executionContext, IApplicationController applicationController, IDataImporter dataImporter,
                     IDimensionRepository dimensionRepository, IOntogenyRepository ontogenyRepository, IEntityTask entityTask, IFormulaFactory formulaFactory)
 {
     _executionContext      = executionContext;
     _applicationController = applicationController;
     _dataImporter          = dataImporter;
     _dimensionRepository   = dimensionRepository;
     _ontogenyRepository    = ontogenyRepository;
     _entityTask            = entityTask;
     _formulaFactory        = formulaFactory;
 }
Example #7
0
 public SeedSynchronizer(IWebHostEnvironment environment,
                         IShellFeaturesManager shellFeaturesManager,
                         IDataImporter importer,
                         ISeedHarvester harvester,
                         IClock clock,
                         ILogger <SeedSynchronizer> logger)
 {
     _environment          = environment;
     _shellFeaturesManager = shellFeaturesManager;
     _importer             = importer;
     _harvester            = harvester;
     _clock      = clock;
     this.Logger = logger;
 }
 protected override void Context()
 {
     _parameterAlternativeFactory = A.Fake <IParameterAlternativeFactory>();
     _executionContext            = A.Fake <IExecutionContext>();
     _formulaFactory          = A.Fake <IFormulaFactory>();
     _parameterTask           = A.Fake <IParameterTask>();
     _buildingBlockRepository = A.Fake <IBuildingBlockRepository>();
     _dimensionRepository     = A.Fake <IDimensionRepository>();
     _dataImporter            = A.Fake <IDataImporter>();
     _compoundFactory         = new CompoundFactoryForSpecs();
     sut = new CompoundAlternativeTask(_parameterAlternativeFactory,
                                       _executionContext, _compoundFactory, _formulaFactory, _parameterTask,
                                       _buildingBlockRepository, _dimensionRepository, _dataImporter);
 }
 public DataImporterController(IWebAppContext appContext
                               , IDataImporter dataImporter
                               , IDataExporter dataExporter
                               , IImportDataService importDataService
                               , IImportFileService importFileService
                               , IImportMapService importMapService)
     : base(appContext)
 {
     _dataImporter      = dataImporter;
     _dataExporter      = dataExporter;
     _importDataService = importDataService;
     _importFileService = importFileService;
     _importMapService  = importMapService;
 }
 public ImportObservedDataTask(IDataImporter dataImporter, IExecutionContext executionContext,
                               IDimensionRepository dimensionRepository, IBuildingBlockRepository buildingBlockRepository, ISpeciesRepository speciesRepository,
                               IDefaultIndividualRetriever defaultIndividualRetriever, IRepresentationInfoRepository representationInfoRepository,
                               IObservedDataTask observedDataTask, IParameterChangeUpdater parameterChangeUpdater)
 {
     _dataImporter                 = dataImporter;
     _executionContext             = executionContext;
     _dimensionRepository          = dimensionRepository;
     _buildingBlockRepository      = buildingBlockRepository;
     _speciesRepository            = speciesRepository;
     _defaultIndividualRetriever   = defaultIndividualRetriever;
     _representationInfoRepository = representationInfoRepository;
     _observedDataTask             = observedDataTask;
     _parameterChangeUpdater       = parameterChangeUpdater;
 }
        private List <StockItem> InitializeWithStock(params StockItem[] stock)
        {
            var items = new List <StockItem>();

            items.AddRange(stock);

            _importer = Substitute.For <IDataImporter>();
            _importer
            .ImportStock()
            .Returns(items);

            _stockRepository = new StockRepository(_importer);

            return(items);
        }
Example #12
0
        public ImportObjectsMapping(IDataImporter importer, string file)
        {
            if (importer == null)
            {
                throw new ArgumentNullException("importer");
            }
            if (file == null)
            {
                throw new ArgumentNullException("file");
            }

            this.importer = importer;
            this.file     = file;

            Initialize();
        }
 public ObservedDataTask(
     IDataImporter dataImporter,
     IDimensionFactory dimensionFactory,
     IMoBiContext context,
     IDialogCreator dialogCreator,
     IInteractionTask interactionTask,
     IDataRepositoryExportTask dataRepositoryTask,
     IContainerTask containerTask,
     IObjectTypeResolver objectTypeResolver) : base(dialogCreator, context, dataRepositoryTask, containerTask, objectTypeResolver)
 {
     _dataImporter      = dataImporter;
     _mobiDialogCreator = dialogCreator;
     _interactionTask   = interactionTask;
     _dimensionFactory  = dimensionFactory;
     _context           = context;
 }
Example #14
0
        private static ContentReference ImportEmbeddedPackage(IDataImporter importer, string embeddedResourceName)
        {
            // Load content package from embedded resources
            var resources = Assembly.GetExecutingAssembly().GetManifestResourceStream(embeddedResourceName);

            var options = new ImportOptions
            {
                AutoCloseStream     = true,
                KeepIdentity        = true,
                TransferType        = TypeOfTransfer.Importing,
                ValidateDestination = false
            };

            importer.Import(resources, ContentReference.RootPage, options);

            // Root of Imported pages will be our start page
            return(importer.Status.ImportedRoot);
        }
 public DefaultDataImporterInterceptor(IDataImporter defaultDataImporter
                                       , IContentCacheRemover contentCacheRemover
                                       , IPrincipalAccessor principalAccessor
                                       , IDataImportEvents dataImportEvents
                                       , IDataImportEventsRaiser dataImportEventsRaiser
                                       , IContentRepository contentRepository
                                       , IPermanentLinkMapper permanentLinkMapper
                                       , IContentTypeRepository contentTypeRepository
                                       , ContentTypeAvailabilityService contentTypeAvailabilityService
                                       , IAvailableSettingsRepository availableSettingsRepository
                                       , IContentImporter contentImporter
                                       , IContentTransferValidator contentTransferValidator
                                       , PropertyCategoryTransform propertyCategoryTransform
                                       , ContentRootRepository contentRootRepository
                                       , ISiteDefinitionRepository siteDefinitionRepository
                                       , ContentOptions contentOptions
                                       , ISiteDefinitionResolver siteDefinitionResolver)
     : base(contentCacheRemover, principalAccessor, dataImportEvents
            , dataImportEventsRaiser, contentRepository
            , permanentLinkMapper, contentTypeRepository
            , contentTypeAvailabilityService, availableSettingsRepository
            , contentImporter, contentTransferValidator
            , propertyCategoryTransform, contentRootRepository
            , siteDefinitionRepository, contentOptions, siteDefinitionResolver)
 {
     this.defaultDataImporter            = defaultDataImporter;
     this.contentCacheRemover            = contentCacheRemover;
     this.principalAccessor              = principalAccessor;
     this.dataImportEvents               = dataImportEvents;
     this.dataImportEventsRaiser         = dataImportEventsRaiser;
     this.contentRepository              = contentRepository;
     this.permanentLinkMapper            = permanentLinkMapper;
     this.contentTypeRepository          = contentTypeRepository;
     this.contentTypeAvailabilityService = contentTypeAvailabilityService;
     this.availableSettingsRepository    = availableSettingsRepository;
     this.contentImporter           = contentImporter;
     this.contentTransferValidator  = contentTransferValidator;
     this.propertyCategoryTransform = propertyCategoryTransform;
     this.contentRootRepository     = contentRootRepository;
     this.siteDefinitionRepository  = siteDefinitionRepository;
     this.contentOptions            = contentOptions;
     this.siteDefinitionResolver    = siteDefinitionResolver;
 }
Example #16
0
 public CompoundAlternativeTask(
     IParameterAlternativeFactory parameterAlternativeFactory,
     IExecutionContext executionContext,
     ICompoundFactory compoundFactory,
     IFormulaFactory formulaFactory,
     IParameterTask parameterTask,
     IBuildingBlockRepository buildingBlockRepository,
     IDimensionRepository dimensionRepository,
     IDataImporter dataImporter)
 {
     _parameterAlternativeFactory = parameterAlternativeFactory;
     _executionContext            = executionContext;
     _compoundFactory             = compoundFactory;
     _formulaFactory          = formulaFactory;
     _parameterTask           = parameterTask;
     _buildingBlockRepository = buildingBlockRepository;
     _dimensionRepository     = dimensionRepository;
     _dataImporter            = dataImporter;
 }
Example #17
0
        protected override void Context()
        {
            _dataImporter     = A.Fake <IDataImporter>();
            _dimensionFactory = A.Fake <IDimensionFactory>();
            _context          = A.Fake <IMoBiContext>();
            _dialogCreator    = A.Fake <IDialogCreator>();
            _dataRepository   = new DataRepository {
                new BaseGrid("", DimensionFactoryForSpecs.Factory.Dimension("Time"))
            };
            _interactionTask    = A.Fake <IInteractionTask>();
            _dataRepositoryTask = A.Fake <IDataRepositoryTask>();
            _containerTask      = A.Fake <IContainerTask>();
            _objectTypeResolver = A.Fake <IObjectTypeResolver>();
            sut = new ObservedDataTask(_dataImporter, _dimensionFactory, _context, _dialogCreator, _interactionTask, _dataRepositoryTask, _containerTask, _objectTypeResolver);

            _project = new MoBiProject();
            A.CallTo(() => _context.Project).Returns(_project);
            A.CallTo(() => _context.CurrentProject).Returns(_project);
        }
Example #18
0
        private void AddXMLExtractConfigurationsToImporter(IDataImporter dataImporter)
        {
            var parserFactory = new DefaultXMLParserFactory();
            var labNameFieldExtractConfiguration = new SimpleXMLExtractConfiguration("", "Lab_Name", parserFactory.GetElementParser(typeof(string)), new SimpleValueAssigner(), typeof(string), "LabName");

            var dateReportedFieldExtractConfiguration = new SimpleXMLExtractConfiguration("", "Date_Reported", parserFactory.GetElementParser(typeof(DateTime)), new SimpleValueAssigner(), typeof(DateTime), "DateReported");

            var projectIDFieldExtractConfiguration = new SimpleXMLExtractConfiguration("", "Project_ID", parserFactory.GetElementParser(typeof(int)), new SimpleValueAssigner(), typeof(int), "ProjectId");

            var sdgIDFieldExtractConfiguration = new SimpleXMLExtractConfiguration("", "SDG_ID", parserFactory.GetElementParser(typeof(int)), new SimpleValueAssigner(), typeof(int), "SDGID");

            var labSignatoryFieldExtractConfiguration = new SimpleXMLExtractConfiguration("", "Lab_Signatory", parserFactory.GetElementParser(typeof(string)), new SimpleValueAssigner(), typeof(string), "LabSignatory");

            dataImporter.AddExtractConfiguration(labNameFieldExtractConfiguration);
            dataImporter.AddExtractConfiguration(dateReportedFieldExtractConfiguration);
            dataImporter.AddExtractConfiguration(projectIDFieldExtractConfiguration);
            dataImporter.AddExtractConfiguration(sdgIDFieldExtractConfiguration);
            dataImporter.AddExtractConfiguration(labSignatoryFieldExtractConfiguration);
        }
        public ImportProgressForm(IDataImporter importer, string dataName = null)
        {
            InitializeComponent();

            if (!string.IsNullOrEmpty(dataName))
            {
                Text = string.Format(@"Importing {0}...", dataName);
            }

            _importer = importer;
            _importer.ProgressChanged += ImporterProgressChanged;
            _importer.ImportCompleted += ImporterCompleted;

            lblStatus.Visible       = true;
            lblIgnoredCount.Visible = false;
            lblIgnored.Visible      = false;

            btnContiue.Visible = false;
            lnkCancel.Visible  = true;
        }
Example #20
0
 public ImportObservedDataTask(IDataImporter dataImporter, IExecutionContext executionContext,
                               IDimensionRepository dimensionRepository, IBuildingBlockRepository buildingBlockRepository, ISpeciesRepository speciesRepository,
                               IDefaultIndividualRetriever defaultIndividualRetriever, IRepresentationInfoRepository representationInfoRepository,
                               IObservedDataTask observedDataTask, IParameterChangeUpdater parameterChangeUpdater, IDialogCreator dialogCreator, IContainer container,
                               IOSPSuiteXmlSerializerRepository modelingXmlSerializerRepository, IEventPublisher eventPublisher)
 {
     _dataImporter                 = dataImporter;
     _executionContext             = executionContext;
     _dimensionRepository          = dimensionRepository;
     _buildingBlockRepository      = buildingBlockRepository;
     _speciesRepository            = speciesRepository;
     _defaultIndividualRetriever   = defaultIndividualRetriever;
     _representationInfoRepository = representationInfoRepository;
     _observedDataTask             = observedDataTask;
     _parameterChangeUpdater       = parameterChangeUpdater;
     _dialogCreator                = dialogCreator;
     _container = container;
     _modelingXmlSerializerRepository = modelingXmlSerializerRepository;
     _eventPublisher = eventPublisher;
 }
        private static void InitDataExchangers()
        {
            dataExporters = new List <IDataExchanger> ();
            dataImporters = new List <IDataExchanger> ();

            foreach (TypeExtensionNode node in AddinManager.GetExtensionNodes("/Warehouse/Business/Exchange"))
            {
                object        instance = node.CreateInstance();
                IDataExporter exporter = instance as IDataExporter;
                if (exporter != null)
                {
                    dataExporters.Add(exporter);
                }

                IDataImporter importer = instance as IDataImporter;
                if (importer != null)
                {
                    dataImporters.Add(importer);
                }
            }
        }
 public XlsImportVariableDataService(IXlsUploadRepository xlsUploadRepository,
                                     NxsDbContext context,
                                     IXlsFormulaUpdaterService xlsFormulaUpdaterService,
                                     GeneralRegionDataImporter generalRegionDataImporter,
                                     WorldRegionDataImporter worldRegionDataImporter,
                                     GdpDataImporter gdpDataImporter,
                                     IUnitOfWork unitOfWork,
                                     ILoggerFactory loggerFactory)
 {
     _xlsUploadRepository       = xlsUploadRepository;
     _context                   = context;
     _xlsFormulaUpdaterService  = xlsFormulaUpdaterService;
     _generalRegionDataImporter = generalRegionDataImporter;
     _worldRegionDataImporter   = worldRegionDataImporter;
     _gdpDataImporter           = gdpDataImporter;
     _generalRegionDataImporter.XlsImportVariableDataService = this;
     _worldRegionDataImporter.XlsImportVariableDataService   = this;
     _gdpDataImporter.XlsImportVariableDataService           = this;
     _unitOfWork = unitOfWork;
     _logger     = loggerFactory.CreateLogger("NXS.Services.Excel.DataImport.XlsImportVariableDataService");
 }
Example #23
0
 public DataImporterTask(
     IDataImporter dataImporter,
     ICsvDynamicSeparatorSelector csvSeparatorSelector,
     IDimensionFactory dimensionFactory,
     IPKMLPersistor pkmlPersistor
     )
 {
     _dataImporter         = dataImporter;
     _dimensionFactory     = dimensionFactory;
     _pkmlPersistor        = pkmlPersistor;
     _metaDataCategories   = _dataImporter.DefaultMetaDataCategoriesForObservedData();
     _dataImporterSettings = new DataImporterSettings
     {
         NameOfMetaDataHoldingMoleculeInformation        = Constants.ObservedData.MOLECULE,
         NameOfMetaDataHoldingMolecularWeightInformation = Constants.ObservedData.MOLECULAR_WEIGHT,
         IgnoreSheetNamesAtImport = true
     };
     _columnInfos          = _dataImporter.ColumnInfosForObservedData();
     _columnInfoCache      = new ColumnInfoCache(_columnInfos);
     _csvSeparatorSelector = csvSeparatorSelector;
 }
Example #24
0
        public static bool ImportEpiserverContent(Stream stream,
                                                  ContentReference destinationRoot,
                                                  IDataImporter importer,
                                                  SiteDefinition siteDefinition = null)
        {
            var success = false;

            try
            {
                var log = importer.Import(stream, destinationRoot, new ImportOptions
                {
                    KeepIdentity = true,
                    EnsureContentNameUniqueness = false
                });

                var status = importer.Status;

                if (status == null)
                {
                    return(false);
                }

                UpdateLanguageBranches(status);
                if (siteDefinition != null && !ContentReference.IsNullOrEmpty(status.ImportedRoot))
                {
                    siteDefinition.StartPage = status.ImportedRoot;
                    _siteDefinitionRepository.Value.Save(siteDefinition);
                    SiteDefinition.Current = siteDefinition;
                    success = true;
                }
            }
            catch (Exception exception)
            {
                LogManager.GetLogger().Error(exception.Message, exception);
                success = false;
            }

            return(success);
        }
Example #25
0
        public async Task ImportFromFile(string tableName, StreamReader stream, IDataImporter importer)
        {
            await foreach (var table in importer.GetDatabaseTables(tableName, stream))
            {
                var data = await importer.GetData(stream, table);

                try
                {
                    await CreateAsync(table);

                    //TODO: write sql query for insert list dictionary
                    foreach (var d in data)
                    {
                        await InsertIntoTableByTableNameAsync(table.TableName, d);
                    }
                }
                catch (Exception e)
                {
                    Console.WriteLine(table.DisplayName);
                    Console.WriteLine(e.Message);
                }
            }
        }
Example #26
0
 public DataImportController(IWebAppContext appContext
     , IEntityFinder entityFinder
     , IAttributeFinder attributeFinder
     , IDataImporter dataImporter
     , IImportMapService importMapService
     , IImportFileService importFileService
     , IFileTemplateProvider fileTemplateProvider
     , IWebHelper webHelper
     , ISessionService sessionService
     , ISettingFinder settingFinder
     )
     : base(appContext)
 {
     _entityFinder = entityFinder;
     _attributeFinder = attributeFinder;
     _dataImporter = dataImporter;
     _importMapService = importMapService;
     _importFileService = importFileService;
     _fileTemplateProvider = fileTemplateProvider;
     _webHelper = webHelper;
     _sessionService = sessionService;
     _settingFinder = settingFinder;
 }
Example #27
0
 public ViewDataSynchronizer(IWebHostEnvironment environment,
                             IShellFeaturesManager shellFeaturesManager,
                             IDataImporter importer,
                             IViewHarvester harvester,
                             IClock clock,
                             IRepository <MenuItemEntity> menuEntityRepo,
                             IRepository <ViewEntity> viewRepo,
                             IRepository <ActionEntity> actionRepo,
                             IRepository <ViewFragmentEntity> viewFragmentRepo,
                             IXamlService xaml,
                             ILogger <ViewDataSynchronizer> logger)
 {
     _environment          = environment;
     _shellFeaturesManager = shellFeaturesManager;
     _importer             = importer;
     _harvester            = harvester;
     _clock            = clock;
     _menuEntityRepo   = menuEntityRepo;
     _viewRepo         = viewRepo;
     _actionRepo       = actionRepo;
     _viewFragmentRepo = viewFragmentRepo;
     _xaml             = xaml;
     this.Logger       = logger;
 }
        private static void AddXMLExtractConfigurationsToImporter(IDataImporter dataImporter)
        {
            var parserFactory = new DefaultXMLParserFactory();

            var extensionValidationRule = new XMLFileNameExtensionMatchValidationRule(".xml", false);
            dataImporter.AddValidationRule(extensionValidationRule);

            var labNameValidationRule = new ElementValueMatchCriteriaValidationRule(new XMLDataSourceLocation("LabReport", "Lab_Name"), parserFactory, typeof(string), new RegexCriteria("^Lab1$"));
            dataImporter.AddValidationRule(labNameValidationRule);

            var labNameFieldExtractConfiguration = new SimpleXMLExtractConfiguration("", "Lab_Name", parserFactory.GetElementParser(typeof(string)), new SimpleValueAssigner(), typeof(string), "LabName");

            var dateReportedFieldExtractConfiguration = new SimpleXMLExtractConfiguration("", "Date_Reported", parserFactory.GetElementParser(typeof(DateTime)), new SimpleValueAssigner(), typeof(DateTime), "DateReported");

            var projectIDFieldExtractConfiguration = new SimpleXMLExtractConfiguration("", "Project_ID", parserFactory.GetElementParser(typeof(int)), new SimpleValueAssigner(), typeof(int), "ProjectId");

            var sdgIDFieldExtractConfiguration = new SimpleXMLExtractConfiguration("", "SDG_ID", parserFactory.GetElementParser(typeof(int)), new SimpleValueAssigner(), typeof(int), "SDGID");

            var labSignatoryFieldExtractConfiguration = new SimpleXMLExtractConfiguration("", "Lab_Signatory", parserFactory.GetElementParser(typeof(string)), new SimpleValueAssigner(), typeof(string), "LabSignatory");

            dataImporter.AddExtractConfiguration(labNameFieldExtractConfiguration);
            dataImporter.AddExtractConfiguration(dateReportedFieldExtractConfiguration);
            dataImporter.AddExtractConfiguration(projectIDFieldExtractConfiguration);
            dataImporter.AddExtractConfiguration(sdgIDFieldExtractConfiguration);
            dataImporter.AddExtractConfiguration(labSignatoryFieldExtractConfiguration);
        }
 public SampleFileChildObjectExtractConfiguration(IDataImporter dataImporter, string propertyPath, IValueAssigner valueAssigner)
     : base(dataImporter, propertyPath, valueAssigner)
 {
 }
 public void AddDataImporter(IDataImporter dataLoader)
 {
     this.dataImporters.Add(dataLoader);
 }
Example #31
0
 public AdminController(IDataImporter dataImporter, ICallbackRepository callbackRepository)
 {
     this.dataImporter = dataImporter;
     this.callbackRepository = callbackRepository;
 }
Example #32
0
 public DataImportTask(IDataImporter importer)
 {
     _importer = importer;
 }
        private IEnumerable<ResultMessageViewModel> PersistESDATData(ESDATDataToImport esdatDataToImport, IDataImporter importer)
        {
            var extractedResults = importer.Extract<ESDATModel>(esdatDataToImport);

            if (!extractedResults.IsExtractedSuccess)
            {
                var failResults = from parsingResult in ImportResultHelper.FilterWarningAndErrorResult(extractedResults.AllParsingResults)
                                  select new ResultMessageViewModel
                                  (
                                      parsingResult.Level.ToString(),
                                      parsingResult.Message
                                  );

                return failResults;
            }
            else
            {
                var esdatModel = extractedResults.ExtractedEntities.First();

                var allResults = (from parsingResult in extractedResults.AllParsingResults
                                 select new ResultMessageViewModel(parsingResult.Level.ToString(), parsingResult.Message)).ToList();

                var duplicateChecker = new ODM2DuplicateChecker(_dbContext);

                var convertResult = new List<IResult>();
                var sampleCollectionFactory = new ESDATSampleCollectionMapperFactory(duplicateChecker, _wqDefaultValueProvider, wayToHandleNewData, convertResult);


                var chemistryFactory = new ESDATChemistryMapperFactory(duplicateChecker, _wqDefaultValueProvider, wayToHandleNewData, convertResult);

                var mapper = new SampleCollectionActionMapper(duplicateChecker, sampleCollectionFactory, _wqDefaultValueProvider, chemistryFactory, wayToHandleNewData, convertResult);

                var converter = new ESDATConverter(mapper);

                var convertResults = converter.Convert(esdatModel);

                var convertResultViewModels = from converResult in convertResults
                                              select new ResultMessageViewModel(converResult.Level.ToString(), converResult.Message);

                allResults.AddRange(convertResultViewModels.ToList());

                var convertParsingResult = convertResults.Where(x => x is IParsingResult).FirstOrDefault();

                if (convertParsingResult == null)
                {
                    var failResult = new ResultMessageViewModel(ResultMessageViewModel.RESULT_LEVEL_ERROR, "System is not able to find the converted value from the converted results.");
                    allResults.Add(failResult);
                }
                else
                {
                    var action = (Action)((IParsingResult)convertParsingResult).Value;
                    _dbContext.Add<Hatfield.EnviroData.Core.Action>(action);
                    _dbContext.SaveChanges();
                    allResults.Add(new ResultMessageViewModel
                    (
                        ResultMessageViewModel.RESULT_LEVEL_INFO,
                        "Import success"
                    ));
                }
                
                return allResults;
            }
        }
Example #34
0
 public FormulationTask(IExecutionContext executionContext, IBuildingBlockTask buildingBlockTask, IApplicationController applicationController, IDataImporter dataImporter,
                        IDimensionRepository dimensionRepository, IFormulaFactory formulaFactory)
     : base(executionContext, buildingBlockTask, applicationController, PKSimBuildingBlockType.Formulation)
 {
     DimensionRepository  = dimensionRepository;
     _dataImporter        = dataImporter;
     _dimensionRepository = dimensionRepository;
     _formulaFactory      = formulaFactory;
 }
 public CoverholderController(IDataImporter dataImporter)
 {
     _dataImporter = dataImporter;
 }
Example #36
0
        public DataTransferController(IConfigurationDbContext configurationDatabaseContext, IDataExporter dataExporter, IDataImporter dataImporter, IFacade facade, IFeatureManager featureManager, IServiceProvider serviceProvider) : base(facade)
        {
            this.ConfigurationDatabaseContext = configurationDatabaseContext ?? throw new ArgumentNullException(nameof(configurationDatabaseContext));
            this.DataExporter   = dataExporter ?? throw new ArgumentNullException(nameof(dataExporter));
            this.DataImporter   = dataImporter ?? throw new ArgumentNullException(nameof(dataImporter));
            this.FeatureManager = featureManager ?? throw new ArgumentNullException(nameof(featureManager));

            if (serviceProvider == null)
            {
                throw new ArgumentNullException(nameof(serviceProvider));
            }

            if (featureManager.IsEnabled(Feature.Saml))
            {
                this.SamlDatabaseContext = serviceProvider.GetRequiredService <ISamlConfigurationDbContext>();
            }

            if (featureManager.IsEnabled(Feature.WsFederation))
            {
                this.WsFederationDatabaseContext = serviceProvider.GetRequiredService <IWsFederationConfigurationDbContext>();
            }
        }
Example #37
0
 public ChildObjectExtractConfigurationBase(IDataImporter dataImporter, string propertyPath, IValueAssigner valueAssigner)
 {
     _dataImporter  = dataImporter;
     _propertyPath  = propertyPath;
     _valueAssigner = valueAssigner;
 }
        public static void AddXMLExtractConfigurationsToImporter(IDataImporter dataImporter)
        {
            var parserFactory = new DefaultXMLParserFactory();
            var labNameFieldExtractConfiguration = new SimpleXMLExtractConfiguration("", "Lab_Name", parserFactory.GetElementParser(typeof(string)), new SimpleValueAssigner(), typeof(string), "LabName");

            var dateReportedFieldExtractConfiguration = new SimpleXMLExtractConfiguration("", "Date_Reported", parserFactory.GetElementParser(typeof(DateTime)), new SimpleValueAssigner(), typeof(DateTime), "DateReported");

            var projectIDFieldExtractConfiguration = new SimpleXMLExtractConfiguration("", "Project_ID", parserFactory.GetElementParser(typeof(int)), new SimpleValueAssigner(), typeof(int), "ProjectId");

            var sdgIDFieldExtractConfiguration = new SimpleXMLExtractConfiguration("", "SDG_ID", parserFactory.GetElementParser(typeof(int)), new SimpleValueAssigner(), typeof(int), "SDGID");

            var labSignatoryFieldExtractConfiguration = new SimpleXMLExtractConfiguration("", "Lab_Signatory", parserFactory.GetElementParser(typeof(string)), new SimpleValueAssigner(), typeof(string), "LabSignatory");

            dataImporter.AddExtractConfiguration(labNameFieldExtractConfiguration);
            dataImporter.AddExtractConfiguration(dateReportedFieldExtractConfiguration);
            dataImporter.AddExtractConfiguration(projectIDFieldExtractConfiguration);
            dataImporter.AddExtractConfiguration(sdgIDFieldExtractConfiguration);
            dataImporter.AddExtractConfiguration(labSignatoryFieldExtractConfiguration);
        }
 public ChildObjectExtractConfigurationBase(IDataImporter dataImporter, string propertyPath, IValueAssigner valueAssigner)
 {
     _dataImporter = dataImporter;
     _propertyPath = propertyPath;
     _valueAssigner = valueAssigner;
 }
 public ChemistryFileChildObjectExtractConfiguration(IDataImporter dataImporter, string propertyPath, IValueAssigner valueAssigner)
     : base(dataImporter, propertyPath, valueAssigner)
 {
 }