コード例 #1
0
        static void CreateClass()
        {
            int    id;
            string idTry, name;

            while (true)
            {
                Console.WriteLine("Please Enter The Class ID: ");
                idTry = Console.ReadLine();
                try
                {
                    id = Int32.Parse(idTry);
                    if (icb.ClassIsExists(id))
                    {
                        Console.WriteLine("Create Error, ID is Exists!");
                    }
                    else
                    {
                        Console.WriteLine("Please Enter Name of Class: ");
                        name = Console.ReadLine();
                        icb.CreateClass(id, name);
                        Console.WriteLine("Create Class Successful!");
                    }
                    break;
                }
                catch (Exception e)
                {
                    Console.WriteLine("ID Must Be A Number! ");
                    continue;
                    throw;
                }
            }
        }