Пример #1
0
        public TransHistory GetTransHistory(
            int?from       = null,
            int?count      = null,
            int?fromId     = null,
            int?endId      = null,
            bool?orderAsc  = null,
            DateTime?since = null,
            DateTime?end   = null)
        {
            var args = new Dictionary <string, string> {
                { "method", "TransHistory" }
            };

            if (from != null)
            {
                args.Add("from", from.Value.ToString());
            }

            if (count != null)
            {
                args.Add("count", count.Value.ToString());
            }

            if (fromId != null)
            {
                args.Add("from_id", fromId.Value.ToString());
            }

            if (endId != null)
            {
                args.Add("end_id", endId.Value.ToString());
            }

            if (orderAsc != null)
            {
                args.Add("order", orderAsc.Value ? "ASC" : "DESC");
            }

            if (since != null)
            {
                args.Add("since", UnixTime.GetFromDateTime(since.Value).ToString());
            }

            if (end != null)
            {
                args.Add("end", UnixTime.GetFromDateTime(end.Value).ToString());
            }

            JObject result = JObject.Parse(Query(args));

            if (result.Value <int>("success") == 0)
            {
                throw new BtceException(result.Value <string>("error"));
            }

            return(TransHistory.ReadFromJObject(result["return"] as JObject));
        }
Пример #2
0
        public static TransHistory ReadFromJObject(JObject o)
        {
            var r = new TransHistory();
            r.List = new Dictionary<int, Transaction>();
            foreach (var item in o)
            {
                var transId = int.Parse(item.Key);
                var trans = Transaction.ReadFromJObject(item.Value as JObject);
                r.List.Add(transId, trans);
            }

            return r;
        }
Пример #3
0
        public static TransHistory ReadFromJObject(JObject o)
        {
            var r = new TransHistory();

            r.List = new Dictionary <int, Transaction>();
            foreach (var item in o)
            {
                var transId = int.Parse(item.Key);
                var trans   = Transaction.ReadFromJObject(item.Value as JObject);
                r.List.Add(transId, trans);
            }

            return(r);
        }
Пример #4
0
        public static TransHistory ReadFromJObject(JObject o)
        {
            var list = new TransHistory();

            list.List = new Dictionary <int, Transaction>();
            foreach (var VARIABLE in o)
            {
                list.List.Add(key: int.Parse(VARIABLE.Key.ToString()), value: Transaction.ReadFromJObject(VARIABLE.Value as JObject));
            }
            return(list);
            //return new TransHistory() {
            //    List = o.OfType<KeyValuePair<string,JToken>>().ToDictionary(a=>int.Parse(a.Key), a=>Transaction.ReadFromJObject(a.Value as JObject))
            //};
        }