예제 #1
0
        private void LvTableInfo_DoubleClick(object sender, EventArgs e)
        {
            //获取被点的餐桌项
            ListView     lv1 = sender as ListView;
            ListViewItem lvi = lv1.SelectedItems[0];

            //获取餐桌编号
            int tableId = Convert.ToInt32(lv1.SelectedItems[0].Tag);

            OrderInfoBll oiBll = new OrderInfoBll();
            int          orderId;

            if (lvi.ImageIndex == 0)
            {
                //当前餐桌空闲需要开单
                //1.开单向OrderInfo中写入,同时更新餐桌状态
                //获得订单号存到items项的Tag属性中
                orderId = oiBll.CreaterOder(tableId);

                //2.更新餐桌的图标为占用
                lv1.SelectedItems[0].ImageIndex = 1;
            }
            else
            {
                //当前餐桌已经占用,则需要点菜
                orderId = oiBll.GetOrderIdByTableTid(tableId);
            }


            //2.打开点菜页面
            FormOrderDish formOrderDish = new FormOrderDish();

            formOrderDish.Tag = orderId;
            formOrderDish.ShowDialog();//模态打开
        }
예제 #2
0
        void lvTableInfo_DoubleClick(object sender, EventArgs e)
        {
            //获取被点的餐桌项
            var lv1 = sender as ListView;
            var lvi = lv1.SelectedItems[0];
            //获取餐桌编号
            int tableId = Convert.ToInt32(lvi.Tag);

            if (lvi.ImageIndex == 0)
            {
                //当前餐桌为空闲则开单
                //1、开单,向orderinfo表插入数据
                //2、修改餐桌状态为占用
                int orderId = oiBll.KaiDan(tableId);
                lvi.Tag = orderId;

                //3、更新项的图标为占用
                lv1.SelectedItems[0].ImageIndex = 1;
            }
            else
            {
                //当前餐桌已经占用,则进行点菜操作
                lvi.Tag = oiBll.GetOrderIdByTableId(tableId);
            }

            //4、打开点菜窗体
            FormOrderDish formOrderDish = new FormOrderDish();

            formOrderDish.Tag = lvi.Tag;
            formOrderDish.Show();
        }
예제 #3
0
        private void lvtableinfo_DoubleClick(object sender, EventArgs e)
        {
            //获得被点击的餐桌对象
            var lv  = sender as ListView;
            var lv1 = lv.SelectedItems[0];
            //获得餐桌的编号
            int tableid = Convert.ToInt32(lv1.Tag);//取到上面绑定的餐桌号码

            //判断餐桌是否空闲
            if (lv1.ImageIndex == 0)
            {
                //空闲状态
                //1 根据餐桌号来开单
                int orderid = oiBll.MakeOrder(tableid);
                lv1.Tag = orderid;
                //2 更改空闲图标为繁忙
                lv1.ImageIndex = 1;
            }
            else
            {
                //占用状态
                lv1.Tag = oiBll.GetOrderById(tableid);
            }

            //打开点菜窗体
            FormOrderDish fdi = new FormOrderDish();

            fdi.Tag = lv1.Tag;
            fdi.Show();
        }
예제 #4
0
        private void LvTableInfo_DoubleClick1(object sender, EventArgs e)
        {
            //获取被点的餐桌项
            var lv1 = sender as ListView;
            var lvi = lv1.SelectedItems[0];
            //获取餐桌编号,拿到选中的桌
            int tableId = Convert.ToInt32(lvi.Tag);

            if (lvi.ImageIndex == 0)
            {
                //当前餐桌空闲,则开单
                //1.开单,向orderinfo表插入数据
                //2.修改餐桌状态为使用
                int orderId = oiBll.KaiDan(tableId);//获得订单号
                lvi.Tag = orderId;
                //3.更新餐桌图标,开单后由空闲改为使用中
                lv1.SelectedItems[0].ImageIndex = 1;
            }
            else
            {
                //当前餐桌已经占用,则进行点菜操作
                lvi.Tag = oiBll.GetOrderIdByTableId(tableId);
            }
            //4.打开点菜窗体
            FormOrderDish formOrderDish = new FormOrderDish();

            formOrderDish.Tag = lvi.Tag;
            formOrderDish.Show();
        }
예제 #5
0
        //双击餐桌(sender是由控件内部传入的控件,双击的事件作为媒介,这里只要假设它就是底层已经传进来了)
        private void lvTableInfo_DoubleClick(object sender, EventArgs e)
        {
            //获取被点的餐桌项
            var lv1 = sender as ListView;
            var lvi = lv1.SelectedItems[0];
            //获取餐桌编号
            int tableId = Convert.ToInt32(lvi.Tag);

            if (lvi.ImageIndex == 0)
            {
                //3、更新项的图标为占用
                lv1.SelectedItems[0].ImageIndex = 1;
            }
            //4、打开点菜窗体
            FormOrderDish formOrderDish = new FormOrderDish();

            formOrderDish.Tag = lvi.Tag;
            //调用的是show()方法,底层执行的是load事件(可以是给属性和事件赋值)
            formOrderDish.Show();
        }
예제 #6
0
        private void LvTableInfo_DoubleClick(object sender, EventArgs e)
        {
            var lv1     = sender as ListView;
            var lvi     = lv1.SelectedItems[0];
            int tableId = Convert.ToInt32(lvi.Tag);

            if (lvi.ImageIndex == 0)
            {
                int orderId = oiBll.KaiDan(tableId);
                lvi.Tag = orderId;
                lv1.SelectedItems[0].ImageIndex = 1;
            }
            else
            {
                lvi.Tag = oiBll.GetOrderIdByTableId(tableId);
            }

            FormOrderDish formOrderDish = new FormOrderDish();

            formOrderDish.Tag = lvi.Tag;
            formOrderDish.Show();
        }