예제 #1
0
        public static void AddOrder()
        {
            string clientName   = null;
            int    productNum   = 0;
            string productName  = null;
            float  productPrice = 0;

            while (true)
            {
                try
                {
                    Console.WriteLine();
                    Console.WriteLine();
                    Console.WriteLine("**************************添加订单**************************");
                    Console.WriteLine("             1.继续                      2.返回主页");
                    int choose = 0;
                    Choose(ref choose, 1, 2);
                    if (choose == 2)
                    {
                        return;                //返回主页
                    }
                    else
                    {
                        Console.Write("请输入客户名称:");
                        clientName = Console.ReadLine();
                        Order tmp = new Order(clientName);
                        while (true)
                        {
                            Console.WriteLine("---------添加商品---------");
                            Console.Write("请输入商品名称:");
                            productName = Console.ReadLine();
                            Console.Write("请输入商品数量:");
                            productNum = int.Parse(Console.ReadLine());
                            Console.Write("请输入商品单价:");
                            productPrice = float.Parse(Console.ReadLine());
                            if (tmp.AddOrderDetails(productNum, productName, productPrice))
                            {
                                Console.WriteLine("添加商品成功!");
                            }
                            Console.Write("是否继续添加商品(1:继续;0:返回添加订单页面):");
                            int flag = 0;
                            Choose(ref flag, 0, 1);
                            if (flag == 0)
                            {
                                break;
                            }
                            else if (flag != 1)
                            {
                                Console.WriteLine();
                                Console.WriteLine();
                                Console.WriteLine("输入错误,退出当前");
                                break;
                            }
                        }
                        if (OrderService.AddOrder(tmp))
                        {
                            Console.WriteLine();
                            Console.WriteLine();
                            Console.WriteLine("添加订单成功!");
                        }
                    }
                }
                catch (Exception e)
                {
                    Console.WriteLine(e.Message);
                    Console.WriteLine("失败,请重试!");
                }
            }
        }
예제 #2
0
        public static void FindOrder()
        {
            while (true)
            {
                try
                {
                    Console.WriteLine();
                    Console.WriteLine();
                    Console.WriteLine("**************************查找订单**************************");
                    Console.WriteLine("1.根据流水号查找               2.查找某天对应所有订单");
                    Console.WriteLine("3.根据客户名查找对应所有订单   4.根据商品名称查找对应所有订单");
                    Console.WriteLine("5.返回主页");
                    int choose = 0;
                    Choose(ref choose, 1, 5);
                    int num = 0;           //通过其他方式查找的判断num,代表个数


                    switch (choose)
                    {
                    case 1:
                        int flag = -1;           //通过流水号查找的判断falg,-1无,其他值则表示位置
                        Console.Write("请输入流水号(格式:2018-1-1-1):");
                        flag = OrderService.FindOrder(Console.ReadLine());
                        if (flag == -1)
                        {
                            Console.WriteLine();
                            Console.WriteLine();
                            Console.WriteLine("未查找到!");
                        }
                        else
                        {
                            Console.WriteLine();
                            Console.WriteLine();
                            Console.WriteLine("共查找到1单!");
                        }
                        break;

                    case 2:
                        Console.Write("请输入日期(格式:20180101):");
                        num = OrderService.FindOrder(DateTime.ParseExact(Console.ReadLine(), "yyyyMMdd", System.Globalization.CultureInfo.CurrentCulture));
                        break;

                    case 3:
                        Console.Write("请输入客户名称:");
                        num = OrderService.FindOrderByClientName(Console.ReadLine());
                        break;

                    case 4:
                        Console.Write("请输入商品名称:");
                        num = OrderService.FindOrderByProductName(Console.ReadLine());
                        break;

                    case 5:
                        return;              //返回主页
                    }
                    if (choose != 1 && num > 0)
                    {
                        Console.WriteLine();
                        Console.WriteLine();
                        Console.WriteLine("共查找到{0}单!", num);
                    }
                    else if (choose != 1 && num == 0)
                    {
                        Console.WriteLine();
                        Console.WriteLine();
                        Console.WriteLine("未查找到!");
                    }
                }
                catch (Exception e)
                {
                    Console.WriteLine();
                    Console.WriteLine();
                    Console.WriteLine(e.Message);
                    Console.WriteLine("失败,请重试!");
                }
            }
        }
