Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            OrderService orderService = new OrderService();

            Console.WriteLine("请输入用户姓名:");
            string name = Console.ReadLine();

            Client client = new Client(name);

            bool again = true;

            while (again)
            {
                Console.WriteLine("选择所用功能");
                Console.WriteLine("1.添加订单");
                Console.WriteLine("2.删除订单");
                Console.WriteLine("3.修改订单");
                Console.WriteLine("4.查询订单");
                Console.WriteLine("5.退出");

                string a = Console.ReadLine();
                switch (a)
                {
                case "1":
                    Console.WriteLine("请输入订单id:");
                    string id1 = Console.ReadLine();

                    Order order = new Order(id1, client);

                    order.AddOrderDetail();

                    orderService.AddOrder(order);
                    break;

                case "2":
                    Console.WriteLine("请输入订单id:");
                    string id2 = Console.ReadLine();

                    orderService.DeleteOrder(id2);
                    break;

                case "3":
                    Console.WriteLine("请输入订单id:");
                    string id3 = Console.ReadLine();

                    orderService.ChangeOrder(id3);
                    break;

                case "4":
                    Console.WriteLine("请输入订单id:");
                    string id4 = Console.ReadLine();

                    orderService.SeletOrder(id4);
                    break;

                case "5":
                    again = false;
                    break;

                default:
                    Console.WriteLine("无效的输入. 请选择1-5的数字");
                    break;
                }
            }
        }