Пример #1
0
        public override void Select()
        {
            Console.Clear();

            Console.Write("Username: "******"Password: "******"\nYou are now logged in", ConsoleColor.Green);
                Console.WriteLine("Press any key to continue");
                Console.ReadKey();

                new User(username[0], debug);

                if (User.NumberOfMoviesRated < 10 && !coldstart)
                {
                    ColdStart coldStartMenu = new ColdStart($"Cold Start - you have rated {User.NumberOfMoviesRated} out of 10 movies");
                    coldStartMenu.Select();
                }
                else
                {
                    Menu loggedInMenu = new Startmenu($"Welcome {User.Username}!");
                    loggedInMenu.Start();
                }
            }
            else
            {
                PrintStringColored("\nWrong password or username", ConsoleColor.Red);
                Console.ReadKey();
            }
        }
        private void FindUnratedMovies(int numberOfMovies)
        {
            if (FirstStart)
            {
                List <int> rateMoviesNumbers   = new List <int>();
                int        totalNumberOfMovies = MySqlCommands.NumberOfRowsInTable("imdbdata");

                rateMoviesNumbers.Clear();
                rateMoviesNumbers.AddRange(GenerateRandomNumber(totalNumberOfMovies, numberOfMovies, UsedNumbers));
                List <MovieMenuItem> moviesColdStart = MySqlCommands.FindMovieFromId(rateMoviesNumbers);

                foreach (var movieMenuItem in moviesColdStart)
                {
                    AddMenuItem(movieMenuItem);
                }

                ColdStart nextPage = new ColdStart($"--- Page {UsedNumbers.Count / 10 + 1} ---", UsedNumbers);
                AddMenuItem(nextPage);

                FirstStart = false;
            }

            Console.Clear();
        }