Exemplo n.º 1
0
		public ImportService(IImportRepository importRepository, IAssetService blobProvider, ICatalogRepository catalogRepository, IOrderRepository orderRepository, IAppConfigRepository appConfigRepository, IRepositoryFactory<IAppConfigRepository> appConfigRepositoryFactory)
		{
			_orderRepository = orderRepository;
			_catalogRepository = catalogRepository;
			_importJobRepository = importRepository;
			_appConfigRepository = appConfigRepository;
			_appConfigRepositoryFactory = appConfigRepositoryFactory;
			_assetProvider = blobProvider;

			_entityImporters = new List<IEntityImporter>
				{
					new ItemImporter() { Name = "Product"},
					new ItemImporter() { Name = "Sku"},
					new ItemImporter() { Name = "Bundle"},
					new ItemImporter() { Name = "DynamicKit"},
					new ItemImporter() { Name = "Package"},
					new PriceImporter(_catalogRepository),
					new AssociationImporter(_catalogRepository),
					new RelationImporter(_catalogRepository),
					new CategoryImporter(),
					new LocalizationImporter(),
					new TaxValueImporter(),
					new ItemAssetImporter(),
					new TaxCategoryImporter(),
					new JurisdictionImporter(),
					new JurisdictionGroupImporter(),
					new SeoImporter()
				};

			_importResults = new Dictionary<string, ImportResult>();
		}
Exemplo n.º 2
0
 public ImportService(
     IImportRepository importRepository,
     ILogWrapper logger)
 {
     ImportRepository = importRepository;
     Logger           = logger;
 }
        //---------------------------------------------------------------------------------------------------
        public void Execute(IImportRepository repository, Event e)
        {
            m_repository = repository;

            ProcessEvent(e);
            ProcessResults(e);
        }
Exemplo n.º 4
0
 public SourceFileService(IImportRepository importRepository, IFileService fileService,
                          IExtractFileService extractService)
 {
     _importRepository = importRepository;
     _fileService      = fileService;
     _extractService   = extractService;
 }
Exemplo n.º 5
0
        //---------------------------------------------------------------------------------------------------
        public override Event Import(IImportRepository repository)
        {
            var home_page = GetResultsPage();

            // Create and commit the event section
            Event ev = GetEventSection(home_page);
            repository.Event(ref ev);

            // If there are links in the data table this is a multi-page event
            if (home_page.DocumentNode.SelectSingleNode("//table[@class=\"data\"]//a[text()=\"Results\"]") != null) {
                // If there is a link with the text "Splits" the event probably has splits
                if (home_page.DocumentNode.SelectSingleNode("//table[@class=\"data\"]//a[text()=\"Splits\"]") != null) {
                    ParseMultiplePageWithSplits(repository, home_page, ev);
                    return ev;
                } else {
                    // This seems to only appear when there are multiple runs per class which I can't currently handle
                    throw new Exception("Import of this type of event is not currently supported");
                    //ParseMutiplePage(repository, home_page, ev);
                }
            }

            // If there is a course title then this is a single-page event
            if (home_page.DocumentNode.SelectSingleNode("//div[@class=\"course-title\"]") != null) {
                ParseSinglePage(repository, home_page, ev);
                return ev;
            }

            throw new Exception("Import of this type of event is not currently supported");
        }
Exemplo n.º 6
0
 public ImportsController(IImportRepository importRepository, ISupplierRepository supplierRepository, IDiscountRepository discountRepository, IProductServiceRepository productServiceRepository)
 {
     this.importRepository         = importRepository;
     this.supplierRepository       = supplierRepository;
     this.discountRepository       = discountRepository;
     this.productServiceRepository = productServiceRepository;
 }
