示例#1
0
        /// <summary>
        /// Calls on a print method from ScreenPrints and awaits for an input
        ///  string. This string will be the given search input for the rest
        ///  of the program, until the search is over.
        /// </summary>
        private void SearchMenu()
        {
            ScreenPrints.SearchMenu();

            search = Console.ReadLine();
            usrInput.SearchInput(search);
            srchPrepare.SplitSearch(usrInput.StringSearch);
        }
示例#2
0
        /// <summary>
        /// Prints on the console the Project's creators names and student ID.
        /// </summary>
        private void Credits()
        {
            //ScreenPrints method associated with the Credits screen display
            ScreenPrints.Credits();

            Console.ReadLine();
            Console.Write("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
            MainMenu();
        }
示例#3
0
        /// <summary>
        /// This is the first program-related method to be called.
        /// It displays a screen and awaits a key input to call on the Main Menu
        ///  and continue user interaction.
        /// </summary>
        public void IntroMenu()
        {
            VariableInit();

            ScreenPrints.IntroMenu();

            Console.Read();
            Console.Write("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
            MainMenu();
        }
示例#4
0
        /// <summary>
        /// Calls on a print method from ScreenPrints and awaits for an input
        ///  key to return to the Main Menu.
        /// </summary>
        private void PersonSearch()
        {
            // ScreenPrints method associated
            //with the PersonSearch screen display
            ScreenPrints.PersonPrint();

            Console.ReadLine();
            Console.Write("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
            MainMenu();
        }
示例#5
0
        /// <summary>
        /// The method is responsible for all main user-program interactions
        ///  and calls on the method for each user option.
        /// </summary>
        private void MainMenu()
        {
            //ScreenPrints method associated with the Main Menu screen display
            ScreenPrints.MainMenuPrint();

            //This try-catch was created to filter the System.Format Exception
            //However, it was kept generic to look out for an untested Exception
            //or one that wasn't forseen to happen.
            try
            {
                input = Convert.ToInt32(Console.ReadLine());
            }
            catch (Exception)
            {
                Console.WriteLine("\n\t\t\t   >> Invalid input <<\n");
                MainMenu();
            }

            //Do-while cycle that stops a break of the choice cycle, which would
            //end the program abruptly.
            //The switch-case receives the user option input and calls on each
            //option.
            do
            {
                switch (input)
                {
                case 1:
                    Console.Write("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
                    TitleSearch();
                    break;

                case 2:
                    Console.Write("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
                    PersonSearch();
                    break;

                case 3:
                    Console.Write("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
                    Credits();
                    break;

                case 4:
                    Console.Write("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
                    Console.WriteLine("\t\t\t You have exited the program.");
                    Quit();
                    break;

                default:
                    Console.WriteLine("\t\t\t   >> Invalid input <<\n");
                    MainMenu();
                    break;
                }
            } while (input <= 0 || input >= 5);
        }
示例#6
0
        /// <summary>
        /// Method that receives an input in order to keep on traveling through
        /// the program and doing searches, or go back to the MainMenu method.
        /// </summary>
        private void OtherSearch()
        {
            //ScreenPrints method associated with the OtherSearch screen display
            ScreenPrints.OtherSearch();

            //This try-catch was created to filter the System.Format Exception
            //However, it was kept generic to look out for an untested Exception
            //or one that wasn't forseen to happen.
            try
            {
                input = Convert.ToInt32(Console.ReadLine());
            }
            catch (Exception)
            {
                Console.WriteLine("\n\t\t\t   >> Invalid input <<\n");
                OtherSearch();
            }


            //Do-while cycle to keep on asking for these options until there's a
            //cycle break.
            do
            {
                switch (input)
                {
                case 1:
                    Console.Write("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
                    MainMenu();
                    break;

                case 2:
                    Console.Write("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
                    TitleSearch();
                    break;

                case 3:
                    Console.Write("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
                    PersonSearch();

                    break;

                default:
                    Console.WriteLine("\t\t\t   >> Invalid input <<\n");
                    OtherSearch();
                    break;
                }
            } while (input <= 0 || input >= 4);
        }
        /// <summary>
        /// This method allows us to set each line's information into titles
        /// </summary>
        public void SetResults()
        {
            // debug delete later
            Console.WriteLine(SearchedType);
            Console.WriteLine(SearchedWord);
            Console.WriteLine(SearchedStartYear);
            Console.WriteLine(SearchedIfAdult);
            Console.WriteLine(SearchedEndYear);
            if (SearchedGenres != null)
            {
                foreach (string genre in SearchedGenres)
                {
                    Console.WriteLine(genre);
                }
            }
            Console.WriteLine(SearchedRating);


            // this IEnumerable lets us find titles by the given parametes
            IEnumerable <Title> findTitles = new List <Title>();

            // checks if searched word is valid and filters
            if (SearchedWord != "N/A")
            {
                findTitles =
                    (from title in TitlesInFile
                     where (title.TitleName).ToLower()
                     .Contains(SearchedWord.ToLower())
                     select title);
            }

            // checks if searched type is valid and filters
            if (SearchedType != "N/A")
            {
                findTitles =
                    (from title in findTitles
                     where (title.Type).ToLower().Contains(SearchedType.ToLower())
                     select title);
            }

            // checks if searched start year is valid and filters
            if (SearchedStartYear != "N/A")
            {
                findTitles =
                    (from title in findTitles
                     where (title.StartYear.ToLower()
                            .Equals(SearchedStartYear.ToLower()))
                     select title);
            }
            // checks if searched end year is valid and filters
            if (SearchedEndYear != "N/A")
            {
                findTitles =
                    (from title in findTitles
                     where (title.EndYear.ToLower()
                            .Equals(SearchedEndYear.ToLower()))
                     select title);
            }

            // checks if adult is valid and filters
            if (SearchedIfAdult != "N/A")
            {
                findTitles =
                    (from title in findTitles
                     where (title.Adult).ToLower().
                     Contains(SearchedIfAdult.ToLower())
                     select title);
            }

            // checks genres to see if any is valid and filters
            if (SearchedGenres != null)
            {
                foreach (string genre in SearchedGenres)
                {
                    if (genre != "N/A")
                    {
                        findTitles =
                            (from title in findTitles
                             where (title.Genres.Contains(genre))
                             select title);
                    }
                }
            }

            // checks ratings and filters
            if (SearchedRating != "N/A")
            {
                findTitles =
                    (from title in findTitles
                     where (title.Rating).Equals(SearchedRating.ToLower())
                     select title);
            }

            // set organized titles to list
            OrganizedTitles = findTitles.ToList();

            OrganizedTitles[1].WriteInfo();

            for (int i = 0; i < 30; i++)
            {
                (OrganizedTitles)[i + 1].WriteInfo();
            }

            // remove duplicates from the list
            OrganizedTitles = OrganizedTitles.GroupBy(s => s)
                              .Where(g => g.Count() > 0)
                              .Select(g => g.Key).ToList();

            // send to sort and print
            ResultsSorters.ResultSetter(OrganizedTitles);
            ScreenPrints.SortResults(OrganizedTitles);

            // clear titles in file list for memory saving
            TitlesInFile.Clear();
        }