예제 #3
0
 public static void ChangeOrder()
 {
     while (true)
     {
         try
         {
             Console.WriteLine();
             Console.WriteLine();
             Console.WriteLine("**************************修改订单**************************");
             Console.WriteLine("     1.通过流水号定位到订单               2.返回主页");
             int choose = 0;
             Choose(ref choose, 1, 2);
             if (choose == 1)
             {
                 int flag = -1;                                     //通过流水号查找的判断falg,-1无,其他值则表示位置
                 Console.Write("请输入流水号(格式:2018-1-1-1):");
                 flag = OrderService.FindOrder(Console.ReadLine()); //通过流水号查找的判断falg
                 if (flag != -1)                                    //查找到
                 {
                     while (true)
                     {
                         Console.WriteLine();
                         Console.WriteLine();
                         Console.WriteLine("----------------订单如上,选择要修改的内容--------------");
                         Console.WriteLine("       1.客户名称         2.商品         3.返回修改订单页   ");
                         int choice = 1;
                         Choose(ref choice, 1, 3);
                         bool success = false;
                         if (choice == 1)
                         {
                             Console.Write("请输入新的客户名称:");
                             string clientName = Console.ReadLine();
                             OrderService.ChangeOrderClientName(flag, clientName);
                             success = true;
                         }
                         if (choice == 2)       //修改商品
                         {
                             while (true)
                             {
                                 try
                                 {
                                     Console.Write("-------请输入商品编号(从上到下,从1开始编号):");
                                     int num = int.Parse(Console.ReadLine()) - 1;
                                     Console.WriteLine();
                                     Console.WriteLine();
                                     Console.WriteLine("----------------选择修改商品的哪个属性----------------");
                                     Console.WriteLine("1.商品名称2.商品价格3.商品价格4.返回选择要修改的内容页 ");
                                     int which = 0;
                                     Choose(ref which, 1, 4);
                                     if (which == 1)
                                     {
                                         Console.Write("请输入商品新名称:");
                                         string productName = Console.ReadLine();
                                         success = OrderService.ChangeOrderProduct(flag, num, productName);
                                     }
                                     if (which == 2)
                                     {
                                         Console.Write("请输入商品新单价:");
                                         float productPrice = float.Parse(Console.ReadLine());
                                         success = OrderService.ChangeOrderProduct(flag, num, productPrice);
                                     }
                                     if (which == 3)
                                     {
                                         Console.Write("请输入商品新数目:");
                                         int productNum = int.Parse(Console.ReadLine());
                                         success = OrderService.ChangeOrderProductNum(flag, num, productNum);
                                     }
                                     else
                                     {
                                         break;
                                     }
                                     if (success)
                                     {
                                         Console.WriteLine();
                                         Console.WriteLine();
                                         Console.Write("修改成功!");
                                     }
                                     else
                                     {
                                         Console.WriteLine();
                                         Console.WriteLine();
                                         Console.Write("修改失败!");
                                     }
                                 }
                                 catch (Exception e)
                                 {
                                     Console.WriteLine();
                                     Console.WriteLine();
                                     Console.WriteLine(e.Message);
                                     Console.WriteLine("失败,请重试!");
                                 }
                             }
                         }
                         if (choice == 3)
                         {
                             break;
                         }
                         if (success)
                         {
                             Console.WriteLine();
                             Console.WriteLine();
                             Console.Write("修改成功!");
                         }
                         else
                         {
                             Console.WriteLine();
                             Console.WriteLine();
                             Console.Write("修改失败!");
                         }
                     }
                 }
                 else
                 {
                     Console.WriteLine();
                     Console.WriteLine();
                     Console.WriteLine("无此订单!");
                 }
             }
             if (choose == 2)
             {
                 return;          //返回主页
             }
         }
         catch (Exception e)
         {
             Console.WriteLine();
             Console.WriteLine();
             Console.WriteLine(e.Message);
             Console.WriteLine("失败,请重试!");
         }
     }
 }
