Esempio n. 1
0
 public SourceFileService(IImportRepository importRepository, IFileService fileService,
                          IExtractFileService extractService)
 {
     _importRepository = importRepository;
     _fileService      = fileService;
     _extractService   = extractService;
 }
Esempio n. 2
0
        public ImportJob(
            IImportJobRepository importJobRepository,
            InMemoryCache <TradeAccountModel> tradeAcccountModel,
            InMemoryCache <TradeMasterAccountModel> tradeMasterAccountModel,
            InMemoryCache <TradeInstrumentModel> tradeInstrumentModel,
            InMemoryCache <TradeFeeTypeModel> tradeFeeTypesModel,
            IContract wcf,
            FileNameMatcher fileNameMatcher,
            IExtractFileService extractFileService) : base(wcf)
        {
            _job = Job.Import;

            _tradeAccountModel       = tradeAcccountModel;
            _tradeInstrumentModel    = tradeInstrumentModel;
            _tradeFeeTypesModel      = tradeFeeTypesModel;
            _tradeMasterAccountModel = tradeMasterAccountModel;
            _importJobRepository     = importJobRepository;
            _extractFileService      = extractFileService;
            _fileNameMatcher         = fileNameMatcher;
            using (var tradeContext = _importJobRepository.BeginOperation())
            {
                foreach (var masterAccount in _importJobRepository.GetAllMasterAccounts())
                {
                    _tradeMasterAccountModel.Add(masterAccount.AccountName,
                                                 new TradeMasterAccountModel {
                        Id = masterAccount.Id
                    });
                }

                foreach (var instrument in _importJobRepository.GetTradeInstrument())
                {
                    _tradeInstrumentModel.Add(instrument.InstrumentName,
                                              new TradeInstrumentModel {
                        Id = instrument.Id
                    });
                }

                foreach (var trade in _importJobRepository.GetTradeAccount())
                {
                    _tradeAccountModel.Add(trade.AccountName, new TradeAccountModel {
                        Id = trade.Id
                    });
                }

                foreach (var tradeFeeType in _importJobRepository.GetTradeFeeType())
                {
                    _tradeFeeTypesModel.Add(tradeFeeType.TradeFeeTypeName,
                                            new TradeFeeTypeModel {
                        Id = tradeFeeType.Id
                    });
                }
            }
        }
Esempio n. 3
0
        public ImportJob(
            IImportJobRepository importJobRepository,
            InMemoryCache <TradeAccountModel> tradeAcccountModel,
            InMemoryCache <TradeInstrumentModel> tradeInstrumentModel,
            InMemoryCache <TradeFeeTypeModel> tradeFeeTypesModel,
            FileNameMatcher fileNameMatcher,
            IExtractFileService extractFileService)
        {
            var jobInterval = ConfigurationManager.AppSettings["job:ImportJobInterval"];

            if (string.IsNullOrEmpty(jobInterval))
            {
                throw new ConfigurationErrorsException("Please add 'job:ImportJobInterval' settigns to .config file.");
            }

            JobInterval = int.Parse(jobInterval);

            _tradeAccountModel    = tradeAcccountModel;
            _tradeInstrumentModel = tradeInstrumentModel;
            _tradeFeeTypesModel   = tradeFeeTypesModel;
            _importJobRepository  = importJobRepository;
            _extractFileService   = extractFileService;
            _fileNameMatcher      = fileNameMatcher;

            using (var tradeContext = _importJobRepository.BeginOperation())
            {
                foreach (var instrument in _importJobRepository.GetTradeInstrument())
                {
                    _tradeInstrumentModel.Add(instrument.InstrumentName,
                                              new TradeInstrumentModel {
                        Id = instrument.Id
                    });
                }

                foreach (var trade in _importJobRepository.GetTradeAccount())
                {
                    _tradeAccountModel.Add(trade.AccountName, new TradeAccountModel {
                        Id = trade.Id
                    });
                }

                foreach (var tradeFeeType in _importJobRepository.GetTradeFeeType())
                {
                    _tradeFeeTypesModel.Add(tradeFeeType.TradeFeeTypeName,
                                            new TradeFeeTypeModel {
                        Id = tradeFeeType.Id
                    });
                }
            }
        }
Esempio n. 4
0
        public FileDeliveryJob(
            IDeliveryJobRepository deliveryJobRepository,
            IExtractFileService extractFileService,
            IRestApiService restApiService)
        {
            var jobInterval = ConfigurationManager.AppSettings["job:FileDeliveryJobInterval"];

            if (string.IsNullOrEmpty(jobInterval))
            {
                throw new ConfigurationErrorsException("Please add 'job:FileDeliveryJobInterval' settigns to .config file.");
            }

            JobInterval = int.Parse(jobInterval);

            _deliveryJobRepo    = deliveryJobRepository;
            _extractFileService = extractFileService;
            _restApiService     = restApiService;
        }