Beispiel #1
0
        private void CreateOrder()
        {
            String orderInitPara = io.GetString("input the client's name please");

            IEnumerable <String> orderItemPara;

            Order order = service.InitOrder(orderInitPara);

            if (io.checkContinue("do you want to add some items?(yes / no)"))
            {
                do
                {
                    try
                    {
                        orderItemPara = io.GetItemsPara();
                        List <OrderItem> items = new List <OrderItem>();
                        foreach (string itempara in orderItemPara)
                        {
                            string[] paras = itempara.Split(" ");
                            string   name  = "";
                            for (int i = 0; i <= paras.Length - 3; i++)
                            {
                                name += paras[i];

                                /*OrderItem item = new OrderItem(name,
                                 *  double.Parse(paras[paras.Length - 2]),
                                 *  int.Parse(paras[paras.Length - 1]));
                                 * items.Add(item);
                                 */
                            }
                        }
                        service.CompleOrder(order, items);
                    }
                    catch (Exception e)
                    {
                        io.Printf(e.Message);
                    }
                }while (io.checkContinue("continue to add items?(yes / no)"));
            }
        }