Exemplo n.º 7
0
        public TranscriptionService(ITransactionService transactionService,
                                    IMapper mapper,
                                    IUsersRepository usersRepository,
                                    IImportRepository importsRepository,
                                    IWorkingPeriodsService workingPeriodsService,
                                    ITranscriptionRepository transcriptionRepository,
                                    ILabelingModuleConfiguration labelingModuleConfiguration,
                                    IAudioReopenSubscriptionService audioReopenSubscriptionService,
                                    IDeepSpeechControlProxy deepSpeechControlProxy,
                                    IAssignedLabelGroupsRepository assignedLabelGroupsRepository,
                                    ILabelingAudioService labelingAudioService,
                                    ILabelService labelService,
                                    ITranscriptionLabelsRepository transcriptionLabelsRepository,
                                    ITranscriptionMetricsRepository transcriptionMetricsRepository,
                                    ITranscriptionSelectedLabelRepository transcriptionSelectedLabelRepository)
        {
            this.mapper                               = mapper;
            this.transactionService                   = transactionService;
            this.usersRepository                      = usersRepository;
            this.workingPeriodsService                = workingPeriodsService;
            this.importsRepository                    = importsRepository;
            this.deepSpeechControlProxy               = deepSpeechControlProxy;
            this.labelingModuleConfiguration          = labelingModuleConfiguration;
            this.audioReopenSubscriptionService       = audioReopenSubscriptionService;
            this.transcriptionRepository              = transcriptionRepository;
            this.assignedLabelGroupsRepository        = assignedLabelGroupsRepository;
            this.labelingAudioService                 = labelingAudioService;
            this.labelService                         = labelService;
            this.transcriptionLabelsRepository        = transcriptionLabelsRepository;
            this.transcriptionMetricsRepository       = transcriptionMetricsRepository;
            this.transcriptionSelectedLabelRepository = transcriptionSelectedLabelRepository;

            randomizer = new Random();
        }
Exemplo n.º 8
0
 public DashboardService(
     IEngagementRepository engagementRepository,
     IHostRepository hostRepository,
     IHostMapper hostMapper,
     IVulnerabilityRepository vulnerabilityRepository,
     IVulnerabilityMapper vulnerabilityMapper,
     IRiskRepository riskRepository,
     ICustomerRepository customerRepository,
     IGovernanceControlRepository governanceControlRepository,
     IPhaseRepository phaseRepository,
     IComplianceRepository complianceRepository,
     IComplianceSchemeRepository complianceSchemeRepository,
     IImportRepository importRepository,
     ICryptographyService cryptographyService,
     IEngagementService engagementService)
 {
     _engagementRepository        = engagementRepository;
     _customerRepository          = customerRepository;
     _hostRepository              = hostRepository;
     _hostMapper                  = hostMapper;
     _vulnerabilityRepository     = vulnerabilityRepository;
     _vulnerabilityMapper         = vulnerabilityMapper;
     _riskRepository              = riskRepository;
     _governanceControlRepository = governanceControlRepository;
     _phaseRepository             = phaseRepository;
     _complianceRepository        = complianceRepository;
     _complianceSchemeRepository  = complianceSchemeRepository;
     _importRepository            = importRepository;
     _cryptographyService         = cryptographyService;
     _engagementService           = engagementService;
 }
Exemplo n.º 9
0
 public ImportProductController(ISupplierRepository iSupplierRepository, IImportRepository importRepository, IImportDetailRepository importDetailRepository, IProductRepository iProductRepository, IServiceProvider services)
 {
     _iSupplierRepository    = iSupplierRepository;
     _importRepository       = importRepository;
     _importDetailRepository = importDetailRepository;
     _iProductRepository     = iProductRepository;
     _services = services;
 }
        // Constructors

        public ProcessProductRequestedHandler(IProductRepository productRepository, IImportRepository importRepository,
                                              ILogger <ProcessProductRequestedHandler> logger, IConfiguration configuration)
        {
            _productRepository = productRepository;
            _importRepository  = importRepository;
            _logger            = logger;
            _configuration     = configuration;
        }
Exemplo n.º 11
0
 public LabelingStatisticsService(IUserService userService,
                                  IImportRepository importsRepository,
                                  ILabelingStatisticRepository labelingStatisticRepository)
 {
     this.userService                 = userService;
     this.importsRepository           = importsRepository;
     this.labelingStatisticRepository = labelingStatisticRepository;
 }
Exemplo n.º 12
0
        public DataImporter(IImportRepository importRepo, IHasher hasher, IEncryptor encryptor)
            : base(hasher, encryptor)
        {
            ConnectionStringSettings settings = ConfigurationManager.ConnectionStrings["PrismDatabase"];

            HibernateUtil.Initialize(settings.ConnectionString, true);
            this.importRepo = Program.Kernel.Get <IImportRepository>();
        }
