public static void RenewPriceOnSellingItem(ItemOnCsgotm item) { RenewPriceOrDeleteSellingItem(item, false); }
private static void RenewPriceOrDeleteSellingItem(ItemOnCsgotm item, bool stopSelling) { int price = 0; string itemName = ""; if (!stopSelling) { SQLHelper sqlHelper = SQLHelper.getInstance(); string class_instance = item.getClassInstance(); ItemInSQL itemSql = sqlHelper.Select(class_instance); if (itemSql != null) { itemName = itemSql.ItemName; price = EvaluatePrice(itemSql); } else { price = 0; } } else { price = 0; } string changePriceLink = String.Format("https://csgo.tm/api/SetPrice/{0}/{1}/?key={2}",item.ItemId,price,ApiKey); var changePriceResponse = CsgotmConfig.SteamWeb.Fetch(changePriceLink, "GET", null, false, null); if (changePriceResponse.Contains("\"result\":1")) { Console.WriteLine("Price for item " + itemName + " has changed to " + (double) price/100 + ".руб"); } else { Console.WriteLine("Error while changing item price: " + changePriceResponse); } }
/// <summary> /// /// </summary> /// <param name="item">The item! :)</param> public static void StopSellingItem(ItemOnCsgotm item) { RenewPriceOrDeleteSellingItem(item, true); }