Ejemplo n.º 1
0
        public static void Main(string[] args)
        {
            Console.WriteLine("Enter User Name: ");
            var userName = Console.ReadLine();

            Console.WriteLine("Enter Repo Owner:");
            var groupName = Console.ReadLine();


            Console.WriteLine("Enter Repo Name:");
            var repoName = Console.ReadLine();

            Console.WriteLine("Enter MileStone Name(optional):");
            var milestoneName = Console.ReadLine();


            Console.WriteLine("Enter Password:"******"Report Generated");
                }
                catch (Exception e)
                {
                    Console.WriteLine(e);
                }
            }
            else
            {
                Console.WriteLine("Improper information entered");
            }
        }
Ejemplo n.º 2
0
        public void GenerateIssueReport(IReadOnlyList <Issue> issues, Repository repo, string mileStoneName = null, IssuesRepo isRepo = null)
        {
            XLWorkbook workbook  = new XLWorkbook(this.Template);
            var        openSheet = workbook.Worksheets.First(o => o.Name == "Open");

            int row = 2;
            int col = 1;


            var targeted = issues.Where(o => (mileStoneName != null && o.Milestone.Title == mileStoneName) || mileStoneName == null)
                           .GroupBy(x => x.State, (s, i) => new { state = s, issue = i })
                           .ToList();

            //we are going to test this first we get projects
            isRepo.GetProjects();
            isRepo.GetProjectColumns(isRepo.Projects.Select(o => o.Id).First());
            //isRepo.GetCardsManually(isRepo.ProjectColumns.Select(o => o.Id).First());



            foreach (var item in targeted.Where(o => o.state == ItemState.Open).SelectMany(o => o.issue))
            {
                openSheet.Cell(row, col).Value = item.Number;
                col++;

                openSheet.Cell(row, col).Value = item.User.Login;
                col++;

                openSheet.Cell(row, col).Value = repo.Name;
                col++;
                openSheet.Cell(row, col).Value = item.Title;
                col++;
                openSheet.Cell(row, col).Value = item.Body;
                col++;
                openSheet.Cell(row, col).Value = string.Join(", ", item.Assignees.Select(o => o.Login));
                col++;
                openSheet.Cell(row, col).Value = item.State;
                col++;
                openSheet.Cell(row, col).Value     = "Link To Git Issue";
                openSheet.Cell(row, col).Hyperlink = new XLHyperlink(item.HtmlUrl);
                col++;
                openSheet.Cell(row, col).Value = string.Join(",", item.Labels.Select(o => o.Name));
                col = 1;
                row++;
            }

            var closedSheet = workbook.Worksheets.First(o => o.Name == "Closed");

            row = 2;
            foreach (var item in targeted.Where(o => o.state == ItemState.Closed).SelectMany(o => o.issue))
            {
                closedSheet.Cell(row, col).Value = item.Number;
                col++;

                closedSheet.Cell(row, col).Value = item.User.Login;
                col++;

                closedSheet.Cell(row, col).Value = repo.Name;
                col++;
                closedSheet.Cell(row, col).Value = item.Title;
                col++;
                closedSheet.Cell(row, col).Value = item.Body;
                col++;
                closedSheet.Cell(row, col).Value = string.Join(", ", item.Assignees.Select(o => o.Login));
                col++;
                closedSheet.Cell(row, col).Value = item.State;
                col++;
                closedSheet.Cell(row, col).Value     = "Link To Git Issue";
                closedSheet.Cell(row, col).Hyperlink = new XLHyperlink(item.HtmlUrl);
                col++;
                closedSheet.Cell(row, col).Value = string.Join(",", item.Labels.Select(o => o.Name));
                col = 1;
                row++;
            }



            var Today    = DateTime.Now.ToString("MMM-dd-yyyy");
            var fileName = $"Issue-Tracker-{Today.ToString()}.xlsx";

            if (File.Exists(fileName))
            {
                File.Delete(fileName);
            }



            workbook.SaveAs(fileName);
        }