Exemple #1
0
 public SchedulerWrapper(EnbsvParserService enbsvParser, GazServiceParserService gazServiceParser, IPartSupplierRepository partSupplierRepo, ISupplierOfferFilesRepository supplierOfferFilesRepo)
 {
     this._enbsvParser            = enbsvParser;
     this._supplierOfferFilesRepo = supplierOfferFilesRepo;
     this._gazServiceParser       = gazServiceParser;
     this._partSupplierRepo       = partSupplierRepo;
 }
Exemple #2
0
 public CommandController(
     EnbsvParserService enbsvParserService,
     GazServiceParserService gazServiceParserService,
     IPartsRepository partsRepository,
     IPartProducerRepository partProducerRepository,
     ICatalogItemRepository catalogItemRepository,
     IPartSupplierRepository partSupplierRepository,
     ISupplierPriceItemRepository supplierPriceItemRepository,
     IModerationService moderationService,
     IHostingEnvironment hostingEnvironment,
     ISchedulerWrapper scheduler,
     IGoogleDriveService googleDriveService)
 {
     this._scheduler                   = scheduler;
     this._googleDriveService          = googleDriveService;
     this._moderationService           = moderationService;
     this._gazServiceParserService     = gazServiceParserService;
     this._enbsvParserService          = enbsvParserService;
     this._partSupplierRepository      = partSupplierRepository;
     this._partsRepository             = partsRepository;
     this._partProducerRepository      = partProducerRepository;
     this._hostingEnvironment          = hostingEnvironment;
     this._catalogItemRepository       = catalogItemRepository;
     this._supplierPriceItemRepository = supplierPriceItemRepository;
 }
        public async override Task ImportOffers(string SERVICE_SEARCH_NAME, IPartSupplierRepository _partSupplierRepository, ISupplierOfferFilesRepository _supplierOfferFilesRepository)
        {
            var supplier = _partSupplierRepository.GetByName(SERVICE_SEARCH_NAME);
            var files    = _supplierOfferFilesRepository.NeedProcessingFor(supplier).ToList();

            var groupedFiles = files.GroupBy(x => x.GroupIdentifier);

            foreach (var group in groupedFiles)
            {
                var errorMessage = string.Empty;
                OfferFileStatusEnum status;

                try {
                    await this.Process(group, supplier);

                    status = OfferFileStatusEnum.Processed;
                } catch (Exception ex) {
                    status       = OfferFileStatusEnum.Error;
                    errorMessage = ex.Message + ex.StackTrace;
                }

                foreach (var file in group)
                {
                    file.Status       = status;
                    file.ErrorMessage = errorMessage;
                }

                await _supplierOfferFilesRepository.SaveRange(group);
            }
        }
 public SearchController(ICatalogItemRepository catalogItemRepository,
                         ISupplierPriceItemRepository supplierPriceItemRepository,
                         IPartSupplierRepository partSupplierRepository)
 {
     this._partSupplierRepository      = partSupplierRepository;
     this._catalogItemRepository       = catalogItemRepository;
     this._supplierPriceItemRepository = supplierPriceItemRepository;
 }
 public EnbsvParserService(
     IPartSupplierRepository partSupplierRepository,
     ISupplierWarehouseRepository supplierWarehouseRepository,
     IPartProducerRepository partProducerRepository,
     ISupplierPriceItemRepository supplierPriceItemRepository,
     ISupplierOfferFilesRepository supplierOfferFilesRepository,
     IHostingEnvironment hostingEnvironment)
 {
     this._supplierOfferFilesRepository = supplierOfferFilesRepository;
     this._hostingEnvironment           = hostingEnvironment;
     this._supplierPriceItemRepository  = supplierPriceItemRepository;
     this._supplierWarehouseRepository  = supplierWarehouseRepository;
     this._partSupplierRepository       = partSupplierRepository;
     this._partProducerRepository       = partProducerRepository;
 }
        public async virtual Task ImportOffers(string SERVICE_SEARCH_NAME, IPartSupplierRepository _partSupplierRepository, ISupplierOfferFilesRepository _supplierOfferFilesRepository)
        {
            var supplier = _partSupplierRepository.GetByName(SERVICE_SEARCH_NAME);
            var files    = _supplierOfferFilesRepository.NeedProcessingFor(supplier).ToList();

            foreach (var file in files)
            {
                try {
                    await this.Process(new List <SupplierOfferFile> {
                        file
                    }, supplier);

                    file.Status = OfferFileStatusEnum.Processed;
                } catch (Exception ex) {
                    file.Status       = OfferFileStatusEnum.Error;
                    file.ErrorMessage = ex.Message + ex.StackTrace;
                }
            }

            await _supplierOfferFilesRepository.SaveRange(files);
        }