Exemplo n.º 13
0
 public ImportProcessor(IImportRepository importRepository,
                        IImportTrackerRepository importTrackerRepository,
                        IImportHistoryRepository importHistoryRepository)
 {
     _importRepository        = importRepository;
     _importTrackerRepository = importTrackerRepository;
     _importHistoryRepository = importHistoryRepository;
 }
Exemplo n.º 14
0
 public CommonStatistic(IProductRepository iProductRepository, ICartRepository cartRepository, IShoppingCartRepository shoppingCartRepository, IImportRepository importRepository, IImportDetailRepository importDetailRepository)
 {
     _iProductRepository     = iProductRepository;
     _cartRepository         = cartRepository;
     _shoppingCartRepository = shoppingCartRepository;
     _importRepository       = importRepository;
     _importDetailRepository = importDetailRepository;
 }
Exemplo n.º 15
0
        public TransactionImportContext(GeneralLedger general, IEnumerable<AccountIdentifier> patterns, IImportRepository repository)
        {
            _general = general;
            _repository = repository;
            _patterns = patterns.ToArray();

            Array.ForEach(_patterns, p => p.Account = general[p.Account.Id]);
        }
Exemplo n.º 16
0
        public BlogMLService(IHttpHelper httpHelper, IStreamHelper streamHelper, 
                             IImportRepository importRepository, IBlogMLMappingService blogMLMappingService)
        {
            _httpHelper = httpHelper;
            _streamHelper = streamHelper;

            _importRepository = importRepository;
            _blogMLMappingService = blogMLMappingService;
        }
Exemplo n.º 17
0
 public StatisticController(ICartRepository iCartRepository, ICustomerRepository iCustomerRepository, IProductRepository iProductRepository, ICategoryRepository iCategoryRepository, IShoppingCartRepository shoppingCartRepository, IImportRepository importRepository, IImportDetailRepository importDetailRepository, ICartRepository cartRepository)
 {
     _iCartRepository        = iCartRepository;
     _iCustomerRepository    = iCustomerRepository;
     _iProductRepository     = iProductRepository;
     _iCategoryRepository    = iCategoryRepository;
     _shoppingCartRepository = shoppingCartRepository;
     _importRepository       = importRepository;
     _importDetailRepository = importDetailRepository;
     _cartRepository         = cartRepository;
 }
Exemplo n.º 18
0
 public LabelingAudioService(IFilesConfiguration filesConfiguration,
                             IWavFileDecodeService wavFileDecodeService,
                             IImportRepository importRepository,
                             IAssignedLabelGroupsRepository assignedLabelGroupsRepository,
                             ILabelingAudioRepository labelingAudioRepository)
 {
     this.importRepository              = importRepository;
     this.filesConfiguration            = filesConfiguration;
     this.wavFileDecodeService          = wavFileDecodeService;
     this.assignedLabelGroupsRepository = assignedLabelGroupsRepository;
     this.labelingAudioRepository       = labelingAudioRepository;
 }
Exemplo n.º 19
0
        public MockImportService(IImportRepository importJobRepository)
        {
            _importJobRepository = importJobRepository;
            _catalogRepository   = null;

            _entityImporters = new List <IEntityImporter>();
            _entityImporters.Add(new ItemImporter());
            _entityImporters.Add(new PriceImporter());
            _entityImporters.Add(new AssociationImporter());
            _entityImporters.Add(new CategoryImporter());

            _importResults = new Dictionary <string, ImportResult>();
        }
		public MockImportService(IImportRepository importJobRepository)
		{
			_importJobRepository = importJobRepository;
			_catalogRepository = null;

			_entityImporters = new List<IEntityImporter>();
			_entityImporters.Add(new ItemImporter());
			_entityImporters.Add(new PriceImporter());
			_entityImporters.Add(new AssociationImporter());
			_entityImporters.Add(new CategoryImporter());

			_importResults = new Dictionary<string, ImportResult>();
		}