예제 #4
0
 public void ListAddWay(OrderService n)
 {
     date.Add(n);
 }
예제 #5
0
        public static void DeleteOrder()
        {
            while (true)
            {
                try
                {
                    Console.WriteLine();
                    Console.WriteLine();
                    Console.WriteLine("**************************删除订单**************************");
                    Console.WriteLine("1.根据流水号删除               2.删除某天对应所有订单");
                    Console.WriteLine("3.根据客户名删除对应所有订单   4.根据商品名称删除对应所有订单");
                    Console.WriteLine("5.返回主页");
                    int choose = 0;
                    Choose(ref choose, 1, 5);
                    bool haveDeleted = true;
                    switch (choose)
                    {
                    case 1:
                        Console.Write("请输入流水号(格式:2018-1-1-1):");
                        haveDeleted = OrderService.DeleteOrder(Console.ReadLine());
                        break;

                    case 2:
                        Console.Write("请输入日期(格式:20180101):");
                        haveDeleted = OrderService.DeleteOrder(DateTime.ParseExact(Console.ReadLine(), "yyyyMMdd", System.Globalization.CultureInfo.CurrentCulture));
                        break;

                    case 3:
                        Console.Write("请输入客户名称:");
                        haveDeleted = OrderService.DeleteOrderByClientName(Console.ReadLine());
                        break;

                    case 4:
                        Console.Write("请输入商品名称:");
                        haveDeleted = OrderService.DeleteOrderByProductName(Console.ReadLine());
                        break;

                    case 5:
                        return;              //返回主页
                    }
                    if (haveDeleted)
                    {
                        Console.WriteLine();
                        Console.WriteLine();
                        Console.WriteLine("删除成功!");
                    }
                    else
                    {
                        Console.WriteLine();
                        Console.WriteLine();
                        Console.WriteLine("删除失败!");
                    }
                }
                catch (Exception e)
                {
                    Console.WriteLine();
                    Console.WriteLine();
                    Console.WriteLine(e.Message);
                    Console.WriteLine("失败,请重试!");
                }
            }
        }
예제 #6
0
        static void Main(string[] args)
        {
            OrderService orderService = new OrderService();

            Console.WriteLine("欢迎来到订单管理系统\n");
            while (true)
            {
                Console.WriteLine("您有五个选择:\n");
                Console.WriteLine("1、添加订单\n" +
                                  "2、通过订单号删除订单\n" +
                                  "3、通过订单号查询订单\n" +
                                  "4、通过订单号更改订单\n" +
                                  "5、通过商品名查询订单\n" +
                                  "6、通过客户名查询订单\n" +
                                  "7、查询总金额超过一万的订单\n" +
                                  "8、保存所有数据到本地\n" +
                                  "9、导入所有数据到系统\n" +
                                  "10、退出系统\n" +
                                  "请输入您的选择:");
                string str = Console.ReadLine();
                int    choice;
                if (!Int32.TryParse(str, out choice))
                {
                    Console.WriteLine("输入格式错误请重新输入");
                }
                if (choice == 1)
                {
                    Order order = CreateOrder();
                    orderService.AddOrder(order);
                }
                else if (choice == 2)
                {
                    int id = StringToIntId();
                    orderService.DeleteOrderById(id);
                }
                else if (choice == 4)
                {
                    int   id    = StringToIntId();
                    Order order = CreateOrder();
                    orderService.updateOrderById(id, order);
                }
                else if (choice == 3)
                {
                    int id = StringToIntId();
                    orderService.FindOrderById(id);
                }
                else if (choice == 5)
                {
                    Console.WriteLine("请输入商品名称:");
                    str = Console.ReadLine();
                    orderService.FindOrderByStuff(str);
                }
                else if (choice == 6)
                {
                    Console.WriteLine("请输入客户名:");
                    str = Console.ReadLine();
                    orderService.FindByClientName(str);
                }
                else if (choice == 7)
                {
                    orderService.FindBigTrade();
                }
                else if (choice == 8)
                {
                    orderService.Export();
                }
                else if (choice == 9)
                {
                    orderService.Import();
                }
                else
                {
                    break;
                }
            }
        }
