Пример #1
0
        static void Main(string[] args)
        //this method does not return any value, just contain some code, static: only one instance of method "Main" in memory
        {
            // Create two Dictionary vars to hold info for menu and data

            // Top-level menu options, "View Jobs by Search or List"
            Dictionary <string, string> actionChoices = new Dictionary <string, string>();

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

            // Column options, view jobs by list 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); //first choice, view jobs by search or list

                if (actionChoice.Equals("list"))
                {
                    string columnChoice = GetUserSelection("List", columnChoices); //view jobs by list options

                    if (columnChoice.Equals("all"))                                //if choose "all" in "List by", print all
                    {
                        PrintJobs(JobData.FindAll());
                    }
                    else
                    {
                        List <string> results = JobData.FindAll(columnChoice); //print by List choices/column choices, namely: skill, employer, Location, position type

                        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"))
                    {
                        //Console.WriteLine("Search all fields not yet implemented.");
                        searchResults = JobData.FindByValue(searchTerm);
                        PrintJobs(searchResults);
                    }
                    else
                    {
                        searchResults = JobData.FindByColumnAndValue(columnChoice, searchTerm);
                        PrintJobs(searchResults);
                    }
                }
            }
        }
Пример #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>();

            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);
                    }
                    else
                    {
                        searchResults = JobData.FindByColumnAndValue(columnChoice, searchTerm);
                    }
                    PrintJobs(searchResults);
                }
            }
        }
Пример #3
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 = JodData.FindAll(columnChoice);

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

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

                    List <Dictionary <string, string> > searchResults;

                    if (columnChoice.Equals("all"))
                    {
                        PrintJobs(JobData.FindAll());
                    }
                    else
                    {
                        searchResults = JobData.FindByColumnAndValue(columnChoice, searchTerm);
                        PrintJobs(searchResults);
                    }
                }
            }
        }
Пример #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 in CSV file/data
            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)
            {
                /*Provides the header "view Jobs" & is the input header for GetUserSelection.
                 * and actionChoices of list or search */
                //Runs at the start of the program and waits for user selection
                string actionChoice = GetUserSelection("View Jobs", actionChoices);

                if (actionChoice.Equals("list"))
                {
                    //if action choice is list, run UserSelection w/ colChoices dict
                    //Returns the user's selected key, ex. Toast
                    string columnChoice = GetUserSelection("List", columnChoices);

                    //user looks at menu and selects list all
                    if (columnChoice.Equals("all"))
                    {
                        //FindAll, loads all dicts/data in the list and returns it.
                        PrintJobs(JobData.FindAll());
                    }
                    else
                    {
                        //list dictionary results by user selected header/column

                        //results Calls method FindAll in JobData class w/param colChoice
                        List <string> results = JobData.FindAll(columnChoice);

                        //The header below pulls column choice key with colchoice value.
                        //  EX..                                Skill
                        Console.WriteLine("\n*** All " + columnChoices[columnChoice] + " Values ***");

                        //Display results alphabetically with .Sort method
                        results.Sort();

                        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 calls the class JobData, method FindByValue in JobData.cs.
                        //FindByValue parameter being user input string.
                        searchResults = JobData.FindByValue(searchTerm);
                        //call print jobs with the list of dictionaries found to be relevant/equal to user input
                        PrintJobs(searchResults);
                    }
                    else
                    {
                        searchResults = JobData.FindByColumnAndValue(columnChoice, searchTerm);
                        PrintJobs(searchResults);
                    }
                }
            }
        }
Пример #5
0
        static void Main(string[] args)
        {
            // I think its returning job more than once ex: search, All, Ruby.
            // 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)
            {// ////////////////// where is initiating first user prompt for entry???
                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"))
                    {
                        //Console.WriteLine("Search all fields not yet implemented.But almost?");
                        searchResults = JobData.FindByValue(searchTerm);
                        if (searchResults.Count > 0)
                        {
                            PrintJobs(searchResults);
                        }
                        else
                        {
                            Console.WriteLine("Results Not Found. Please search for something else.");
                        }
                    }
                    else
                    {
                        searchResults = JobData.FindByColumnAndValue(columnChoice, searchTerm);
                        if (searchResults.Count > 0)
                        {
                            PrintJobs(searchResults);
                        }
                        else
                        {
                            Console.WriteLine("Results Not Found. Please search for something else.");
                        }
                    }
                }
            }
        }
Пример #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)
            {
                string actionChoice = GetUserSelection("View Jobs", actionChoices); //gets user input for what they want to search (search or list)

                if (actionChoice.Equals("list"))                                    //will run if userinput was "list"
                {
                    string columnChoice = GetUserSelection("List", columnChoices);  //will return userchoice for column user wishes to list by

                    if (columnChoice.Equals("all"))                                 //will run if user choice is "all"
                    {
                        Console.WriteLine("\n*** All Values ***");
                        PrintJobs(JobData.FindAll());//this method will search for all jobs and print them out
                    }
                    else
                    {
                        List <string> results = JobData.FindAll(columnChoice);//initializes variable results as a list and sets it equal to the return for JobData.FindAll with the users columnChoice

                        //this returns all values listed by column choice

                        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;//initializes new list of dictionaries called searchResults

                    // Fetch results
                    if (columnChoice.Equals("all"))
                    {
                        Console.WriteLine("*** This is the all search option");
                        searchResults = JobData.FindByValue(searchTerm);//calls the FindByColumnAndValue method from JobData
                        PrintJobs(searchResults);
                    }
                    else
                    {
                        searchResults = JobData.FindByColumnAndValue(columnChoice, searchTerm);//calls the FindByColumnAndValue method from JobData
                        PrintJobs(searchResults);
                    }
                }
            }
        }
Пример #7
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);

                        int count = 0;

                        Console.BackgroundColor = ConsoleColor.DarkBlue;
                        Console.WriteLine("\n*** All " + columnChoices[columnChoice] + " Values ***");
                        Console.WriteLine();
                        Console.BackgroundColor = ConsoleColor.White;
                        Console.ForegroundColor = ConsoleColor.DarkBlue;
                        results.Sort();

                        foreach (string item in results)
                        {
                            Console.Write("{0,-45}", item);
                            count++;

                            if (count % 5 == 0)
                            {
                                if (Console.BackgroundColor == ConsoleColor.White)
                                {
                                    Console.BackgroundColor = ConsoleColor.Gray;
                                }
                                else
                                {
                                    Console.BackgroundColor = ConsoleColor.White;
                                }

                                Console.WriteLine();
                            }
                        }

                        if (results.Count != 0)
                        {
                            Console.WriteLine();
                            Console.BackgroundColor = ConsoleColor.DarkGreen;
                            Console.ForegroundColor = ConsoleColor.White;
                            Console.Write("{0} DISPLAYED", results.Count);
                        }
                        else
                        {
                            Console.WriteLine();
                            Console.BackgroundColor = ConsoleColor.DarkRed;
                            Console.ForegroundColor = ConsoleColor.White;
                            Console.Write("NO RESULTS");
                        }

                        Console.ResetColor();
                        Console.WriteLine();
                    }
                }
                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);
                        //searchResults.Sort();
                        PrintJobs(searchResults);
                    }
                    else
                    {
                        searchResults = JobData.FindByColumnAndValue(columnChoice, searchTerm);
                        //searchResults.Sort();
                        PrintJobs(searchResults);
                    }
                }
            }
        }
Пример #8
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
                    }
                }
            }
        }
Пример #9
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);
                    }
                }
            }
        }
Пример #10
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
                    }
                }
            }
        }
Пример #11
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);
                        }
                    }
                }
            }
        }