コード例 #1
0
        // Teacher login and start Work() after login correctly
        static void Login()
        {
            int    id;
            string idTry, passwd;
            bool   loop = true;

            while (loop)
            {
                while (true)
                {
                    Console.WriteLine(
                        "////////////////////////////////////////////////////////////////////////////////////" + "\n" +
                        "/*                Welcome to Hebut Student Management System                      */" + "\n" +
                        "/*                                                                                */" + "\n" +
                        "/*                                                                                */" + "\n" +
                        "/*                             Please Enter Your ID                               */" + "\n" +
                        "/*                                                                                */" + "\n" +
                        "////////////////////////////////////////////////////////////////////////////////////" + "\n");
                    idTry = Console.ReadLine();
                    try
                    {
                        id = Int32.Parse(idTry);
                        break;
                    }
                    catch (Exception e)
                    {
                        Console.WriteLine("Please enter a number !");
                        continue;
                        throw;
                    }
                }

                Console.WriteLine(
                    "////////////////////////////////////////////////////////////////////////////////////" + "\n" +
                    "/*                Welcome to Hebut Student Management System                      */" + "\n" +
                    "/*                                                                                */" + "\n" +
                    "/*                                                                                */" + "\n" +
                    "/*                         Please Enter Your Password                             */" + "\n" +
                    "/*                                                                                */" + "\n" +
                    "////////////////////////////////////////////////////////////////////////////////////" + "\n");

                passwd = Console.ReadLine();

                loop = !itb.TeacherLogin(id, passwd);

                if (loop)
                {
                    Console.WriteLine("ID error or password error");
                }
            }
            Work();
        }