예제 #7
0
        static void Main(string[] args)
        {
            OrderService order = new OrderService();

            order.CreatOrder();
        }
예제 #8
0
        static void Main(string[] args)
        {
            OrderService orderService = new OrderService();
            int          flag         = 0;
            String       fileName     = @"D:\学习资料\大二上\C#\orders.xml";

            while (true)
            {
                Console.WriteLine("请选择需要执行的操作(输入选项前的数字):");
                Console.WriteLine("1.从xml文件导入订单列表");
                Console.WriteLine("2.添加新订单");
                Console.WriteLine("3.删除订单");
                Console.WriteLine("4.查询订单");
                Console.WriteLine("5.修改订单");
                Console.WriteLine("6.查看订单列表");
                Console.WriteLine("7.将订单导出为xml文件并退出");
                try
                {
                    flag = Int32.Parse(Console.ReadLine());
                    if (flag < 1 || flag > 7)
                    {
                        throw new OrderException();
                    }
                    else
                    {
                        switch (flag)
                        {
                        case 1:
                            orderService.Import(fileName);
                            break;

                        case 2:
                            try
                            {
                                Console.WriteLine("请输入订单号:");
                                String ID = Console.ReadLine();
                                Console.WriteLine("请输入商品名:");
                                String productName = Console.ReadLine();
                                Console.WriteLine("请输入客户名:");
                                String clientName = Console.ReadLine();
                                Console.WriteLine("请输入客户电话号码:");
                                String clientPhone = Console.ReadLine();
                                Console.WriteLine("请输入订单金额:");
                                long  money    = long.Parse(Console.ReadLine());
                                Order newOrder = new Order(ID, productName, clientName, clientPhone, money);
                                orderService.AddOrder(newOrder);
                                Console.WriteLine("操作后订单列表:");
                                orderService.DisplayOrderList();
                            }
                            catch (Exception e)
                            {
                                Console.WriteLine(e.Message);
                            }
                            break;

                        case 3:
                            try
                            {
                                Console.WriteLine("请输入要删除的订单的订单号:");
                                String ID = Console.ReadLine();
                                orderService.DeleteOrder(ID);
                                Console.WriteLine("操作后订单列表:");
                                orderService.DisplayOrderList();
                            }
                            catch (Exception e)
                            {
                                Console.WriteLine(e.Message);
                            }
                            break;

                        case 4:
                            int flag1 = 0;
                            Console.WriteLine("请选择查询订单的依据(输入选项前的数字):");
                            Console.WriteLine("1.订单号");
                            Console.WriteLine("2.商品名");
                            Console.WriteLine("3.客户名");
                            Console.WriteLine("4.查询订单金额大于某个值的订单");
                            try
                            {
                                flag1 = Int32.Parse(Console.ReadLine());             //若输入不是数字则抛出异常
                                if (flag1 < 1 || flag1 > 4)
                                {
                                    throw new OrderException();                     //若输入不在1到3之内则抛出异常
                                }
                                orderService.Search(flag1);
                                break;
                            }
                            catch (Exception e)
                            {
                                Console.WriteLine(e.Message);
                            }
                            break;

                        case 5:
                            orderService.ReviseOrder(); break;

                        case 6:
                            orderService.DisplayOrderList(); break;

                        case 7:
                            orderService.Export(fileName);
                            return;
                        }
                    }
                }
                catch (Exception)
                {
                    Console.WriteLine("错误!输入有误");
                }
            }
        }