Exemplo n.º 21
0
        public DataImporter(IImportRepository importRepo, IHasher hasher, IEncryptor encryptor)
            : base(hasher, encryptor)
        {
            this.IsDisposed = false;
            ConnectionStringSettings settings = ConfigurationManager.ConnectionStrings["PrismDatabase"];

            HibernateUtil.Initialize(settings.ConnectionString, true);
            this.importRepo = Program.Kernel.Get <IImportRepository>();

            progressMessage = Program.LanguageManager.GetString(StringResources.Import_Progress_Message_Counter) + " {0} / {1} " + ". " +
                              Program.LanguageManager.GetString(StringResources.Import_Progress_Message_Type) + " {2}";

            currentStation = (importRepo.ProjectRepo.GetSingle()).WorkstationType;
        }
        public ImportService(IImportRepository importRepository, IAssetService blobProvider, ICatalogRepository catalogRepository, IOrderRepository orderRepository, IAppConfigRepository appConfigRepository, IRepositoryFactory <IAppConfigRepository> appConfigRepositoryFactory)
        {
            _orderRepository            = orderRepository;
            _catalogRepository          = catalogRepository;
            _importJobRepository        = importRepository;
            _appConfigRepository        = appConfigRepository;
            _appConfigRepositoryFactory = appConfigRepositoryFactory;
            _assetProvider = blobProvider;

            _entityImporters = new List <IEntityImporter>
            {
                new ItemImporter()
                {
                    Name = "Product"
                },
                new ItemImporter()
                {
                    Name = "Sku"
                },
                new ItemImporter()
                {
                    Name = "Bundle"
                },
                new ItemImporter()
                {
                    Name = "DynamicKit"
                },
                new ItemImporter()
                {
                    Name = "Package"
                },
                new PriceImporter(_catalogRepository),
                new AssociationImporter(_catalogRepository),
                new RelationImporter(_catalogRepository),
                new CategoryImporter(),
                new LocalizationImporter(),
                new TaxValueImporter(),
                new ItemAssetImporter(),
                new TaxCategoryImporter(),
                new JurisdictionImporter(),
                new JurisdictionGroupImporter(),
                new SeoImporter()
            };

            _importResults = new Dictionary <string, ImportResult>();
        }
Exemplo n.º 23
0
 public ImportService(string connectingString, IChurchRepository churchRepo
                      , ITeamRepository teamRepo
                      , IMemberRepository memberRepo
                      , IMessageRepository messageRepo
                      , ICommonRepository commonRepo
                      , ILogger logger
                      , IImportRepository importRepo)
 {
     this.connectingString = connectingString;
     this.churchRepo       = churchRepo;
     this.teamRepo         = teamRepo;
     this.commonRepo       = commonRepo;
     this.memberRepo       = memberRepo;
     this.messageRepo      = messageRepo;
     this.logger           = logger;
     this.importRepo       = importRepo;
 }
        protected ImportJobViewModelBack(IUnityContainer container, ICatalogEntityFactory entityFactory, ImportJob item, WizardViewModelBare parentVM, bool isSingleDialogEditing)
        {
            Container             = container;
            _entityFactory        = entityFactory;
            InnerItem             = _originalItem = item;
            _parentViewModel      = parentVM;
            IsSingleDialogEditing = isSingleDialogEditing;
            _importService        = Container.Resolve <IImportService>();
            _itemRepository       = Container.Resolve <IImportRepository>();

            if (isSingleDialogEditing)
            {
                _originalItem = InnerItem;

                OpenItemCommand = new DelegateCommand(() =>
                {
                    var navigationmanager = container.Resolve <NavigationManager>();
                    NavigationData        = new NavigationItem(InnerItem.ImportJobId, NavigationNames.HomeName, NavigationNames.MenuName, this);
                    navigationmanager.Navigate(NavigationData);
                });

                CancelCommand      = new DelegateCommand <object>(OnCancelCommand);
                SaveChangesCommand = new DelegateCommand <object>((x) => OnSaveChangesCommand(), (x) => { return(IsModified); });
                MinimizeCommand    = new DelegateCommand(() => MinimizableViewRequestedEvent(this, null));
            }
            else
            {
                InitializePropertiesForViewing();
            }

            FilePickCommand       = new DelegateCommand(RaiseFilePickInteractionRequest);
            CreateMappingCommand  = new DelegateCommand(RaiseCreateMappingInteractionRequest);
            CancelConfirmRequest  = new InteractionRequest <Confirmation>();
            CommonConfirmRequest  = new InteractionRequest <Confirmation>();
            CommonConfirmRequest2 = new InteractionRequest <Confirmation>();

            UpdateImporterCommand    = new DelegateCommand <EntityImporterBase>((x) => OnImporterChangesCommand(x));
            UpdatePropertySetCommand = new DelegateCommand <PropertySet>((x) => OnPropertySetChangesCommand(x));

            CatalogChangedCommand = new DelegateCommand <CatalogBase>((x) => OnCatalogChangesCommand(x));

            ItemEditCommand  = new DelegateCommand <MappingItem>((x) => RaiseItemEditInteractionRequest(x), x => x != null);
            ItemClearCommand = new DelegateCommand <MappingItem>((x) => RaiseItemClearInteractionRequest(x), x => x != null);
        }
