예제 #1
0
        public Migrator(ILoggerFactory logger, IProjectRepository projectRepository, IConfiguration configuration, IConfigurationStore configStore,
                        ILiteDbAgent liteDbAgent, IFileRepository fileRepo, IImportFile importFile,
                        IEnvironmentHelper environmentHelper, ICalibrationFileAgent dcFileAgent)
        {
            Log         = logger.CreateLogger <Migrator>();
            ProjectRepo = projectRepository;
            FileRepo    = fileRepo;
            ImportFile  = importFile;
            _database   = liteDbAgent;
            DcFileAgent = dcFileAgent;

            _appSettings = configuration;

            _resumeMigration         = configStore.GetValueBool("RESUME_MIGRATION", true);
            _reProcessFailedProjects = configStore.GetValueBool("REPROCESS_FAILED_PROJECTS", true);
            _reProcessSkippedFiles   = configStore.GetValueBool("REPROCESS_SKIPPED_FILES", true);

            _fileSpaceId        = environmentHelper.GetVariable("TCCFILESPACEID", 48);
            _uploadFileApiUrl   = environmentHelper.GetVariable("IMPORTED_FILE_API_URL2", 1);
            _importedFileApiUrl = environmentHelper.GetVariable("IMPORTED_FILE_API_URL", 3);
            _capMigrationCount  = configStore.GetValueInt("CAP_MIGRATION_COUNT", defaultValue: int.MaxValue);
            _tempFolder         = Path.Combine(
                environmentHelper.GetVariable("TEMPORARY_FOLDER", 2),
                "DataOceanMigrationTmp",
                environmentHelper.GetVariable("MIGRATION_ENVIRONMENT", 2));

            // Diagnostic settings
            _downloadProjectFiles = configStore.GetValueBool("DOWNLOAD_PROJECT_FILES", defaultValue: false);
            _uploadProjectFiles   = configStore.GetValueBool("UPLOAD_PROJECT_FILES", defaultValue: false);
            _saveFailedProjects   = configStore.GetValueBool("SAVE_FAILED_PROJECT_IDS", defaultValue: true);
        }
예제 #2
0
        public async Task <IImportFile> AddNew(IImportFile entity)
        {
            TImportFile tEntity = entity as TImportFile;

            var errors = await this.ValidateEntityToCheckExists(tEntity);

            if (errors.Count() > 0)
            {
                await this.ThrowEntityException(errors);
            }

            try
            {
                this.StartTransaction();
                var savedEntity = await base.AddNew(entity as TImportFile);

                this.CommitTransaction();

                return(savedEntity);
            }
            catch (PostgresException ex)
            {
                throw new EntityUpdateException(ex);
            }
            catch
            {
                throw;
            }
        }
예제 #3
0
 public UploaderService(
     ILogger <UploaderService> logger,
     IOptions <AppConfiguration> options,
     IImportFile importFile)
 {
     _logger           = logger;
     _appConfiguration = options;
     _importFile       = importFile;
 }
예제 #4
0
        public async Task <IImportFile> Update(IImportFile entity)
        {
            TImportFile tEntity = entity as TImportFile;

            var errors = await this.ValidateEntityToCheckExistsAtUpdate(tEntity);

            if (errors.Count() > 0)
            {
                await this.ThrowEntityException(errors);
            }

            try
            {
                this.StartTransaction();
                await base.Update(tEntity, x => new
                {
                    x.BatchNumber,
                    x.BatchType,
                    x.ClientId,
                    x.Misc,
                    x.Status,
                    x.UploadDate,
                    x.Type,
                    x.UploadImage
                });

                this.CommitTransaction();
                return(tEntity);
            }
            catch (PostgresException ex)
            {
                throw new EntityUpdateException(ex);
            }
            catch
            {
                throw;
            }
        }
예제 #5
0
 public FileUploadController(IImportFile _importFile)
 {
     this._importFile = _importFile;
 }
예제 #6
0
 public WordsListViewModel(INavigationService navigationServcie, IDialogService dialogService, IUnitOfWork unitOfWork, IImportFile importFile) : base(navigationServcie, dialogService, unitOfWork, importFile)
 {
     AddWordCommand        = new Command(async() => { await NavigationService.NavigateToAsync <CreateWordViewModel>(_dictionary); SetUnVisibleFloatingMenu(); });
     RepeatingWordsCommand = new Command(async() => { await NavigationService.NavigateToAsync <RepeatingWordsViewModel>(_dictionary); });
     SetUnVisibleFloatingMenu();
 }
예제 #7
0
 //ctor
 protected BaseListViewModel(INavigationService navigationServcie, IDialogService dialogService, IUnitOfWork unitOfWork, IImportFile importFile) : base(navigationServcie, dialogService)
 {
     _unitOfWork        = unitOfWork;
     _importFile        = importFile ?? throw new ArgumentNullException(nameof(_importFile));
     MenuCommand        = new Command(async() => { await ChangeVisibleMenuButtons(); });
     ImportWordsCommand = new Command(async() => { await ImportFile(); SetUnVisibleFloatingMenu(); });
 }
예제 #8
0
 public MainViewModel(INavigationService navService, IDialogService dialogService, IUnitOfWork unitOfWork, IImportFile importFile) : base(navService, dialogService, unitOfWork, importFile)
 {
     DictionaryList         = new ObservableCollection <Dictionary>();
     ShowToolsCommand       = new Command(async() => { await NavigationService.NavigateToAsync <SettingsViewModel>(); });
     HelperCommand          = new Command(async() => { await NavigationService.NavigateToAsync <HelperViewModel>(); });
     LikeCommand            = new Command(LikeApplication);
     AddDictionaryCommand   = new Command(() => { AddDictionary(); SetUnVisibleFloatingMenu(); });
     AddWordsFromNetCommand = new Command(async() => { await NavigationService.NavigateToAsync <LanguageFrNetViewModel>(); SetUnVisibleFloatingMenu(); });
     SetUnVisibleFloatingMenu();
 }