Beispiel #1
0
        static void Main(string[] args)
        {
            // Create two Dictionary vars to hold info for menu and data

            // Top-level menu options
            Dictionary <string, string> actionChoices = new Dictionary <string, string>();

            actionChoices.Add("search", "Search");
            actionChoices.Add("list", "List");

            // Column options
            Dictionary <string, string> columnChoices = new Dictionary <string, string>();

            columnChoices.Add("core competency", "Skill");
            columnChoices.Add("employer", "Employer");
            columnChoices.Add("location", "Location");
            columnChoices.Add("position type", "Position Type");
            columnChoices.Add("all", "All");

            Console.WriteLine("Welcome to LaunchCode's TechJobs App!");

            // Allow user to search/list until they manually quit with ctrl+c
            while (true)
            {
                string actionChoice = GetUserSelection("View Jobs", actionChoices);

                if (actionChoice.Equals("list"))
                {
                    string columnChoice = GetUserSelection("List", columnChoices);

                    if (columnChoice.Equals("all"))
                    {
                        PrintJobs(JobData.FindAll());
                    }
                    else
                    {
                        List <string> results = JobData.FindAll(columnChoice);

                        Console.WriteLine("\n*** All " + columnChoices[columnChoice] + " Values ***");
                        foreach (string item in results)
                        {
                            Console.WriteLine(item);
                        }
                    }
                }
                else // choice is "search"
                {
                    // How does the user want to search (e.g. by skill or employer)
                    string columnChoice = GetUserSelection("Search", columnChoices);

                    // What is their search term?
                    Console.WriteLine("\nSearch term: ");
                    string searchTerm = Console.ReadLine();

                    List <Dictionary <string, string> > searchResults;

                    // Fetch results
                    if (columnChoice.Equals("all"))
                    {
                        searchResults = JobData.FindByValue(searchTerm);
                        PrintJobs(searchResults);
                    }
                    else
                    {
                        searchResults = JobData.FindByColumnAndValue(columnChoice, searchTerm);
                        PrintJobs(searchResults);
                    }
                }
            }
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            // Create two Dictionary vars to hold info for menu and data

            // Top-level menu options
            Dictionary <string, string> actionChoices = new Dictionary <string, string>(); //declairs dictionary 'actionChoices' with two strings

            actionChoices.Add("search", "Search");                                         //adds 'actionChoices' dictionary entry for 'search'
            actionChoices.Add("list", "List");                                             //adds 'actionChoices' dictionary enty for 'list'

            // Column options
            Dictionary <string, string> columnChoices = new Dictionary <string, string>(); //declairs dictionary for 'columnChoices' with two strings

            columnChoices.Add("core competency", "Skill");                                 // adds 'columnChoices' dictionary entry for '...
            columnChoices.Add("employer", "Employer");                                     // adds 'columnChoices'  dictionary entry for '...
            columnChoices.Add("location", "Location");                                     // adds 'columnChoices' dictionary entry for '...
            columnChoices.Add("position type", "Position Type");                           // adds 'columnChoices' dictionary entry for '...
            columnChoices.Add("all", "All");                                               // adds 'columnChoices' dictionary for '...


            Console.WriteLine("Welcome to LaunchCode's TechJobs App!"); //writes line "Welcome to LaunchCode's TechJobs App!"

            // Allow user to search/list until they manually quit with ctrl+c
            while (true)
            {
                // GetUserSelection displays a menu of choices and returns the user's selection.
                string actionChoice = GetUserSelection("View Jobs", actionChoices); //sets 'actionChoice' to 'Getuserselection' and ?views jobs via action choices?

                if (actionChoice.Equals("list"))                                    // conditional for if the action chosen if 'list'
                {
                    string columnChoice = GetUserSelection("List", columnChoices);  //sets 'columnChoice to 'GetUserSelection' ???"List", columnChoices???

                    if (columnChoice.Equals("all"))                                 //lists item 'all' at end of other columnChoices
                    {
                        PrintJobs(JobData.FindAll());                               //prints all jobs if 'all' is chosen
                    }
                    else //if line 38 condition not met
                    {
                        List <string> results = JobData.FindAll(columnChoice);                         //creates string list of the results for 'jobdata.findall' via the choice column

                        Console.WriteLine("\n*** All " + columnChoices[columnChoice] + " Values ***"); //writes the column choice from list of columns?
                        foreach (string item in results)                                               //iterates through each item in results and...
                        {
                            Console.WriteLine(item);                                                   //...writes item
                        }
                    }
                }
                else // choice is "search"
                {
                    // How does the user want to search (e.g. by skill or employer)
                    string columnChoice = GetUserSelection("Search", columnChoices);

                    // What is their search term?
                    Console.WriteLine("\nSearch term: ");
                    string searchTerm = Console.ReadLine();

                    List <Dictionary <string, string> > searchResults; //sets a list of dictionaries ....

                    // Fetch results
                    if (columnChoice.Equals("all"))
                    {
                        searchResults = JobData.FindByValue(searchTerm);
                        PrintJobs(searchResults);
                    }
                    else
                    {
                        searchResults = JobData.FindByColumnAndValue(columnChoice, searchTerm); //sets 'searchResults' to search for 'columnChoice' and 'searchTerm'
                        PrintJobs(searchResults);                                               //prints 'searchResults
                    }
                }
            }
        }