Exemplo n.º 25
0
 public ImportService(
     IImportRepository importRepository,
     IHostRepository hostRepository,
     IVulnerabilityRepository vulnerabilityRepository,
     IHostVulnerabilityRepository hostVulnerabilityRepository,
     IFactory csvFactory,
     IImportMapper importMapper,
     IImportVulnerabilityMapper importVulnerabilityMapper,
     IImportHostMapper importHostMapper,
     ICryptographyService cryptographyService)
 {
     _csvFactory   = csvFactory;
     _importMapper = importMapper;
     _importVulnerabilityMapper   = importVulnerabilityMapper;
     _importHostMapper            = importHostMapper;
     _cryptographyService         = cryptographyService;
     _importRepository            = importRepository;
     _hostRepository              = hostRepository;
     _vulnerabilityRepository     = vulnerabilityRepository;
     _hostVulnerabilityRepository = hostVulnerabilityRepository;
 }
Exemplo n.º 26
0
 public FtpJob(
     FtpLoader ftpLoader,
     InMemoryCache <TradeMasterAccountModel> tradeMasterAccountModel,
     IContract wcf,
     FileNameMatcher fileNameMatcher,
     IFtpJobRepository ftpJobRepository,
     IImportRepository importRepository) : base(wcf)
 {
     _job       = Job.Ftp;
     _ftpLoader = ftpLoader;
     _tradeMasterAccountModel = tradeMasterAccountModel;
     _ftpJobRepository        = ftpJobRepository;
     _importRepository        = importRepository;
     _fileNameMatcher         = fileNameMatcher;
     //using (_ftpJobRepository.BeginOperation())
     //{
     //    foreach (var ftpFile in ftpJobRepository.ImportedFilesQuery())
     //    {
     //        _existingFiles.Add(ftpFile.OriginalFileName);
     //    }
     //}
 }
Exemplo n.º 27
0
 public TranscriptionController(ITranscriptionService transcriptionService,
                                UserManager <CompanyIdentityUser> userManager,
                                IMapper mapper,
                                ILabelingAudioService labelingAudioService,
                                ILabelService labelService,
                                IImportRepository importsRepository,
                                ITranscriptionRepository transcriptionRepository,
                                ILabelingStatisticsService labelingStatisticsService,
                                ITranscriptionLabelsRepository labelsRepository,
                                ILabelGroupsRepository labelGroupsRepository)
 {
     this.mapper = mapper;
     this.labelGroupsRepository     = labelGroupsRepository;
     this.labelsRepository          = labelsRepository;
     this.importsRepository         = importsRepository;
     this.transcriptionRepository   = transcriptionRepository;
     this.labelingStatisticsService = labelingStatisticsService;
     this.labelingAudioService      = labelingAudioService;
     this.transcriptionService      = transcriptionService;
     this.labelService = labelService;
     this.userManager  = userManager;
 }
Exemplo n.º 28
0
 public async Task <ActionResult <IEnumerable <Import> > > GetAll(
     [FromServices] IImportRepository repository
     )
 {
     return(Ok(await repository.GetAll()));
 }
Exemplo n.º 29
0
 //---------------------------------------------------------------------------------------------------
 private void ParseSinglePageWithSplits(IImportRepository repository, HtmlDocument document, Event ev)
 {
 }
