Ejemplo n.º 1
0
        private async void btnStartMigration_Click(object sender, EventArgs e)
        {
            completedProcesses         = 0;
            progressBarMigration.Value = 0;
            progressBarMigration.Show();
            progressBarMigration.Maximum = totalProcesses;
            lblInfo.Hide();
            lblInfo.Text    = "";
            txtDetails.Text = "";


            lblInfo.Show();
            lblDetails.Show();

            jiraClient = new JiraApi(jiraUrl, jiraUsername, jiraPassword);
            vsoClient  = new VSOApi(vsoUrl, vsoUsername, vsoPassword);
            migration  = new MigrationHelper(jiraClient, vsoClient);
            if (cbProjects.Checked)
            {
                lblInfo.Text     = "Migrating projects...";
                txtDetails.Text += await migration.MigrateProjects();

                progressBarMigration.Value++;
            }
            if (cbSprints.Checked)
            {
                lblInfo.Text     = "Migrating sprints...";
                txtDetails.Text += await migration.MigrateSprints();

                progressBarMigration.Value++;
            }
            if (cbStories.Checked)
            {
                lblInfo.Text     = "Migrating stories...";
                txtDetails.Text += await migration.MigrateStories();

                progressBarMigration.Value++;
            }
            if (cbSprintStories.Checked)
            {
                lblInfo.Text     = "Migrating sprint stories...";
                txtDetails.Text += await migration.MigrateSprintsStories();

                progressBarMigration.Value++;
            }
            if (totalProcesses == 0)
            {
                lblInfo.Text = "Nothing to Migrate";
            }
            if (totalProcesses == progressBarMigration.Value && totalProcesses != 0)
            {
                lblInfo.Text = "Migration Finished, see details >>";
            }
        }
Ejemplo n.º 2
0
 public MigrationHelper(JiraApi jiraClient, VSOApi vsoClient)
 {
     this.jiraClient = jiraClient;
     this.vsoClient  = vsoClient;
 }
Ejemplo n.º 3
0
        static async Task RunAsync()
        {
            string jiraUrl      = ConfigurationManager.AppSettings["jiraUrl"];
            string jiraUsername = ConfigurationManager.AppSettings["jiraUsername"];
            string jiraPassword = ConfigurationManager.AppSettings["jiraPassword"];

            string vsoUrl      = ConfigurationManager.AppSettings["vsoUrl"];
            string vsoUsername = ConfigurationManager.AppSettings["vsoUsername"];
            string vsoPassword = ConfigurationManager.AppSettings["vsoPassword"];
            // Basic Auth
            JiraApi apiConsumer    = new JiraApi(jiraUrl, jiraUsername, jiraPassword);
            VSOApi  vsoApiConsumer = new VSOApi(vsoUrl, vsoUsername, vsoPassword);

            try
            {
                //Console.WriteLine("------------ Boards:  ");
                //Boards boards = new Boards { };
                //boards = await apiConsumer.GetBoards();
                //Boards.Show(boards);

                //Console.WriteLine("------------ Board 1:  ");
                //Board board = new Board { };
                //board = await apiConsumer.GetBoard("1");
                //Board.Show(board);

                //Console.WriteLine("------------ Board 1 Backlog:  ");
                //Issues backlog = new Issues { };
                //backlog = await apiConsumer.GetBoardBacklog("1");
                //Issues.Show(backlog);

                //Console.WriteLine("------------ Board 1 Issues:  ");
                //Issues boardIssues = new Issues { };
                //boardIssues = await apiConsumer.GetBoardIssues("1");
                //Issues.Show(boardIssues);

                //Console.WriteLine("------------ Board 1 Sprints:  ");
                //Sprints sprints = null;
                //sprints = await apiConsumer.GetBoardSprints("1");
                //Sprints.Show(sprints);



                //Models.Jira.Project[] projects = null;
                //projects = await apiConsumer.GetProjects();
                //foreach (var i in projects)
                //{
                //    // Models.Jira.Project.Show(i);
                //    Sprints sprints = null;
                //    sprints = await apiConsumer.GetProjectSprints(i.id);
                //    Console.WriteLine($"------------ Sprints from Project {i.id}:  ");
                //    foreach (var j in sprints.sprints){
                //        await vsoApiConsumer.createIteration(new Models.Vso.Project(i.name, i.description, "Git", "6b724908-ef14-45cf-84f8-768b5384da45"), new Models.Vso.Iteration(j.name, j.start, j.end));
                //    }
                //    Sprints.Show(sprints);
                //}


                Models.Jira.Project[] projects = null;
                projects = await apiConsumer.GetProjects();

                foreach (var i in projects)
                {
                    // Models.Jira.Project.Show(i);
                    Sprints sprints = null;
                    sprints = await apiConsumer.GetProjectSprints(i.id);

                    foreach (var j in sprints.sprints)
                    {
                        Issues issues = null;
                        issues = await apiConsumer.GetProjectSprintIssues(j.id);

                        foreach (var k in issues.issues)
                        {
                            await vsoApiConsumer.createIterationWorkItem(new Models.Vso.Project(i.name, i.description, "Git", "adcc42ab-9882-485e-a3ed-7678f01f66bc"), new Models.Vso.Iteration(j.name, j.start, j.end), k.fields.description);
                        }
                    }
                }

                //Console.WriteLine("------------ Current User:  "******"------------ All Users:  ");
                //User[] users = null;
                //users = await apiConsumer.GetUsers();
                //foreach (var i in users)
                //{
                //    User.Show(i);
                //}

                //Console.WriteLine("------------ Workflows:  ");
                //WorkFlow[] workflows = null;
                //workflows = await apiConsumer.GetWorkFlows();
                //foreach (var i in workflows)
                //{
                //    WorkFlow.Show(i);
                //}

                //Console.WriteLine("------------ Issues:  ");
                //Issues issues = null;
                //issues = await apiConsumer.GetProjectIssues("10000");
                //Issues.Show(issues);

                //Console.WriteLine("------------ Permissions:  ");
                //Permissions permissions = null;
                //permissions = await apiConsumer.GetPermissions();
                //Permissions.Show(permissions);

                //Console.WriteLine("------------ Projects from board 1:  ");
                //Models.Jira.Project[] projects = null;
                //projects = await apiConsumer.GetProjects();
                //foreach (var i in projects)
                //{
                //    Models.Jira.Project.Show(i);
                //    vsoApiConsumer.createProject(new Models.Vso.Project(i.name, i.description, "Git", "6b724908-ef14-45cf-84f8-768b5384da45"));
                //}
                //vsoApiConsumer.getProjects();
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }

            Console.ReadLine();
        }