Esempio n. 1
0
        public CategoriesList Subtree()
        {
            long id    = (long)this ["id"];
            var  query = new Dictionary <string, string> ();

            return(CategoriesList.Subtree(id, query, record.RecordClient));
        }
        public static void ReadingSubtreeCategoriesList(string id, string token, long recordId)
        {
            try {
                Console.WriteLine("--Subtree--");

                CategoriesList subtree = CategoriesList.Subtree(recordId);

                foreach (var item in subtree.Page)
                {
                    Console.WriteLine("Id: " + item["id"] + " ParentId: " + item["parent_id"]);
                }

                while (subtree.Next())
                {
                    foreach (var item in subtree.Page)
                    {
                        Console.WriteLine("Id: " + item["id"] + " ParentId: " + item["parent_id"]);
                    }
                }

                Dictionary <string, string> query = new Dictionary <string, string>()
                {
                    { "per_page", "2" }
                };

                Console.WriteLine("--Subtree(query)--");

                var subtree2 = CategoriesList.Subtree(3193, query, new Client());

                foreach (var item in subtree2.Page)
                {
                    Console.WriteLine("Id: " + item["id"] + " ParentId: " + item["parent_id"]);
                }
            } catch (VzaarApiException ve) {
                Console.Write("!!!!!!!!! EXCEPTION !!!!!!!!!");
                Console.WriteLine(ve.Message);
            } catch (Exception e) {
                Console.Write("!!!!!!!!! EXCEPTION !!!!!!!!!");
                Console.WriteLine(e.Message);

                if (e is AggregateException)
                {
                    AggregateException ae = (AggregateException)e;

                    var flatten = ae.Flatten();

                    foreach (var fe in flatten.InnerExceptions)
                    {
                        if (fe is VzaarApiException)
                        {
                            Console.WriteLine(fe.Message);
                        }
                    }
                }
            }
        }