private void _winWinScrapeThenSaveStore(bool isNew = false, bool needScrape = true) { _log($"Start WinWinScrapeThenSaveStore (isNew={isNew})"); var state = new ScraperWinWinStateModel() { IsNew = isNew, }; var scraper = new ScraperWinWin(state); if (needScrape) { scraper.Scrape(); } var dataOfScrape = scraper.GetDomainModel(); var excelService = new ExcelWinWinService(state); var excelData = excelService.CreateExcel(dataOfScrape); var pathToFile = excelService.SaveToFile(excelData); var archive = new ArchiveRepository(); archive.Save(pathToFile, state.TypeScraper); _log($"End WinWinScrapeThenSaveStore (isNew={isNew}), Spent time {_calcSpentTime2String(state)}"); }
static void PrintSaveStatus(ScraperWinWin scraper) { var status = scraper.StatusWorkspace(); scraper.PrintStatus(status); scraper.SaveStatus(status); }
public void Update() { var scraper = new ScraperWinWin(new ScraperWinWinStateModel()); var repository = scraper.GetRepository(); var model = scraper.GetDomainModel(); var isOk = repository.UpdateData(model); }
public void WinWinStatusWorkspace() { var scraper = new ScraperWinWin(); var status = scraper.StatusWorkspace(); scraper.SaveStatus(status); scraper.PrintStatus(status); }
static void GetExcelFile(ScraperWinWin 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"); var state = new ScraperWinWinStateModel() { IsNew = false, }; var scraper = new ScraperWinWin(state); UpdateRepository(); //Scrape(scraper); //GetExcelFile(scraper); //PrintSaveStatus(scraper); var itemDto = scraper.GetItemDtoAsync("4389448").Result; }
static void Scrape(ScraperWinWin scraper) { var isOk = scraper.Scrape(); }