Пример #1
0
        static void Main(string[] args)
        {
            // Define the List container for the employees
            List <Employee> employees = new List <Employee>();

            // Get the list of employees from either the console or the
            // (random) API endpoint.



            Boolean response = false;

            while (!response)
            {
                Console.WriteLine("Obtain employee data from the (C)onsole or (A)PI, or (E)xit?");
                string answer = Console.ReadLine();
                string ans    = answer.ToUpper();

                if (ans == "C")
                {
                    response  = true;
                    employees = PeopleFetcher.GetEmployees();
                }
                else if (ans == "A")
                {
                    response  = true;
                    employees = PeopleFetcher.GetFromAPI();
                }
                else if (ans == "E")
                {
                    return;
                }
                else
                {
                    Console.WriteLine("Invalid response, please try again.");
                }
            }
            ;

            // Dump out the list
            Util.PrintEmployees(employees);

            // Save the employee list to a CSV file
            Util.MakeCSV(employees);

            // Create the badges
            Util.MakeBadges(employees);
        }
Пример #2
0
        static void Main(string[] args)
        {
            List <Employee> employees = new List <Employee>();

            Console.Clear();
            Console.WriteLine("Press 1 then enter to input employee info manually.");
            Console.WriteLine("Press 2 then enter to retrieve employee info from an API.");
            string userInput = Console.ReadLine();

            switch (userInput)
            {
            case "1":
                employees = PeopleFetcher.GetEmployees();
                break;

            case "2":
                employees = PeopleFetcher.GetFromAPI();
                break;
            }
            Util.MakeCSV(employees);
            Util.MakeBadges(employees);
        }
Пример #3
0
        static void Main(string[] args)
        {
            Console.WriteLine("Do you want to import API data for badges? type yes or no");
            String response = Console.ReadLine();

            if (response == "yes")
            {
                List <Employee> employees = PeopleFetcher.GetFromApi();
                Util.MakeCSV(employees);
                Util.MakeBadges(employees);
            }
            else if (response == "no")
            {
                List <Employee> employees = PeopleFetcher.GetEmployees();
                Util.MakeCSV(employees);
                Util.MakeBadges(employees);
            }
            else
            {
                Console.Write("Invalid Response");
            }
        }
Пример #4
0
        static void Main(string[] args)
        {
            List <Employee> employees;

            Console.WriteLine("(M)anual or (A)uto Employee Generation (Auto is default): ");
            // get a name from the console and assign it to a variable
            string answer = Console.ReadLine();

            if (answer == "m" || answer == "M")
            {
                employees = PeopleFetcher.GetEmployees();
            }
            else
            {
                employees = PeopleFetcher.GetFromApi();
            }


            Util.PrintEmployees(employees);
            Util.MakeCSV(employees);
            Util.MakeBadges(employees);
        }