public void CheckProductPrice() { decimal newPrice; string message; string platform; handle.ExceptionHandler(() => { foreach (DataRow row in productDal.List().Rows) { platform = row["platform"].ToString(); if (row["platform"].ToString().Trim() == "hepsiburada") { newPrice = bot.CheckHepsiburadaPrice(row["url"].ToString().Trim()); message = PriceComparison(Convert.ToDecimal(row["price"]), newPrice, Convert.ToInt32(row["price_percent"])); if (!string.IsNullOrEmpty(message)) { mailSender.Send(row["mail_address"].ToString().Trim(), message, newPrice, row["name"].ToString().Trim(), row["url"].ToString().Trim()); } } else if (row["platform"].ToString().Trim() == "trendyol") { newPrice = bot.CheckTrendyolPrice(row["url"].ToString().Trim()); message = PriceComparison(Convert.ToDecimal(row["price"]), newPrice, Convert.ToInt32(row["price_percent"])); if (!string.IsNullOrEmpty(message)) { mailSender.Send(row["mail_address"].ToString().Trim(), message, newPrice, row["name"].ToString().Trim(), row["url"].ToString().Trim()); } } } }); }
public void Save(List <Product> products, int mailID) { handle.ExceptionHandler(() => { DataTable productTable = ProductTable(products, mailID); using (command = new SqlCommand("insert_product", connection)) { command.CommandType = CommandType.StoredProcedure; command.Parameters.AddWithValue("@tableproducts", productTable); ConnectionControl(); command.ExecuteNonQuery(); ConnectionControl(); }; }); }