Beispiel #3
0
        static void Main(string[] args)
        {
            // Create dictionary for top-level menu options(actionChoices)
            Dictionary <string, string> actionChoices = new Dictionary <string, string>();

            actionChoices.Add("search", "Search");
            actionChoices.Add("list", "List");

            // Create dictionary for job data(columnChoices)
            Dictionary <string, string> columnChoices = new Dictionary <string, string>();

            columnChoices.Add("core competency", "Skill");
            columnChoices.Add("employer", "Employer");
            columnChoices.Add("location", "Location");
            columnChoices.Add("position type", "Position Type");
            columnChoices.Add("all", "All");

            Console.WriteLine("Welcome to LaunchCode's TechJobs App!");


            // Allow user to search/list until they manually quit with ctrl+c
            while (true)
            {
                string actionChoice = GetUserSelection("View Jobs", actionChoices); // Ask user to view jobs by search or list, then store that response as a string(actionChoice)

                if (actionChoice.Equals("list"))                                    //If user selects view by list
                {
                    string columnChoice = GetUserSelection("List", columnChoices);  // Ask user which list they would like to view, and store their response as a string(columnChoice)

                    if (columnChoice.Equals("all"))                                 //If user selects view all lists
                    {
                        //print all lists
                        PrintJobs(JobData.FindAll());
                    }

                    else // If user selects one list
                    {
                        List <string> results = JobData.FindAll(columnChoice); //Create a list of search results(results) from the data base based on user's choice(columnChoice)


                        //Print the user's desired list using the reuslts listvvvvvvvvv
                        Console.WriteLine("\n*** All " + columnChoices[columnChoice] + " Values ***");
                        foreach (string item in results)
                        {
                            Console.WriteLine(item);
                        }
                        //Print the user's desired list using the results list^^^^^^^^^^
                    }
                }

                else // choice is "search"
                {
                    // How does the user want to search (e.g. by skill or employer)
                    string columnChoice = GetUserSelection("Search", columnChoices);

                    // Ask user for search term
                    Console.WriteLine("\nSearch term: ");
                    string searchTerm = Console.ReadLine().ToLower();

                    List <Dictionary <string, string> > searchResults;

                    // Fetch results
                    if (columnChoice.Equals("all"))
                    {
                        searchResults = JobData.FindByValue(searchTerm);
                        PrintJobs(searchResults);
                    }

                    else
                    {
                        searchResults = JobData.FindByColumnAndValue(columnChoice, searchTerm);
                        PrintJobs(searchResults);
                    }
                }
            }
        }
