static void Main(string[] args) { OrderService a = new OrderService(); while (true) { int key; Console.WriteLine("1.添加订单 2.查询订单"); key = Convert.ToInt32(Console.ReadLine()); if (key == 1) { a.AddOrder(); } else if (key == 2) { int key2 = 0; Console.WriteLine("1.按ID查询 2.按商品查询 3.按客户查询 4.按支付金额查询"); key2 = Convert.ToInt32(Console.ReadLine()); switch (key2) { case 1: { Console.WriteLine("输入ID"); a.OrderById(Console.ReadLine()); } break; case 2: { Console.WriteLine("输入商品名称"); a.OrderByGoods(Console.ReadLine()); } break; case 3: { Console.WriteLine("输入客户"); a.OrderByCustomer(Console.ReadLine()); } break; case 4: { Console.WriteLine("输入支付金额"); a.OrderByMoney(Console.ReadLine()); } break; default: throw new ArgumentException("没有这个选项"); } } else { throw new ArgumentException("没有这个选项"); } } }