private void _airdnaScrapeThenSaveStore(bool isNew = false, bool needScrape = true) { _log($"Start AirdnaScrapeThenSaveStore (isNew={isNew})"); var state = new ScraperAirdnaStateModel() { IsNew = isNew, }; var scraper = new ScraperAirdna(state); if (needScrape) { scraper.Scrape(); } var dataOfScrape = scraper.GetDomainModel(); var excelService = new ExcelAirdnaService(state); var excelData = excelService.CreateExcel(dataOfScrape); var pathToFile = excelService.SaveToFile(excelData); var archive = new ArchiveRepository(); archive.Save(pathToFile, state.TypeScraper); _log($"End AirdnaScrapeThenSaveStore (isNew={isNew}), Spent time {_calcSpentTime2String(state)}"); }
public void Update() { var scraper = new ScraperAirdna(new ScraperAirdnaStateModel()); var repository = scraper.GetRepository(); var model = scraper.GetDomainModel(); var isOk = repository.UpdateData(model); }
public void AirdnaStatusWorkspace() { var scraper = new ScraperAirdna(); var status = scraper.StatusWorkspace(); scraper.SaveStatus(status); scraper.PrintStatus(status); }
static void GetExcelFile(ScraperAirdna scraper) { var model = scraper.GetDomainModel(); var excelService = scraper.GetExcelService(); var excelData = excelService.CreateExcel(model); var filename = excelService.SaveToFile(excelData); }
static void Main(string[] args) { Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US"); NpgsqlConnection.GlobalTypeMapper.UseNetTopologySuite(); var state = new ScraperAirdnaStateModel() { IsNew = true, }; var scraper = new ScraperAirdna(state); UpdateRepository(); //Scrape(scraper); //GetExcelFile(scraper); //PrintSaveStatus(scraper); }
static void Scrape(ScraperAirdna scraper) { var isOk = scraper.Scrape(); }