public Supermarkt(int ID, string Name, string URL, string Title, ProductPagina ProductPagina) { this.ID = ID; this.Name = Name; if (this.Name.Contains("Aanbiedingen ")) { this.Name = this.Name.Substring("Aanbiedingen ".Length); } this.URL = URL; this.Title = Title; this.SetImageURL(); this.SetSlogan(); this.SupermarketEnabled = false; this.ProductPagina = ProductPagina; }
public static async Task <ProductPagina> GetDiscountsFromSupermarket(Supermarkt supermarkt, bool BackgroundTask) { string Cache = null; DiscountCache.TryGetValue(supermarkt.ID, out Cache); if (!string.IsNullOrWhiteSpace(Cache)) { return(JsonConvert.DeserializeObject <ProductPagina>(Cache)); } string SupermarktData = await HTTPGetUtil.GetDataAsStringFromURL(Host + "GetProductPageBySupermarketID/" + supermarkt.ID); if (!string.IsNullOrWhiteSpace(SupermarktData)) { DiscountCache.Add(supermarkt.ID, SupermarktData); } ProductPagina p = JsonConvert.DeserializeObject <ProductPagina>(SupermarktData); await NotifcationDataHandler.Update(supermarkt.Name, p.DiscountValid, BackgroundTask); return(p); }