Beispiel #4
0
        static void Main(string[] args)
        {
            // Create two Dictionary vars to hold info for menu and data

            // Top-level menu options
            Dictionary <string, string> actionChoices = new Dictionary <string, string>();

            actionChoices.Add("search", "Search");
            actionChoices.Add("list", "List");

            // Column options
            Dictionary <string, string> columnChoices = new Dictionary <string, string>();

            columnChoices.Add("core competency", "Skill");
            columnChoices.Add("employer", "Employer");
            columnChoices.Add("location", "Location");
            columnChoices.Add("position type", "Position Type");
            columnChoices.Add("all", "All");

            Console.WriteLine("Welcome to LaunchCode's TechJobs App!");

            // Allow user to search/list until they manually quit with ctrl+c
            while (true)
            {
                string actionChoice = GetUserSelection("View Jobs", actionChoices); //sends dicto and header string to G.U.S. function
                                                                                    //returns string of key
                if (actionChoice.Equals("list"))                                    //if key string is list
                {
                    string columnChoice = GetUserSelection("List", columnChoices);  //run the G.U.S. again but for column choices

                    if (columnChoice.Equals("all"))                                 //if returned string is all
                    {
                        PrintJobs(JobData.FindAll());                               //run jobData.FindAll() **note not FindAll(string) function
                    }
                    else
                    {
                        List <string> results = JobData.FindAll(columnChoice);                         //runs a function that will return a list<str> of all different entries
                                                                                                       //in that column

                        Console.WriteLine("\n*** All " + columnChoices[columnChoice] + " Values ***"); //this prints a sort of header, users the columnChoices dicto spit out a nicely formatted header
                        foreach (string item in results)                                               //iterates over all entries in the list
                        {                                                                              //simply writes each entry in list
                            Console.WriteLine(item);
                        }
                    }
                }
                else // choice is "search"
                {
                    // How does the user want to search (e.g. by skill or employer)
                    string columnChoice = GetUserSelection("Search", columnChoices);

                    // What is their search term?
                    Console.WriteLine("\nSearch term: ");
                    string searchTerm = Console.ReadLine();

                    List <Dictionary <string, string> > searchResults; //creates a new list of <str><Str> dictos called searchResults

                    // Fetch results
                    if (columnChoice.Equals("all"))
                    {
                        searchResults = JobData.FindByValue(searchTerm);
                        PrintJobs(searchResults);
                    }
                    else
                    {
                        searchResults = JobData.FindByColumnAndValue(columnChoice, searchTerm); //takes in columnChoice Key from GSU function, as well as the search term
                        PrintJobs(searchResults);                                               //takes data back from FBCAV above, list of str str dictos, and runs that list back through print jobs
                    }
                }
            }
        }
Beispiel #5
0
        static void Main(string[] args)
        {
            Dictionary <string, string> actionChoices = new Dictionary <string, string>();

            actionChoices.Add("search", "Search");
            actionChoices.Add("list", "List");


            Dictionary <string, string> columnChoices = new Dictionary <string, string>();

            columnChoices.Add("core competency", "Skill");
            columnChoices.Add("employer", "Employer");
            columnChoices.Add("location", "Location");
            columnChoices.Add("position type", "Position Type");
            columnChoices.Add("all", "All");

            Console.WriteLine("Welcome to LaunchCode's TechJobs App!");


            while (true)
            {
                string actionChoice = GetUserSelection("View Jobs", actionChoices);

                if (actionChoice.Equals("list"))
                {
                    string columnChoice = GetUserSelection("List", columnChoices);

                    if (columnChoice.Equals("all"))
                    {
                        PrintJobs(JobData.FindAll());
                    }
                    else
                    {
                        List <string> results = JobData.FindAll(columnChoice);

                        Console.WriteLine("\n*** All " + columnChoices[columnChoice] + " Values ***");
                        foreach (string item in results)
                        {
                            Console.WriteLine(item);
                        }
                    }
                }
                else
                {
                    string columnChoice = GetUserSelection("Search", columnChoices);


                    Console.WriteLine("\nSearch term: ");
                    string searchTerm = Console.ReadLine();

                    List <Dictionary <string, string> > searchResults;


                    if (columnChoice.Equals("all"))
                    {
                        searchResults = JobData.FindByValue(searchTerm);

                        PrintJobs(searchResults);
                    }
                    else
                    {
                        searchResults = JobData.FindByColumnAndValue(columnChoice, searchTerm);
                        PrintJobs(searchResults);
                    }
                }
            }
        }
