コード例 #1
0
        public void ClearOldDataJob()
        {
            DbOpperations db = new DbOpperations();

            RecurringJob.AddOrUpdate(
                () => db.DeleteDataOderThanDays(2),
                Cron.DayInterval(3));
        }
コード例 #2
0
        public void StartDataCollection()
        {
            DbOpperations db         = new DbOpperations();
            CurrencyDto   dto        = new CurrencyDto();
            ScrapperRT    rtScrapper = new ScrapperRT();
            ScrapperF1    f1Scrapper = new ScrapperF1();
            string        source     = null;

            try
            {
                dto    = rtScrapper.ExtractEURUSDData();
                source = "RT";
            }
            catch (Exception ex)
            {
                this.logger.Log(ex);
                try
                {
                    dto    = f1Scrapper.ExtractEURUSDData();
                    source = "F1";
                }
                catch (Exception exInner)
                {
                    this.logger.Log(exInner);
                    dto = null;
                }
            }

            Currency currency = new Currency()
            {
                CurrencyData = dto,
                Source       = source,
                TimeStamp    = DateTime.Now
            };

            db.InsertCurrency(currency);
        }