コード例 #1
0
ファイル: PKGAH.cs プロジェクト: ricardochaves/MasterControl
        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());
                }
            }
        }
コード例 #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);
        }
コード例 #3
0
ファイル: PKGAH.cs プロジェクト: ricardochaves/MasterControl
        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());
                }
            }
        }
コード例 #4
0
ファイル: PKGAH.cs プロジェクト: ricardochaves/MasterControl
        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;
        }
コード例 #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);
        }