Beispiel #1
0
        public static List <dynamic> GetTickets()
        {
            List <dynamic> tickets = new List <dynamic>();

            try
            {
                string json = serv_proxy.GetAuthorTickets(token, null);

                if (json.Contains("error"))
                {
                    return(null);
                }
                else
                {
                    dynamic res = JsonConvert.DeserializeObject(json);

                    foreach (dynamic ticket in res)
                    {
                        json = serv_proxy.GetTicket((int)ticket.id.Value);
                        if (json.Contains("error"))
                        {
                            continue;
                        }
                        res = JsonConvert.DeserializeObject(json);

                        tickets.Add(new
                        {
                            id     = res.id,
                            title  = res.title,
                            date   = res.createdAt,
                            status = res.status
                        });
                    }
                }
            }
            catch (Exception e)
            {
                tickets = null;
            }

            return(tickets);
        }