예제 #9
0
        static void Func(OrderService orderService)
        {
            Console.WriteLine("添加订单请输入:1");
            Console.WriteLine("删除订单请输入:2");
            Console.WriteLine("查询订单请输入:3");
            Console.WriteLine("修改订单请输入:4");
            try
            {
                int request = Convert.ToInt32(Console.ReadLine());
                switch (request)
                {
                case 1:
                {
                    Console.WriteLine("请输入姓名:");
                    string customer = Console.ReadLine();
                    Console.WriteLine("请输入商品名称:");
                    Goods goods = new Goods(Console.ReadLine());
                    Console.WriteLine("请输入购买商品的数目(整数):");
                    int   count = Convert.ToInt32(Console.ReadLine());
                    Order order = new Order(customer, goods, count);
                    orderService.AddOrder(order);
                    break;
                }

                case 2:
                {
                    Console.WriteLine("请输入要删除的订单号:");
                    Order order = orderService.QueryOrderByNumber(Convert.ToInt32(Console.ReadLine()));
                    orderService.DeleteOrder(order);
                    break;
                }

                case 3:
                {
                    Console.WriteLine("按姓名查询请输入:1");
                    Console.WriteLine("按商品查询请输入:2");
                    Console.WriteLine("按订单号查询请输入:3");
                    int i = Convert.ToInt32(Console.ReadLine());
                    switch (i)
                    {
                    case 1:
                    {
                        Console.WriteLine("请输入姓名:");
                        orderService.QueryOrderByCustomer(Console.ReadLine());
                        break;
                    }

                    case 2:
                    {
                        Console.WriteLine("请输入商品:");
                        orderService.QueryOrderByGoods(Console.ReadLine());
                        break;
                    }

                    case 3:
                    {
                        Console.WriteLine("请输入订单号:");
                        orderService.QueryOrderByNumber(Convert.ToInt32(Console.ReadLine()));
                        break;
                    }
                    }
                    break;
                }

                case 4:
                {
                    Console.WriteLine("请输入要修改的订单号:");
                    Order order = orderService.QueryOrderByNumber(Convert.ToInt32(Console.ReadLine()));
                    Console.WriteLine("单修改商品种类请输入:1");
                    Console.WriteLine("单修改商品数量请输入:2");
                    Console.WriteLine("都要修改请输入:3");
                    int i = Convert.ToInt32(Console.ReadLine());
                    switch (i)
                    {
                    case 1:
                        Console.WriteLine("请输入要修改为的商品种类:");
                        orderService.ModifyOrder(order, Console.ReadLine());
                        break;

                    case 2:
                        Console.WriteLine("请输入要修改为的商品数目:");
                        orderService.ModifyOrder(order, Convert.ToInt32(Console.ReadLine()));
                        break;

                    case 3:
                        Console.WriteLine("请输入要修改为的商品种类:");
                        string goods = Console.ReadLine();
                        Console.WriteLine("请输入要修改为的商品数目:");
                        orderService.ModifyOrder(order, goods, Convert.ToInt32(Console.ReadLine()));
                        break;
                    }
                    break;
                }
                }
            }
            catch
            {
                Console.WriteLine("你的输入有误,即将返回程序初始状态!");
                Func(orderService);
            }
            Func(orderService);
        }
