コード例 #1
0
ファイル: Program.cs プロジェクト: RaphTaxi/NannyProject
        /// <summary>
        /// Create a child
        /// </summary>
        static void AddChild()
        {
            Child n = new Child();

            Console.WriteLine("\n=============================================================");
            Console.WriteLine("The new Child:");
            Console.WriteLine("=============================================================");
            Console.WriteLine(n);
            Console.WriteLine("=============================================================\n");

            Console.WriteLine("Do you want to change the mother ID? (y/n)");
            string key = Console.ReadLine();

            switch (key)
            {
            case "Y":
                Console.Write("Choose an other mother ID: ");
                n.MotherID = int.Parse(Console.ReadLine());
                break;

            case "y":
                Console.Write("Choose an other mother ID: ");
                n.MotherID = int.Parse(Console.ReadLine());
                break;

            default:
                break;
            }

            Console.WriteLine("=============================================================\n");

            try
            {
                bl.AddChild(n);
            }
            catch (Exception e)
            {
                Console.WriteLine("\n**************************************************************");
                Console.WriteLine(e.Message);
                Console.WriteLine("**************************************************************\n");
            }
        }