Exemplo n.º 1
0
        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());
                }
            }
        }
Exemplo n.º 2
0
        public void AtualizarItem(string codigo, string key)
        {
            if (key != "3kl4j3lk5n3lk3j43kl4j34n3,m4n34k34hj3l4h34nm3,.n43")
            {
                throw new Exception("Chave inválida");
            }

            PKGItens p = new PKGItens();

            p.AtualizarItem(codigo);
        }
Exemplo n.º 3
0
        private void AtualizaTodosItens(string JsonAuction)
        {
            PKGItens pkg = new PKGItens();
            List<string> l = new List<string>();

            Object[] Auct = RetornaArraydeAuctions(JsonAuction);

            foreach (Dictionary<string, object> item in Auct)
            {

                if (!l.Any(x => x == item["item"].ToString()))
                {
                    pkg.AtualizarItem(item["item"].ToString());
                    l.Add(item["item"].ToString());
                }
            }
        }
Exemplo n.º 4
0
        private Object[] RetornaArraydeAuctions(string JsonAuction)
        {
            JavaScriptSerializer js = new JavaScriptSerializer();
            js.MaxJsonLength = 50000000;
            PKGItens pkg = new PKGItens();
            List<string> l = new List<string>();

            var Obj = (Dictionary<string, object>)js.DeserializeObject(JsonAuction);

            var Aucally = (Dictionary<string, object>)Obj["alliance"];
            Object[] Auct = (Object[])Aucally["auctions"];
            return Auct;
        }
Exemplo n.º 5
0
        public void AtualizaValoresItens(decimal idItem, decimal valor, string key)
        {
            if (key != "3kl4j3lk5n3lk3j43kl4j34n3,m4n34k34hj3l4h34nm3,.n43")
            {
                throw new Exception("Chave inválida");
            }

            PKGItens p = new PKGItens();
            p.AtualizaValorItem(idItem,valor);
        }