//Method for deserialization filter results to objects (including List of Jira ticket)
        static FilterResults deserializeFilterResults(string url, CookieContainer cookies)
        {
            string         resultJson;
            HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);

            request.CookieContainer = cookies;

            HttpWebResponse response = (HttpWebResponse)request.GetResponse();

            resultJson = readHttpResponse(response);

            FilterResults results = JsonConvert.DeserializeObject <FilterResults>(resultJson, new JsonSerializerSettings {
                NullValueHandling = NullValueHandling.Ignore
            });

            return(results);
        }
        static void Main(string[] args)
        {
            CookieContainer cookies = new CookieContainer();
            FilterResults   results = new FilterResults();
            string          url;
            DateTime        sprintStartDate = DateTime.Now;
            DateTime        sprintEndDate   = DateTime.Now;

            DateTime createDate = DateTime.Now;

            //  url = "http://dev-aus-jira-01.swdev.local/rest/api/2/search?jql=project+%3D+%22Unified+IT+Manager%22+AND+created+%3E+startOfMonth%28%29";
            // http://dev-aus-jira-01.swdev.local/rest/api/2/search?jql=project+%3D+%22Unified+IT+Manager%22+AND+sprint+in+openSprints%28%29



            cookies = jiraAuthentication();
            getStartAndEndDate(cookies, out sprintStartDate, out sprintEndDate);
            url     = "http://dev-aus-jira-01.swdev.local/rest/api/2/search?jql=project+%3D+%22Unified+IT+Manager%22+AND+created>" + "'" + sprintStartDate.ToString("yyyy-MM-dd") + "'" + "AND+created<=" + "'" + sprintEndDate.ToString("yyyy-MM-dd") + "'";
            results = deserializeFilterResults(url, cookies);

            foreach (var tic in results.issues)
            {
                DateTime.TryParse(tic.fields.created, out createDate);
                Console.WriteLine("{0} priority= {1} status = {2}", tic.key, tic.fields.priority.name, createDate.ToString("yyyy-MM-dd"));
            }

            Console.WriteLine(results.issues.Count.ToString());


            getPriorityStats(results.issues);
            getBugsPerDayStats(results.issues);
            getUndefinedBugs(results.issues);

            Console.Write(sprintStartDate.ToString());
            Console.Write(sprintEndDate.ToString());


            Console.ReadKey();
        }
Exemple #3
0
        static void Main(string[] args)
        {
            CookieContainer cookies = new CookieContainer();
              FilterResults results = new FilterResults();
              string url;
              DateTime sprintStartDate = DateTime.Now;
              DateTime sprintEndDate = DateTime.Now;

            DateTime createDate = DateTime.Now;

            //  url = "http://dev-aus-jira-01.swdev.local/rest/api/2/search?jql=project+%3D+%22Unified+IT+Manager%22+AND+created+%3E+startOfMonth%28%29";
              // http://dev-aus-jira-01.swdev.local/rest/api/2/search?jql=project+%3D+%22Unified+IT+Manager%22+AND+sprint+in+openSprints%28%29

              cookies = jiraAuthentication();
              getStartAndEndDate(cookies, out sprintStartDate, out sprintEndDate);
              url = "http://dev-aus-jira-01.swdev.local/rest/api/2/search?jql=project+%3D+%22Unified+IT+Manager%22+AND+created>" + "'" + sprintStartDate.ToString("yyyy-MM-dd") + "'"+"AND+created<=" + "'" + sprintEndDate.ToString("yyyy-MM-dd") + "'";
              results = deserializeFilterResults(url, cookies);

              foreach (var tic in results.issues)
              {
              DateTime.TryParse(tic.fields.created, out createDate);
              Console.WriteLine("{0} priority= {1} status = {2}", tic.key, tic.fields.priority.name, createDate.ToString("yyyy-MM-dd"));
              }

              Console.WriteLine(results.issues.Count.ToString());

              getPriorityStats(results.issues);
              getBugsPerDayStats(results.issues);
              getUndefinedBugs(results.issues);

            Console.Write(sprintStartDate.ToString());
            Console.Write(sprintEndDate.ToString());

              Console.ReadKey();
        }