Exemplo n.º 30
0
 //---------------------------------------------------------------------------------------------------
 private void ParseSinglePage(IImportRepository repository, HtmlDocument document, Event ev)
 {
     ParseSinglePage(
         repository,
         document,
         ev,
         "//div[@class=\"course\"]",             // Courses
         "div[@class=\"course-title\"]/h2",      // Course name
         "p[@class=\"course-info\"][2]",         // Course details
         "table//tr[td]",                        // Results
         "td",                                   // Result position
         "td/td",                                // Result name
         "td/td/td",                             // Result club
         "td/td/td/td",                          // Result age
         "td/td/td/td/td"                        // Result time
     );
 }
Exemplo n.º 31
0
 public ImportHandler(IImportRepository importRepository)
 {
     _importRepository = importRepository;
 }
        public ImportJobViewModelNew(
            NavigationManager navManager,
            ICatalogEntityFactory entityFactory,
            ICatalogRepository catalogRepository,
            IImportRepository importRepository,
            ImportJob item,
            WizardViewModelBare parentVM,
            IColumnMappingEditViewModel mappingEditVM,
            IColumnMappingViewModel columnMappingVM,
            IImportService importService,
            IPickAssetViewModel pickAssetVM,
            bool isSingleDialogEditing)
        {
            _entityFactory        = entityFactory;
            InnerItem             = _originalItem = item;
            _parentViewModel      = parentVM;
            IsSingleDialogEditing = isSingleDialogEditing;
            _itemRepository       = importRepository;
            _mappingEditVM        = mappingEditVM;
            _columnMappingVM      = columnMappingVM;
            _pickAssetVM          = pickAssetVM;
            _importService        = importService;
            _catalogRepository    = catalogRepository;

            ViewTitle = new ViewTitleBase()
            {
                Title = "Import job", SubTitle = DisplayName.ToUpper()
            };

            if (isSingleDialogEditing)
            {
                _originalItem = InnerItem;

                OpenItemCommand = new DelegateCommand(() =>
                {
                    NavigationData = new NavigationItem(InnerItem.ImportJobId, NavigationNames.HomeName, NavigationNames.MenuName, this);
                    navManager.Navigate(NavigationData);
                });

                CancelCommand      = new DelegateCommand <object>(OnCancelCommand);
                SaveChangesCommand = new DelegateCommand <object>((x) => OnSaveChangesCommand(), (x) => { return(IsModified); });
                MinimizeCommand    = new DelegateCommand(() => MinimizableViewRequestedEvent(this, null));
            }
            else
            {
                InitializePropertiesForViewing();
            }

            FilePickCommand       = new DelegateCommand(RaiseFilePickInteractionRequest);
            CreateMappingCommand  = new DelegateCommand(RaiseCreateMappingInteractionRequest);
            CancelConfirmRequest  = new InteractionRequest <Confirmation>();
            CommonConfirmRequest  = new InteractionRequest <Confirmation>();
            CommonConfirmRequest2 = new InteractionRequest <Confirmation>();

            UpdateImporterCommand    = new DelegateCommand <EntityImporterBase>((x) => OnImporterChangesCommand(x));
            UpdatePropertySetCommand = new DelegateCommand <PropertySet>((x) => OnPropertySetChangesCommand(x));

            CatalogChangedCommand = new DelegateCommand <CatalogBase>((x) => OnCatalogChangesCommand(x));

            ItemEditCommand  = new DelegateCommand <MappingItem>((x) => RaiseItemEditInteractionRequest(x), x => x != null);
            ItemClearCommand = new DelegateCommand <MappingItem>((x) => RaiseItemClearInteractionRequest(x), x => x != null);
        }
Exemplo n.º 33
0
 public AssetImportService(IImportRepository importRepository, IMapper mapper, IAssetService assetService)
 {
     _importRepository = importRepository;
     _mapper           = mapper;
     _assetService     = assetService;
 }
Exemplo n.º 34
0
 public abstract Event Import(IImportRepository repository);
 public void Delete(IImportRepository repository)
 {
     repository.Attach(_originalItem);
     repository.Remove(_originalItem);
     //repository.DeleteImportJob(InnerItem.Id);
 }
Exemplo n.º 36
0
 public async Task <ActionResult <Import> > GetById([FromServices] IImportRepository repository, Guid id)
 {
     return(Ok(await repository.GetById(id)));
 }
Exemplo n.º 37
0
 public ImportService(IImportRepository importRepository, IUnitOfWork unitOfWork)
 {
     this._importRepository = importRepository;
     this._unitOfWork       = unitOfWork;
 }
