Ejemplo n.º 1
0
        public void TestMethod1()
        {
            List<DishItem> list = PersistData.DishItemObj.GetAllDishItem();

            Assert.AreNotEqual(list.Count, 0);

            Console.WriteLine("first dish" + list[0].Name);

            DataTable dt = RestaurantApp.RestaurantBiz.getDishItems();

            Console.WriteLine(dt.Rows.Count);

            TOrderData orderData = new TOrderData();

            orderData.Configure();

            long id = saveOrder1();

            TOrder order= orderData.GetOrderAndAllItems(id);

            Assert.AreNotEqual(order.Items.Count,0);

            Console.WriteLine(order.OrderTime);

            List<TOrderStatus> list1 =  orderData.GetAllOrderStatus();
            Console.WriteLine("List<TOrderStatus> count is " + list1.Count);

            List<TOrderType> list2 = orderData.GetAllOrderTypes();
            Console.WriteLine("List<TOrderType> count is " + list2.Count);
            /*
            orderData.ExportTables();

            try
            {
                StreamReader rd = File.OpenText(@"c:\orderTables.txt");
                while (!rd.EndOfStream)
                {
                   Console.WriteLine( rd.ReadLine());
                }

            }catch(Exception ex)
            {
                Assert.Fail("open file failed");
            }*/
        }
Ejemplo n.º 2
0
        public static void getOrderAndItems(long orderId, DataTable dtOrder)
        {
            TOrderData ob = new TOrderData();
            ob.Configure();

            TOrder order = ob.GetOrderAndAllItems(orderId);

            dtOrder.Rows.Clear();
            if (order != null)
            {
                for (int i = 0; i < order.Items.Count; i++)
                {

                    TOrderItem item = (TOrderItem)order.Items[i];
                    dtOrder.Rows.Add();
                    dtOrder.Rows[i][0] = item.DishId;
                    dtOrder.Rows[i][1] = item.DishName;
                    dtOrder.Rows[i][2] = Convert.ToInt32(item.Amount);
                    dtOrder.Rows[i][3] = item.SubPrice.ToString();
                    dtOrder.Rows[i][4] = item.Price.ToString();

                }

            }
        }