public void AtualizaTudoValorItens() { PKGItens pkg = new PKGItens(); List<string> l = new List<string>(); List<Auction> ac = new List<Auction>(); LastModified las = new LastModified(); Object[] Auct; decimal valor; las = lastModified(sd.NEMESIS); Auct = RetornaArraydeAuctions(RetornaJsonAuction(las)); foreach (Dictionary<string, object> item in Auct) { Auction a = new Auction(); a.bid = Convert.ToDecimal(item["bid"].ToString()); a.buyout = Convert.ToDecimal(item["buyout"].ToString()); a.idItem = Convert.ToInt32(item["item"].ToString()); ac.Add(a); } foreach (Dictionary<string, object> item in Auct) { if (!l.Any(x => x == item["item"].ToString())) { valor = (from p in ac where p.idItem == Convert.ToInt32(item["item"].ToString()) orderby p.buyout select p.buyout).First(); pkg.AtualizaValorItem(Convert.ToDecimal(item["item"].ToString()), valor); l.Add(item["item"].ToString()); } } }
private LastModified ConverteJsontoLastModified(string jItem) { JavaScriptSerializer js = new JavaScriptSerializer(); var Obj = (Dictionary<string, object>)js.DeserializeObject(jItem); LastModified Novo = new LastModified(); var teste = Obj["files"]; var teste1 = ((Object[])teste)[0]; Novo.url = ((Dictionary<string, object>)teste1)["url"].ToString(); Novo.lastModified = ((Dictionary<string, object>)teste1)["lastModified"].ToString(); return Novo; }
public void AtualizaTudo() { LastModified l = new LastModified(); l = lastModified(sd.NEMESIS); AtualizaTodosItens(RetornaJsonAuction(l)); }
private string RetornaJsonAuction(LastModified l) { AcessoWEB aweb = new AcessoWEB(); return aweb.RecuperaJSON(l.url); }