Exemplo n.º 38
0
 //---------------------------------------------------------------------------------------------------
 /// <summary>
 /// AutoDownload results split over multiple pages with splits
 /// </summary>
 /// <param name="repository"></param>
 /// <param name="document"></param>
 /// <param name="ev"></param>
 private void ParseMultiplePageWithSplits(IImportRepository repository, HtmlDocument document, Event ev)
 {
     ParseMultiplePage(
         repository,
         document,
         ev,
         "//tr[td]",                             // Courses
         "td/td/a",                              // Course page address
         "//div[@class=\"course-title\"]/h2",    // Course name
         "//p[@class=\"course-info\"][2]",       // Course details
         "//tr[td]",                             // Results
         "td",                                   // Result position
         "td/td",                                // Result name
         "td/td/td",                             // Result club
         "td/td/td/td",                          // Result age
         "td/td/td/td/td"                        // Result time
     );
 }
Exemplo n.º 39
0
        //---------------------------------------------------------------------------------------------------
        private void ParseSinglePage(
            IImportRepository repository,
            HtmlDocument document,
            Event ev,
            string course_selector,
            string course_name_selector,
            string course_details_selector,
            string results_selector,
            string results_position_selector,
            string results_name_selector,
            string results_club_selector,
            string results_age_selector,
            string results_time_selector
        )
        {
            // Courses
            var course_nodes = document.DocumentNode.SelectNodes(course_selector);
            foreach (var course_node in course_nodes) {
                Course course = new Course();
                course.Event = ev;

                // Course name
                var name_node = course_node.SelectSingleNode(course_name_selector);
                course.Name = name_node.InnerText;

                // Course details
                var details_node = course_node.SelectSingleNode(course_details_selector);
                if (details_node != null) {
                    course.Length = Convert.ToDecimal(details_node.InnerText.Split(new char[] { ' ' })[0].TrimEnd(new char[] { 'k', 'm' }));
                    course.Climb = Convert.ToDecimal(details_node.InnerText.Split(new char[] { ' ' })[1].TrimEnd(new char[] { 'm' }));
                }

                // Commit the course
                repository.Course(ref course);

                // Results
                var results_nodes = course_node.SelectNodes(results_selector);
                foreach (var results_node in results_nodes) {
                    Result result = new Result();
                    result.Course = course;

                    // Position can be a number or null, if null then use the string as a code
                    var position_node = results_node.SelectSingleNode(results_position_selector);
                    try {
                        result.Position = Convert.ToInt32(position_node.ChildNodes[0].InnerText.TrimEnd(new char[] { 'r', 's', 't', 'n', 'd', 'h' }));
                    } catch (FormatException) {
                        result.Position = null;
                        result.Code = position_node.ChildNodes[0].InnerText;
                    }

                    // Name
                    var results_name_node = results_node.SelectSingleNode(results_name_selector);
                    result.Name = results_name_node.ChildNodes[0].InnerText;

                    // Club
                    var club_name_node = results_node.SelectSingleNode(results_club_selector);
                    result.ClubName = club_name_node.ChildNodes[0].InnerText;

                    // Age class
                    var age_class_node = results_node.SelectSingleNode(results_age_selector);
                    result.Age = age_class_node.ChildNodes[0].InnerText;

                    // Time
                    var time_node = results_node.SelectSingleNode(results_time_selector);
                    try {
                        result.Time = new TimeSpan(
                            0,
                            Convert.ToInt32(time_node.ChildNodes[0].InnerText.Split(new char[] { ':' })[0]),
                            Convert.ToInt32(time_node.ChildNodes[0].InnerText.Split(new char[] { ':' })[1])
                        );
                    } catch (FormatException) {
                        result.Time = null;
                    }

                    // Commit the result
                    repository.Result(ref result);
                }
            }
        }
Exemplo n.º 40
0
 public FSPriceController()
 {
     this.db = new ImportRepository(new ImportModel.ImportEntities());
 }
Exemplo n.º 41
0
 public ImportService(IImportRepository importRepository)
 {
     this.importRepository = importRepository;
 }
Exemplo n.º 42
0
 //---------------------------------------------------------------------------------------------------
 static ImportQueue()
 {
     s_repository = new MockImportRepository();
 }