Exemple #1
0
        private void PickedASDB()
        {
            List <string>  countryNames = new List <string>();
            List <Country> countries    = new List <Country>();
            string         input;
            bool           validInput = false;
            AsiaDB         nadb       = new AsiaDB();

            countries = nadb.Countries;
            foreach (Country item in countries)
            {
                countryNames.Add(item.Name);
            }
            do
            {
                input = CountrySelectionView.SelectCountry(countryNames);
                if (countryNames.Contains(input))
                {
                    foreach (Country item in countries)
                    {
                        if (item.Name == input)
                        {
                            CountrySelectionView.Detail(item);
                            validInput = true;
                        }
                    }
                }
                else
                {
                    validInput = false;
                    ValidationViewer.NotValidInput();
                }
            } while (validInput == false);
        }
Exemple #2
0
        public void CountryMenu()
        {
            bool validInput;

            do
            {
                do
                {
                    string input = ContinentSelectionView.SelectContinet();
                    if (input.ToLower() == "north america")
                    {
                        PickedNADB();
                        validInput = true;
                    }
                    else if (input.ToLower() == "asia")
                    {
                        PickedASDB();
                        validInput = true;
                    }
                    else
                    {
                        validInput = false;
                        ValidationViewer.NotValidInput();
                    }
                } while (validInput == false);
                do
                {
                    if (Char.TryParse(ValidationViewer.YorN(), out char yOrN))
                    {
                        ;
                    }
                    {
                        if (yOrN == 'y')
                        {
                            //breaks out of inner loop and replays outer loop
                            validInput = false;
                            break;
                        }
                        else if (yOrN == 'n')
                        {
                            //breaks out of inner loop and ends outer loop
                            validInput = true;
                            break;
                        }
                        else
                        {
                            //replays inner loop
                            validInput = false;
                            ValidationViewer.NotValidInput();
                        }
                    }
                } while (validInput == false);
            } while (validInput == false);
        }