예제 #10
0
        public static void Main()
        {
            try
            {
                Customer customer1 = new Customer(1, "Customer1");
                Customer customer2 = new Customer(2, "Customer2");

                Goods milk  = new Goods(1, "Milk", 69.9);
                Goods eggs  = new Goods(2, "eggs", 4.99);
                Goods apple = new Goods(3, "apple", 5.59);

                OrderDetail orderDetails1 = new OrderDetail(1, apple, 8);
                OrderDetail orderDetails2 = new OrderDetail(2, eggs, 2);
                OrderDetail orderDetails3 = new OrderDetail(3, milk, 1);

                Order order1 = new Order(1, customer1);
                Order order2 = new Order(2, customer2);
                Order order3 = new Order(3, customer2);
                order1.AddDetails(orderDetails1);
                order1.AddDetails(orderDetails2);
                order1.AddDetails(orderDetails3);
                //order1.AddOrderDetails(orderDetails3);
                order2.AddDetails(orderDetails2);
                order2.AddDetails(orderDetails3);
                order3.AddDetails(orderDetails3);

                OrderService os = new OrderService();
                os.AddOrder(order1);
                os.AddOrder(order2);
                os.AddOrder(order3);

                Console.WriteLine("GetAllOrders");
                List <Order> orders = os.QueryAllOrders();
                foreach (Order od in orders)
                {
                    Console.WriteLine(od.ToString());
                }

                Console.WriteLine("GetOrdersByCustomerName:'Customer2'");
                orders = os.QueryByCustomerName("Customer2");
                foreach (Order od in orders)
                {
                    Console.WriteLine(od.ToString());
                }

                Console.WriteLine("GetOrdersByGoodsName:'apple'");
                orders = os.QueryByGoodsName("apple");
                foreach (Order od in orders)
                {
                    Console.WriteLine(od.ToString());
                }

                Console.WriteLine("Remove order(id=2) and qurey all");
                os.RemoveOrder(2);
                os.QueryAllOrders().ForEach(
                    od => Console.WriteLine(od));
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
        }
예제 #11
0
        static void Main(string[] args)
        {
            Order        O1        = new Order("张三", 1, 3, 3, 3);
            Order        O2        = new Order("李四", 2, 4, 4, 4);
            List <Order> orderlist = new List <Order>();

            orderlist.Add(O1);
            orderlist.Add(O2);
            Console.WriteLine("输入进行的操作:1显示所有订单 2添加订单 3删除订单 4查询 5修改订单 6查询金额大于10000的订单 7@  ");
            string sss = Console.ReadLine();

            while (sss != "@")
            {
                int operationNum = int.Parse(sss);
                switch (operationNum)
                {
                case 1:           //利用foreach将所有的订单输出
                    OrderService order11 = new OrderService();
                    foreach (Order i in orderlist)
                    {
                        order11.PrintOrder(i);
                    }
                    break;

                case 2:             //添加订单
                    OrderService order1 = new OrderService();
                    order1.AddOrder();
                    orderlist.Add(order1.list[0]);
                    break;

                case 3:
                    OrderService order2 = new OrderService();
                    order2.list = orderlist;
                    try
                    {
                        Console.WriteLine("输入删除订单号:");
                        int   Searchnum3 = Convert.ToInt32(Console.ReadLine());
                        Order o32        = order2.SearchOrderNum(Searchnum3);
                        order2.deleteOrderNum(o32.Number);
                    }
                    catch (Exception e)
                    {
                        Console.WriteLine("失败了" + e.Message);
                    }
                    break;

                case 4:
                    OrderService order4 = new OrderService();
                    order4.list = orderlist;
                    Console.WriteLine("1客户名称 2订单号");
                    int qq = int.Parse(Console.ReadLine());
                    switch (qq)
                    {
                    case 1:
                        Console.WriteLine("输入:");
                        string SearchName = Console.ReadLine();
                        Order  o41        = order4.SearchOrderName(SearchName);
                        order4.PrintOrder(o41);
                        break;

                    case 2:
                        Console.WriteLine("输入:");
                        int   Searchnum = Convert.ToInt32(Console.ReadLine());
                        Order o2        = order4.SearchOrderNum(Searchnum);
                        order4.PrintOrder(o2);
                        break;
                    }
                    break;

                case 5:
                    OrderService order3 = new OrderService();
                    order3.list = orderlist;
                    Console.WriteLine("1修改客户名称 2修改订单号");
                    int qqq = int.Parse(Console.ReadLine());
                    switch (qqq)
                    {
                    case 1:
                        Console.WriteLine("输入原来的名字:");
                        string SearchName1 = Convert.ToString(Console.ReadLine());
                        Console.WriteLine("输入现在的名字:");
                        string SearchName2 = Convert.ToString(Console.ReadLine());
                        Order  o1          = order3.SearchOrderName(SearchName1);
                        o1.ClientName = SearchName2;
                        break;

                    case 2:
                        Console.WriteLine("输入以前的订单号:");
                        int Searchnum = Convert.ToInt32(Console.ReadLine());
                        Console.WriteLine("输入现在的订单号:");
                        int   Searchnum2 = Convert.ToInt32(Console.ReadLine());
                        Order o2         = order3.SearchOrderNum(Searchnum);
                        o2.Number = Searchnum2;
                        break;
                    }
                    break;

                case 6:

                    OrderService order6 = new OrderService();
                    foreach (Order i in orderlist)
                    {
                        if (i.price > 10000)
                        {
                            order6.PrintOrder(i);
                        }
                    }
                    break;
                }
                Console.WriteLine("输入进行的操作:1显示所有订单 2添加订单 3删除订单 4查询 5修改订单 6查询金额大于10000的订单 7@ ");
                sss = Console.ReadLine();
            }
            Environment.Exit(0);
        }
예제 #12
0
        static void Main(string[] args)
        {
            OrderService store = new OrderService();

            store.AddOrder();
            //添加商品
            store.AddGood("apple", 10, 0);
            store.AddGood("banana", 10, 0);
            store.AddGood("ipone", 10, 0);
            store.AddGood("car", 1000, 0);
            store.AddGood("water", 10, 0);
            ////打印出所有商品
            store.ShowOrderService();
            Console.WriteLine("");
            //设置商品的价格
            int price = 20;

            foreach (OrderDetails good in store.GrtOrder(0).GetList())
            {
                good.Price = price;
                price      = price + 10;
            }
            //用Linq语言进行选择
            //根据商品的名字
            { string name = Console.ReadLine();
              var    n    = from m in store.GrtOrder(0).GetList()
                            where m.Name == name
                            select m;
              foreach (var item in n)
              {
                  item.ShowGood();
              }
            }
            //用Linq语言进行选择
            //根据商品的序号
            {
                int number = Convert.ToInt32(Console.ReadLine());
                var n1     = from m1 in store.GrtOrder(0).GetList()
                             where m1.ListNumber == number
                             select m1;
                foreach (var item in n1)
                {
                    item.ShowGood();
                }
            }
            //用Linq语言进行选择
            //选出金额大于1w的商品

            {
                var n2 = from m2 in store.GrtOrder(0).GetList()
                         where m2.Number * m2.Price > 1000
                         select m2;
                foreach (var item in n2)
                {
                    Console.WriteLine("交易量大于10000商品");
                    item.ShowGood();
                }
            }


            Console.ReadLine();
            ////删除一种商品
            //store.DeleteGoodByGoodName("car", 0);
            //store.ShowOrderService();
            ////修改商品的名字
            //store.ChangeGoodDetailsName("apple", "changeApple", 0);
            //store.ShowOrderService();
            ////修改商品的数量
            //store.ChangeGoodDetailsNumber("changeApple", 10000, 0);
            //store.ShowOrderService();
            ////搜索某种商品——通过商品的名字
            //store.SortGood("water");
            ////搜索某种商品——通过商品的序号
            //store.SortGood(1, 0);
            ////错误检测——改变商品数据
            //store.ChangeGoodDetailsName("aaa", "bbb", 1);
            ////错误检测——寻找商品
            //store.SortGood("aaa");
            //store.SortGood(6, 0);
            ////错误检测——删除商品
            //store.DeleteGoodByGoodName("aaaa", 0);
            //store.DeleteGoodByGoodNumber(6, 0);
            ////删除订单
            //store.DeleteOrder(0);
            //store.ShowOrderService();
        }