Beispiel #1
0
        public static void ModifyMenu(int i, OrderService os, ref bool flag)
        {
            try
            {
                bool     flag_order = true;
                string[] str;
                switch (i)
                {
                case 1:
                    os.DisplayGoodses();
                    Console.WriteLine("请输入要修改的货物及其信息:(序号 名称 价格)");
                    str = Console.ReadLine().Split(' ', 3);
                    Int32.TryParse(str[0], out int num_goods);
                    float.TryParse(str[2], out float price);
                    os.ModifyGoods(num_goods, str[1], price);
                    break;

                case 2:
                    os.DisplayCustomers();
                    Console.WriteLine("请输入要修改的客户及其信息:(序号 姓名 地址)");
                    str = Console.ReadLine().Split(' ', 3);
                    Int32.TryParse(str[0], out int num_customer);
                    os.ModifyCustomer(num_customer, str[1], str[2]);
                    break;

                case 3:
                    while (flag_order)
                    {
                        os.DisplayOrders();
                        Console.WriteLine("请输入要修改的订单序号");
                        Int32.TryParse(Console.ReadLine(), out int num_order);
                        ModifyOrderMenu(num_order, os, ref flag_order);
                    }
                    break;

                case 0:
                    flag = false;
                    break;

                default:
                    Console.WriteLine("菜单中无此项");
                    break;
                }
            }
            catch (Exception e)
            {
                Console.WriteLine($"错误:{e.Message}");
            }
        }