public static void RenewPrice(bool reloadAllProducts = false) { try { var collector = new ProductCollector(); collector.RenewPrice(reloadAllProducts); } catch (Exception e) { string logFileName = string.Format(@"{0}\log.txt", Directory.GetCurrentDirectory()); //if (File.Exists(logFileName)) // File.Delete(logFileName); Logger.LogMessage(e.Message); Logger.LogMessage(e.StackTrace); //File.WriteAllText(logFileName, e.Message); } }
private decimal GetCompetitorVatPrice(string url, Encoding encoding, bool isVatPrice, decimal vatRate) { try { var page = ProductCollector.GetWebPageContent(url, encoding); var price = GetPriceFromPage(page); if (!isVatPrice) { price = price * ((decimal)1 + vatRate / (decimal)100); } return(Math.Round(price, 2)); } catch (Exception e) { Logger.LogMessage("Warning: " + e.Message); return(-1); } }