private static void SetItem() { lock (sync) { if (item != null) { return; } Hashtable hash = Wiki.GetProductsFromWiki(); int seed = DateTime.Now.DayOfYear; ArrayList all = new ArrayList(); foreach (object obj in hash.Values) { ArrayList list = (ArrayList)obj; foreach (object someItem in list) { all.Add(someItem); } } if (all.Count != 0) { item = (ShopItem)all[seed % all.Count]; } else { item = new ShopItem("", "", ""); } } }
/// <summary>Escreve este controlo em html</summary> protected override void Render(HtmlTextWriter writer) { IDictionaryEnumerator it = Wiki.GetProductsFromWiki().GetEnumerator(); while (it.MoveNext()) { ArrayList list = (ArrayList)it.Value; writer.WriteLine("<h2>{0} ({1})</h2>", CultureModule.getContent(it.Key.ToString()), list.Count); foreach (ShopItem item in list) { writer.WriteLine("<a href='{0}' class='shopItem' title='{1} EUR'><img src='{2}'/></a>", item.Url, item.Price, item.Img); } } }