Beispiel #6
0
        static void Main(string[] args)
        {
            // Create two Dictionary vars to hold info for menu and data

            // Top-level menu options
            Dictionary <string, string> actionChoices = new Dictionary <string, string>();

            actionChoices.Add("search", "Search");
            actionChoices.Add("list", "List");

            // Column options
            Dictionary <string, string> columnChoices = new Dictionary <string, string>();

            columnChoices.Add("core competency", "Skill");
            columnChoices.Add("employer", "Employer");
            columnChoices.Add("location", "Location");
            columnChoices.Add("position type", "Position Type");
            columnChoices.Add("all", "All");

            Console.WriteLine("Welcome to LaunchCode's TechJobs App!");

            // Allow user to search/list until they manually quit with ctrl+c
            while (true)
            {
                //calls GetUserSelection returns "View Jobs by" and "search" or "list"
                string actionChoice = GetUserSelection("View Jobs", actionChoices);

                if (actionChoice.Equals("list"))
                {
                    //calls GetUserSelection returns "List by" and key: core competency, employer,
                    //location, position type, or all
                    string columnChoice = GetUserSelection("List", columnChoices);

                    if (columnChoice.Equals("all"))
                    {
                        //Method PrintJobs line 126 is called and returns ALL jobs and details in kvp form
                        PrintJobs(JobData.FindAll());
                    }
                    else //columnChoice == keys: core competency, employer, location, or position type
                    {
                        //The string "results" stores all jobs according to choice of column selcted by user
                        //without duplicates
                        List <string> results = JobData.FindAll(columnChoice);

                        Console.WriteLine("\n*** All " + columnChoices[columnChoice] + " Values ***");
                        foreach (string item in results)
                        {
                            //prints all results of the columnChoice without duplicates
                            Console.WriteLine(item);
                        }
                    }
                }
                else // choice is "search"
                {
                    // How does the user want to search (i.e. core competency, employer, location,
                    //or position type)
                    //calls GetUserSelection returns "Search by" and key: core competency, employer,
                    //location, position type, or all
                    string columnChoice = GetUserSelection("Search", columnChoices);

                    // What is their search term?
                    Console.WriteLine("\nSearch term: ");
                    string searchTerm = Console.ReadLine();

                    //Is searchTerm result missing here?

                    //declaration of list of dicts searchResults populated in line 75
                    List <Dictionary <string, string> > searchResults;

                    // Fetch results
                    if (columnChoice.Equals("all"))
                    {
                        searchResults = JobData.FindByValue(searchTerm.ToLower());
                        if (searchResults.Count == 0)
                        {
                            Console.WriteLine("No results");
                        }
                        else
                        {
                            PrintJobs(searchResults);
                        }
                    }
                    else//columnChoice==core competency, employer, location, or position type e.g. searchTerm==lockerdome
                    {
                        searchResults = JobData.FindByColumnAndValue(columnChoice, searchTerm.ToLower());
                        if (searchResults.Count == 0)
                        {
                            Console.WriteLine("No results");
                        }
                        else
                        {
                            PrintJobs(searchResults);
                        }
                    }
                }
            }
        }