public void sendNewOffersPushover(List <Offer> offers, string searchTerm) { Pushover pushover = new Pushover("uoGz5xaAPxZQFGDJwPhEF3vJF6eeYG", "ae965hsnhmamdo12wcpmxw75fto72a"); List <int> notified_ids = null; List <SearchIdsAndTerms> allNotifiedIds = this.loadAllNotifiedIds(this.confFile_path); if (allNotifiedIds == null) { notified_ids = null; List <int> currentSearch_ids = new List <int>(); foreach (Offer offer in offers) { currentSearch_ids.Add(Int32.Parse(offer.offer_id)); } List <int> unnotified_ids = currentSearch_ids; foreach (Offer offer in offers) { if (unnotified_ids.Contains(Int32.Parse(offer.offer_id))) { pushover.pushText(offer.ToString()); } } this.addNewNotifiedIds(searchTerm, unnotified_ids, this.confFile_path); } else { notified_ids = this.getNotifiedIdsFromOneSearch(allNotifiedIds, searchTerm); List <int> currentSearch_ids = new List <int>(); foreach (Offer offer in offers) { currentSearch_ids.Add(Int32.Parse(offer.offer_id)); } List <int> unnotified_ids = new List <int>(); if (notified_ids == null) { unnotified_ids = currentSearch_ids; } else { unnotified_ids = currentSearch_ids.Except(notified_ids).ToList(); } foreach (Offer offer in offers) { if (unnotified_ids.Contains(Int32.Parse(offer.offer_id))) { pushover.pushText(offer.ToString()); } } this.addNewNotifiedIds(searchTerm, unnotified_ids, this.confFile_path); } }
public DeliveryHandler(string provider) { this.provider = provider; switch (provider) { case "Pushover": //MAYBE CHANGE THIS SO NOT FOR EVERY MESSAGE A NEW OBJECT HAVE TO BE CREATED. this.pushover = new Pushover(ConfigurationManager.AppSettings["userkey"], ConfigurationManager.AppSettings["applicationkey"]); break; case "Telegram": this.telegram = new Telegram(ConfigurationManager.AppSettings["telegrambottoken"], ConfigurationManager.AppSettings["telegramchatid"]); break; } }