static void Main(string[] args) { OrderService ptem = new OrderService(); ptem.Export(); ptem.Import(); Console.WriteLine("初始订单为"); ptem.showlist(); Console.WriteLine("其中订单总金额超过10000的为:"); ptem.output(); Console.WriteLine("输入需要删除的订单号:"); int i = int.Parse(Console.ReadLine()); try { ptem.deleteorder(i); } catch (MyOrderException e) { Console.WriteLine(e.getInformation()); } Console.WriteLine("删除后为"); ptem.showlist(); Console.WriteLine("输入要查询的订单号"); i = int.Parse(Console.ReadLine()); try { ptem.finbyID(i); } catch (MyOrderException e) { Console.WriteLine(e.getInformation()); } Console.WriteLine("输入要查询的客户名:"); string pname = Console.ReadLine(); try { ptem.findbyname(pname); } catch (MyOrderException e) { Console.WriteLine(e.getInformation()); } Console.WriteLine("新增订单"); ptem.Addorder(); ptem.showlist(); Console.WriteLine("输入需要修改的订单号:"); i = int.Parse(Console.ReadLine()); Console.WriteLine("输入修改后的商品名:"); pname = Console.ReadLine(); Console.WriteLine("输入商品数目"); int s = int.Parse(Console.ReadLine()); Console.WriteLine("输入修改后的商品单价"); int p = int.Parse(Console.ReadLine()); OrderDetail x = new OrderDetail(pname, s, p); ptem.changeorders(i, x); ptem.showlist(); }
public void adddetail(OrderDetail p) { Corderds.Add(p); }