Example #1
0
        private void AddDevelopersToTeam()
        {
            Console.Clear();
            DisplayDevelperlist();
            DisplayTeamList();
            bool done = false;

            Console.WriteLine("Add developers to team type 0 to quit");
            Console.WriteLine("Please enter the teamid: ");
            long teamid = GetValidID();

            if (teamid == 0)
            {
                done = true;
            }
            while (!done)
            {
                string team = "Please enter the id of the developer to add to team: " + teamid.ToString() + " type 0 to exit";
                Console.WriteLine(team);
                long devid = GetValidID();
                if (devid == 0)
                {
                    break;
                }
                Developer d     = devRepo.GetDeveloper(devid);
                bool      added = devTeamRepo.AddDeveloperToTeam(teamid, d);
                if (added)
                {
                    Console.Clear();
                    DisplayDevelperlist();
                    DisplayTeamList();
                }
                else
                {
                    Console.WriteLine("Please enter a valid developer id");
                    done = true;
                }
            }
        }
Example #2
0
        //add developer to team
        private void AddMembertoDevTeam()
        {
            Console.Clear();
            DisplayAllDevelopers();
            DisplayAllDevTeams();
            Console.WriteLine("Please Enter a TeamID: ");
            int teamID = GetID();

            Console.WriteLine("Please enter the ID of the developer you want to add ");
            int       devID = GetID();
            Developer d     = _developerRepo.GetDeveloperByID(devID);
            bool      added = _devTeamRepo.AddDeveloperToTeam(teamID, d);

            if (added == true)
            {
                Console.WriteLine("Developer has been added to " + teamID.ToString());
            }
            else
            {
                Console.WriteLine("Developer was not added");
            }
        }
Example #3
0
        //6. add developers to a team (one at a time)
        private void AddDevelopersToTeam()
        {
            DisplayAllDevelopers();
            Console.WriteLine("Which developer would you like to add to a team? Enter an ID.");
            string input = Console.ReadLine();

            Developer newDev = _developerRepo.GetDeveloperByID(input);

            //view list of teams
            Console.WriteLine("What team would you like to add them to?");
            string teamID = Console.ReadLine();

            _devTeamRepo.AddDeveloperToTeam(newDev, teamID);
        }
        // Create New Developer
        private void CreateNewDeveloper()
        {
            Console.Clear();

            var newDeveloper = new Developer();


            // Name
            Console.WriteLine("Enter the name of the developer:");
            newDeveloper.Name = Console.ReadLine();
            // Check for empty string
            if (!Input(newDeveloper.Name))
            {
                return;
            }


            // ID Number
            Console.WriteLine($"\nEnter {newDeveloper.Name}'s ID number:");
            string IDasString = Console.ReadLine();

            // Check for empty string
            if (!Input(IDasString))
            {
                return;
            }

            if (IsNum(IDasString))
            {
                newDeveloper.ID = int.Parse(IDasString);
            }
            else
            {
                Console.WriteLine("Sorry, you need to enter a number here.");
                return;
            }



            // Has Access
            Console.WriteLine($"\nDoes {newDeveloper.Name} have access to Pluralsight? (y/n)");
            string hasAccessString = Console.ReadLine().ToLower();

            // Check for empty string
            if (!Input(hasAccessString))
            {
                return;
            }

            if (hasAccessString == "y")
            {
                newDeveloper.HasAccessToPluralsight = true;
            }
            else
            {
                newDeveloper.HasAccessToPluralsight = false;
            }


            // Team Name
            Console.WriteLine($"\nEnter the team name that {newDeveloper.Name} belongs to:");
            string devTeamAsString = Console.ReadLine();

            // Check for empty string
            if (!Input(devTeamAsString))
            {
                return;
            }

            if (_devTeamRepo.GetTeamByName(devTeamAsString) == null)
            {
                DevTeam newDevTeam = new DevTeam(devTeamAsString);
                _devTeamRepo.AddDevTeam(newDevTeam);
            }
            else
            {
                _devTeamRepo.AddDeveloperToTeam(newDeveloper.ID, devTeamAsString);
            }


            _developerRepo.AddDeveloper(newDeveloper);
            _devTeamRepo.AddDeveloperToTeam(newDeveloper.ID, devTeamAsString);
        }